Add flag to format the whole document including the title page (if any).
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
a4663d8139
commit
89faad1b2b
|
@ -83,7 +83,7 @@ def right_align_header(document):
|
|||
header_paragraph.paragraph_format.alignment = docx.enum.text.WD_ALIGN_PARAGRAPH.RIGHT
|
||||
|
||||
|
||||
def double_space_and_indent(paragraphs):
|
||||
def double_space_and_indent(paragraphs, format_all):
|
||||
previous_paragraph = None
|
||||
this_paragraph_plaintext = False
|
||||
previous_paragraph_plaintext = None
|
||||
|
@ -100,7 +100,7 @@ def double_space_and_indent(paragraphs):
|
|||
reached_first_heading = True
|
||||
|
||||
# Skip past the title page until we reach the first chapter/other heading.
|
||||
if not reached_first_heading:
|
||||
if not reached_first_heading and not format_all:
|
||||
continue
|
||||
|
||||
paragraph.paragraph_format.line_spacing = 2
|
||||
|
@ -150,6 +150,13 @@ def parse_arguments(unparsed_arguments):
|
|||
'--title',
|
||||
help='Project title to show in page headers, defaults to the manuscript filename without the file extension',
|
||||
)
|
||||
parser.add_argument(
|
||||
'-f',
|
||||
'--format-all',
|
||||
help='Format the whole document, even the title page (if any)',
|
||||
action='store_true',
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
return parser.parse_args(unparsed_arguments)
|
||||
|
@ -170,7 +177,7 @@ def main():
|
|||
skip_page_number_on_first_page(document)
|
||||
|
||||
right_align_header(document)
|
||||
double_space_and_indent(document.paragraphs)
|
||||
double_space_and_indent(document.paragraphs, arguments.format_all)
|
||||
|
||||
document.save(arguments.document_filename)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user