Skip to content
Snippets Groups Projects
Commit ac435338 authored by David Dorchies's avatar David Dorchies
Browse files

fix(docs/latex): correct title if previous file has no terminal new line

Refs #656
parent df01cfb2
No related branches found
No related tags found
2 merge requests!252release: version 4.18.0,!251Resolve "Documentation PDF: erreurs à la compilation"
Pipeline #163996 passed
......@@ -82,7 +82,7 @@ def shiftMdHeaders(mdContent, level):
if len(item) > 0 :
if item[0] == "#":
lMd[i] = ("#" * level) + item
return "\n".join(lMd)
return "\n".join(lMd) + "\n"
# Browses MkDocs configuration file and merges .md files
def exploreAndMerge(docs_dir, nav, output = '', level = 0):
......@@ -100,11 +100,13 @@ def exploreAndMerge(docs_dir, nav, output = '', level = 0):
# Triple "../" because file will be compiled from pdf_build/latex_models
path = os.path.join(baseDir, os.path.dirname(filepath))
s = f.read() + "\n"
if s[-2] != "\n\n":
s += "\n"
# Modification of image and links paths
s = re.sub(r'(\!\[.+\]\()(.+)(\))', r'\1'+path+r'/\2\3', s)
s = re.sub(r'(\\\()(.+?)(\\\))', r'$\2$', s)
s = shiftMdHeaders(s, level)
output += "\n" + s
output += s
elif type(d) is dict:
level += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment