Skip to content

Commit f4937a7

Browse files
authored
Merge pull request #26 from aousd/configurable_filter_list
2 parents f97742a + 54fc86c commit f4937a7

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

doc_build/doc_builder.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,18 @@ def build_docs(self, args):
104104
fontpath = (Path(__file__).resolve().parent / "front_page").as_posix() + "/"
105105
dejavufontpath = (Path(__file__).resolve().parent / "fonts").as_posix() + "/"
106106

107+
doc_build_filters = []
108+
for doc_filter in self.get_doc_build_filters():
109+
doc_build_filters.extend(["-F", doc_filter])
110+
107111
# Set the cwd to the artifacts dir because it's easier for some filters to work relatively to it
108112
os.chdir(self.get_artifacts_dir(args.output))
109113
shared_command = [
110114
"--defaults",
111115
spec,
112116
combined,
113117
"--from=gfm+",
114-
"-F",
115-
self.get_filter("convert_mathblocks"),
116-
"-F",
117-
self.get_filter("header6"),
118-
"-F",
119-
self.get_filter("resolve_sections"),
120-
"-F",
121-
self.get_filter("sections_new_page"),
122-
"-F",
123-
self.get_filter("smaller_listings"),
118+
*doc_build_filters,
124119
"-V",
125120
f"date={datetime.today().strftime('%Y-%m-%d')}",
126121
"-V",
@@ -228,6 +223,16 @@ def stderr_processor(std_err):
228223

229224
return pdf, docx, html
230225

226+
def get_doc_build_filters(self):
227+
"""Return a list of paths to the filters the build_doc method runs in the order they must run"""
228+
return [
229+
self.get_filter("convert_mathblocks"),
230+
self.get_filter("header6"),
231+
self.get_filter("resolve_sections"),
232+
self.get_filter("sections_new_page"),
233+
self.get_filter("smaller_listings"),
234+
]
235+
231236
def get_file_base_name(self):
232237
tokens = ["aousd"]
233238
results = git.get_output(["remote", "-v"]).splitlines()

0 commit comments

Comments
 (0)