Agregate sublevel and remove duplicates
This commit is contained in:
parent
7377037c1a
commit
277ec60b8b
|
@ -214,11 +214,11 @@ def main():
|
|||
|
||||
def filter_outlines(headers_list, max_level=None):
|
||||
filtered_outlines = []
|
||||
buffered_header = None
|
||||
default_max_level = max([hl[1] for hl in headers_list])
|
||||
if not max_level:
|
||||
max_level = default_max_level
|
||||
temp_max_level = default_max_level
|
||||
buffered_header = {l: None for l in range(max_level + 1)}
|
||||
filtered_out = ['Pratique', 'Plan', 'Licence du document']
|
||||
|
||||
for header in headers_list:
|
||||
|
@ -226,9 +226,13 @@ def main():
|
|||
if header[2] in filtered_out:
|
||||
temp_max_level = header[1] + 1
|
||||
continue
|
||||
else:
|
||||
temp_max_level = default_max_level
|
||||
elif header[2] != buffered_header[header[1]]:
|
||||
buffered_header[header[1]] = header[2]
|
||||
for bf in buffered_header:
|
||||
if bf > header[1]:
|
||||
buffered_header[bf] = None
|
||||
filtered_outlines.append(header)
|
||||
temp_max_level = default_max_level
|
||||
return filtered_outlines
|
||||
|
||||
def outline_format(headers_list):
|
||||
|
|
Loading…
Reference in New Issue