Fixed #859: New config option to disable paragraph numbering in motion pdf
Default value: disabled
This commit is contained in:
parent
9dcdf67398
commit
48f8e82eda
@ -212,8 +212,11 @@ def convert_html_to_reportlab(pdf, text):
|
|||||||
if paragraph == '\n' or paragraph == '\n\n' or paragraph == '\n\t':
|
if paragraph == '\n' or paragraph == '\n\n' or paragraph == '\n\t':
|
||||||
continue
|
continue
|
||||||
if "<pre>" in paragraph:
|
if "<pre>" in paragraph:
|
||||||
|
if config["motion_pdf_paragraph_numbering"]:
|
||||||
pdf.append(Paragraph(paragraph.replace('\n', '<br/>'), stylesheet['InnerMonotypeParagraph'], str(paragraph_number)))
|
pdf.append(Paragraph(paragraph.replace('\n', '<br/>'), stylesheet['InnerMonotypeParagraph'], str(paragraph_number)))
|
||||||
paragraph_number += 1
|
paragraph_number += 1
|
||||||
|
else:
|
||||||
|
pdf.append(Paragraph(paragraph.replace('\n', '<br/>'), stylesheet['InnerMonotypeParagraph']))
|
||||||
elif "<para>" in paragraph:
|
elif "<para>" in paragraph:
|
||||||
pdf.append(Paragraph(paragraph, stylesheet['InnerListParagraph']))
|
pdf.append(Paragraph(paragraph, stylesheet['InnerListParagraph']))
|
||||||
elif "<seqreset" in paragraph:
|
elif "<seqreset" in paragraph:
|
||||||
@ -225,8 +228,11 @@ def convert_html_to_reportlab(pdf, text):
|
|||||||
elif "<h3>" in paragraph:
|
elif "<h3>" in paragraph:
|
||||||
pdf.append(Paragraph(paragraph, stylesheet['InnerH3Paragraph']))
|
pdf.append(Paragraph(paragraph, stylesheet['InnerH3Paragraph']))
|
||||||
else:
|
else:
|
||||||
|
if config["motion_pdf_paragraph_numbering"]:
|
||||||
pdf.append(Paragraph(paragraph, stylesheet['InnerParagraph'], str(paragraph_number)))
|
pdf.append(Paragraph(paragraph, stylesheet['InnerParagraph'], str(paragraph_number)))
|
||||||
paragraph_number += 1
|
paragraph_number += 1
|
||||||
|
else:
|
||||||
|
pdf.append(Paragraph(paragraph, stylesheet['InnerParagraph']))
|
||||||
|
|
||||||
|
|
||||||
def all_motion_cover(pdf, motions):
|
def all_motion_cover(pdf, motions):
|
||||||
|
@ -88,6 +88,12 @@ def setup_motion_config_page(sender, **kwargs):
|
|||||||
widget=forms.Textarea(),
|
widget=forms.Textarea(),
|
||||||
required=False,
|
required=False,
|
||||||
label=ugettext_lazy('Preamble text for PDF document (all motions)')))
|
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(
|
motion_allow_disable_versioning = ConfigVariable(
|
||||||
name='motion_allow_disable_versioning',
|
name='motion_allow_disable_versioning',
|
||||||
default_value=False,
|
default_value=False,
|
||||||
@ -126,6 +132,7 @@ def setup_motion_config_page(sender, **kwargs):
|
|||||||
motion_pdf_ballot_papers_number,
|
motion_pdf_ballot_papers_number,
|
||||||
motion_pdf_title,
|
motion_pdf_title,
|
||||||
motion_pdf_preamble,
|
motion_pdf_preamble,
|
||||||
|
motion_pdf_paragraph_numbering,
|
||||||
motion_allow_disable_versioning,
|
motion_allow_disable_versioning,
|
||||||
motion_workflow,
|
motion_workflow,
|
||||||
motion_identifier))
|
motion_identifier))
|
||||||
|
Loading…
Reference in New Issue
Block a user