From 6008f32194b55fe5b686b22901c3aef1726d24c4 Mon Sep 17 00:00:00 2001 From: MrHeadwar Date: Wed, 29 Dec 2021 19:04:24 +0100 Subject: [PATCH] PDF : correct content hierarchy on the fly --- build.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/build.py b/build.py index 775e3f8..d7753fe 100755 --- a/build.py +++ b/build.py @@ -208,16 +208,22 @@ def GetParent(fs, pos): # -# Change the hierarchy of titles : h1->hn, h2->hn+1, etc... n being delta-1 -# -def reheader(txt, delta): - for i in range(6, 0, -1): - txt = txt.replace('->,

->, so that the +# highest hyerarchy level is maxlevel +# +def remapheader(txt, maxlevel): + maxlvl=1 + # find the highest hierarchy level in the content + while maxlvl < 7 and txt.find('' + header['title'] + '\n'; -- 2.37.2