Skip to content
Snippets Groups Projects
Verified Commit 2cfc1de6 authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

auto count of lines

parent 6d9a470c
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ def build_section_start(title, shortcut):
def build_section_end():
return "\t\t</ul>\n\t</div>"
def remove_header(localroot, root, filename, n=5):
def remove_header(localroot, root, filename):
nfirstlines = []
#cwd = os.getcwd()
......@@ -61,8 +61,9 @@ def remove_header(localroot, root, filename, n=5):
count += 1
# check if the header is actually a header
if (count == 0 or count == n) and line[0:3] == "---":
if count > 1 and line[0:3] == "---":
headerCheck = True
n = count
# remove the header
if count > n and headerCheck:
......@@ -139,9 +140,9 @@ for folder in cardDirs:
# remove the previous header
if "handbook-annexes" in fileName or "handbook-additional" in fileName:
remove_header(localroot, root, file, 10)
remove_header(localroot, root, file)
else:
remove_header(localroot, root, file, 8)
remove_header(localroot, root, file)
# generate a permalink
permalink = "/" + root + "/"
......
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