Merge pull request #2428 from FinnStutzenstein/Issue2425

Removing PDF paragraph numbering (fixes #2425)
This commit is contained in:
Emanuel Schütze 2016-09-24 13:39:06 +02:00 committed by GitHub
commit 4363c3498a
2 changed files with 2 additions and 20 deletions

View File

@ -227,12 +227,3 @@ def get_config_variables():
weight=375, weight=375,
group='Motions', group='Motions',
subgroup='Export') subgroup='Export')
yield ConfigVariable(
name='motions_pdf_paragraph_numbering',
default_value=False,
input_type='boolean',
label='Show paragraph numbering (only in PDF)',
weight=380,
group='Motions',
subgroup='Export')

View File

@ -273,7 +273,6 @@ def convert_html_to_reportlab(pdf, text):
tag.unwrap() tag.unwrap()
# print paragraphs with numbers # print paragraphs with numbers
text = soup.body.contents text = soup.body.contents
paragraph_number = 1
for paragraph in text: for paragraph in text:
paragraph = str(paragraph) paragraph = str(paragraph)
# ignore empty paragraphs (created by newlines/tabs of ckeditor) # ignore empty paragraphs (created by newlines/tabs of ckeditor)
@ -281,10 +280,6 @@ def convert_html_to_reportlab(pdf, text):
continue continue
if "<pre>" in paragraph: if "<pre>" in paragraph:
txt = paragraph.replace('\n', '<br/>').replace(' ', '&nbsp;') txt = paragraph.replace('\n', '<br/>').replace(' ', '&nbsp;')
if config["motions_pdf_paragraph_numbering"]:
pdf.append(Paragraph(txt, stylesheet['InnerMonotypeParagraph'], str(paragraph_number)))
paragraph_number += 1
else:
pdf.append(Paragraph(txt, stylesheet['InnerMonotypeParagraph'])) pdf.append(Paragraph(txt, stylesheet['InnerMonotypeParagraph']))
elif "<para>" in paragraph: elif "<para>" in paragraph:
pdf.append(Paragraph(paragraph, stylesheet['InnerListParagraph'])) pdf.append(Paragraph(paragraph, stylesheet['InnerListParagraph']))
@ -296,10 +291,6 @@ def convert_html_to_reportlab(pdf, text):
pdf.append(Paragraph(paragraph, stylesheet['InnerH2Paragraph'])) pdf.append(Paragraph(paragraph, stylesheet['InnerH2Paragraph']))
elif "<h3>" in paragraph: elif "<h3>" in paragraph:
pdf.append(Paragraph(paragraph, stylesheet['InnerH3Paragraph'])) pdf.append(Paragraph(paragraph, stylesheet['InnerH3Paragraph']))
else:
if config["motions_pdf_paragraph_numbering"]:
pdf.append(Paragraph(paragraph, stylesheet['InnerParagraph'], str(paragraph_number)))
paragraph_number += 1
else: else:
pdf.append(Paragraph(paragraph, stylesheet['InnerParagraph'])) pdf.append(Paragraph(paragraph, stylesheet['InnerParagraph']))