forked from AuroraMiddleware/gtk
docs: Allow influencing pandoc divisons
Arrange for files named section-foo.md to be turned into docbook sections, while others get turned into chapters. This is necessary to allow including such content in chapters, since chapters in docbook don't nest.
This commit is contained in:
parent
a37b9d7578
commit
581b39a38d
@ -167,12 +167,16 @@ MarkdownExtensions = {
|
|||||||
|
|
||||||
def ConvertToDocbook(infile, outfile):
|
def ConvertToDocbook(infile, outfile):
|
||||||
basename = os.path.basename(infile)
|
basename = os.path.basename(infile)
|
||||||
|
if basename.startswith('section'):
|
||||||
|
division='section'
|
||||||
|
else:
|
||||||
|
division='chapter'
|
||||||
input_format = "markdown" + "".join(MarkdownExtensions)
|
input_format = "markdown" + "".join(MarkdownExtensions)
|
||||||
output_format = "docbook"
|
output_format = "docbook"
|
||||||
subprocess.check_call(["pandoc", infile, "-o", outfile,
|
subprocess.check_call(["pandoc", infile, "-o", outfile,
|
||||||
"--from=" + input_format,
|
"--from=" + input_format,
|
||||||
"--to=" + output_format,
|
"--to=" + output_format,
|
||||||
"--top-level-division=chapter"])
|
"--top-level-division=" + division])
|
||||||
|
|
||||||
def ExpandGtkDocAbbreviations(infile, outfile):
|
def ExpandGtkDocAbbreviations(infile, outfile):
|
||||||
contents = open(infile, 'r', encoding='utf-8').read()
|
contents = open(infile, 'r', encoding='utf-8').read()
|
||||||
|
Loading…
Reference in New Issue
Block a user