Don't double space the title page.
This commit is contained in:
parent
b549d8117c
commit
5d3eba05ff
|
@ -86,21 +86,28 @@ def double_space_and_indent(paragraphs):
|
||||||
previous_paragraph = None
|
previous_paragraph = None
|
||||||
this_paragraph_plaintext = False
|
this_paragraph_plaintext = False
|
||||||
previous_paragraph_plaintext = None
|
previous_paragraph_plaintext = None
|
||||||
|
reached_first_heading = False
|
||||||
|
|
||||||
for paragraph in paragraphs:
|
for paragraph in paragraphs:
|
||||||
paragraph.paragraph_format.line_spacing = 2
|
|
||||||
paragraph.paragraph_format.space_before = docx.shared.Inches(0)
|
|
||||||
paragraph.paragraph_format.space_after = docx.shared.Inches(0)
|
|
||||||
|
|
||||||
# To reduce page count, allow splitting paragraphs across pages.
|
|
||||||
paragraph.paragraph_format.widow_control = False
|
|
||||||
|
|
||||||
this_paragraph_plaintext = not (
|
this_paragraph_plaintext = not (
|
||||||
paragraph.style.name.startswith('Heading')
|
paragraph.style.name.startswith('Heading')
|
||||||
or paragraph.style.name == '0 Block'
|
or paragraph.style.name == '0 Block'
|
||||||
or paragraph.style.paragraph_format.left_indent
|
or paragraph.style.paragraph_format.left_indent
|
||||||
or paragraph.style.paragraph_format.right_indent
|
or paragraph.style.paragraph_format.right_indent
|
||||||
)
|
)
|
||||||
|
if not this_paragraph_plaintext:
|
||||||
|
reached_first_heading = True
|
||||||
|
|
||||||
|
# Skip past the title page until we reach the first chapter/other heading.
|
||||||
|
if not reached_first_heading:
|
||||||
|
continue
|
||||||
|
|
||||||
|
paragraph.paragraph_format.line_spacing = 2
|
||||||
|
paragraph.paragraph_format.space_before = docx.shared.Inches(0)
|
||||||
|
paragraph.paragraph_format.space_after = docx.shared.Inches(0)
|
||||||
|
|
||||||
|
# To reduce page count, allow splitting paragraphs across pages.
|
||||||
|
paragraph.paragraph_format.widow_control = False
|
||||||
|
|
||||||
# Indent first lines of paragraphs except for styled ones (headings, etc.) and initial
|
# Indent first lines of paragraphs except for styled ones (headings, etc.) and initial
|
||||||
# paragraphs.
|
# paragraphs.
|
||||||
|
|
Loading…
Reference in New Issue