Fixed #859: New config option to disable paragraph numbering in motion pdf

Default value: disabled
This commit is contained in:
Emanuel Schuetze 2013-09-02 21:03:27 +02:00
parent 9dcdf67398
commit 48f8e82eda
2 changed files with 17 additions and 4 deletions

View File

@ -212,8 +212,11 @@ def convert_html_to_reportlab(pdf, text):
if paragraph == '\n' or paragraph == '\n\n' or paragraph == '\n\t':
continue
if "<pre>" in paragraph:
pdf.append(Paragraph(paragraph.replace('\n', '<br/>'), stylesheet['InnerMonotypeParagraph'], str(paragraph_number)))
paragraph_number += 1
if config["motion_pdf_paragraph_numbering"]:
pdf.append(Paragraph(paragraph.replace('\n', '<br/>'), stylesheet['InnerMonotypeParagraph'], str(paragraph_number)))
paragraph_number += 1
else:
pdf.append(Paragraph(paragraph.replace('\n', '<br/>'), stylesheet['InnerMonotypeParagraph']))
elif "<para>" in paragraph:
pdf.append(Paragraph(paragraph, stylesheet['InnerListParagraph']))
elif "<seqreset" in paragraph:
@ -225,8 +228,11 @@ def convert_html_to_reportlab(pdf, text):
elif "<h3>" in paragraph:
pdf.append(Paragraph(paragraph, stylesheet['InnerH3Paragraph']))
else:
pdf.append(Paragraph(paragraph, stylesheet['InnerParagraph'], str(paragraph_number)))
paragraph_number += 1
if config["motion_pdf_paragraph_numbering"]:
pdf.append(Paragraph(paragraph, stylesheet['InnerParagraph'], str(paragraph_number)))
paragraph_number += 1
else:
pdf.append(Paragraph(paragraph, stylesheet['InnerParagraph']))
def all_motion_cover(pdf, motions):

View File

@ -88,6 +88,12 @@ def setup_motion_config_page(sender, **kwargs):
widget=forms.Textarea(),
required=False,
label=ugettext_lazy('Preamble text for PDF document (all motions)')))
motion_pdf_paragraph_numbering = ConfigVariable(
name='motion_pdf_paragraph_numbering',
default_value=False,
form_field=forms.BooleanField(
label=ugettext_lazy('Show paragraph numbering'),
required=False))
motion_allow_disable_versioning = ConfigVariable(
name='motion_allow_disable_versioning',
default_value=False,
@ -126,6 +132,7 @@ def setup_motion_config_page(sender, **kwargs):
motion_pdf_ballot_papers_number,
motion_pdf_title,
motion_pdf_preamble,
motion_pdf_paragraph_numbering,
motion_allow_disable_versioning,
motion_workflow,
motion_identifier))