adrien.aribaut-gaudin
commited on
Commit
·
25eac81
1
Parent(s):
4955081
fix: index for block_requirements
Browse files- src/domain/doc.py +1 -1
- src/tools/index_creation.py +6 -8
src/domain/doc.py
CHANGED
@@ -29,8 +29,8 @@ class Doc:
|
|
29 |
self.id_ = id(self)
|
30 |
self.path = path
|
31 |
self.paragraphs = [Paragraph(xp, self.id_, i, self) for (i, xp) in enumerate(self.xdoc.paragraphs)]
|
32 |
-
self.requirements_paragraphs = WordReader(self.path).paragraphs if not "data/templates" in self.path else []
|
33 |
self.handle_content_before_toc()
|
|
|
34 |
self.container = Container(self.paragraphs, father=self)
|
35 |
self.container_requirements = Container_requirements(self.requirements_paragraphs, father=self)
|
36 |
set_indexes(self.container, self.path)
|
|
|
29 |
self.id_ = id(self)
|
30 |
self.path = path
|
31 |
self.paragraphs = [Paragraph(xp, self.id_, i, self) for (i, xp) in enumerate(self.xdoc.paragraphs)]
|
|
|
32 |
self.handle_content_before_toc()
|
33 |
+
self.requirements_paragraphs = WordReader(self.path).paragraphs if not "data/templates" in self.path else []
|
34 |
self.container = Container(self.paragraphs, father=self)
|
35 |
self.container_requirements = Container_requirements(self.requirements_paragraphs, father=self)
|
36 |
set_indexes(self.container, self.path)
|
src/tools/index_creation.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
-
from src.domain.container import Container
|
2 |
-
|
3 |
INFINITE = 99999
|
4 |
|
5 |
-
def create_dic_levels(c
|
6 |
if c.level == 0:
|
7 |
dict_of_levels[c.level] = [0]
|
8 |
for child in c.children:
|
@@ -14,7 +12,7 @@ def create_dic_levels(c:Container,dict_of_levels : dict = {}):
|
|
14 |
return dict_of_levels
|
15 |
|
16 |
|
17 |
-
def create_good_indexes(c
|
18 |
actual_level = c.level
|
19 |
c.index = dict_of_levels[actual_level].copy()
|
20 |
actual_len = len(dict_of_levels[actual_level])
|
@@ -31,7 +29,7 @@ def create_good_indexes(c:Container, dict_of_levels : dict):
|
|
31 |
create_good_indexes(child, dict_of_levels) # Apply the function recursively to all children
|
32 |
|
33 |
|
34 |
-
def create_good_indexes_not_ordered_titles(c
|
35 |
actual_level = c.level
|
36 |
c.index = dict_of_levels[actual_level].copy()
|
37 |
actual_len = len(dict_of_levels[actual_level])
|
@@ -48,7 +46,7 @@ def create_good_indexes_not_ordered_titles(c:Container, dict_of_levels : dict):
|
|
48 |
create_good_indexes(child, dict_of_levels) # Apply the function recursively to all children
|
49 |
|
50 |
|
51 |
-
def set_good_block_indexes(c
|
52 |
for i in c.containers:
|
53 |
for b in i.blocks:
|
54 |
for j in range(len(i.index)):
|
@@ -57,10 +55,10 @@ def set_good_block_indexes(c:Container):
|
|
57 |
b.index = i.index
|
58 |
|
59 |
|
60 |
-
def set_indexes(c
|
61 |
if "temp/generated_files" in path or "data/templates" in path:
|
62 |
return
|
63 |
-
dict_levels = create_dic_levels(c)
|
64 |
myKeys = list(dict_levels.keys())
|
65 |
myKeys.sort()
|
66 |
dict_levels = {key: dict_levels[key] for key in myKeys}
|
|
|
|
|
|
|
1 |
INFINITE = 99999
|
2 |
|
3 |
+
def create_dic_levels(c,dict_of_levels : dict = {}):
|
4 |
if c.level == 0:
|
5 |
dict_of_levels[c.level] = [0]
|
6 |
for child in c.children:
|
|
|
12 |
return dict_of_levels
|
13 |
|
14 |
|
15 |
+
def create_good_indexes(c, dict_of_levels : dict):
|
16 |
actual_level = c.level
|
17 |
c.index = dict_of_levels[actual_level].copy()
|
18 |
actual_len = len(dict_of_levels[actual_level])
|
|
|
29 |
create_good_indexes(child, dict_of_levels) # Apply the function recursively to all children
|
30 |
|
31 |
|
32 |
+
def create_good_indexes_not_ordered_titles(c, dict_of_levels : dict):
|
33 |
actual_level = c.level
|
34 |
c.index = dict_of_levels[actual_level].copy()
|
35 |
actual_len = len(dict_of_levels[actual_level])
|
|
|
46 |
create_good_indexes(child, dict_of_levels) # Apply the function recursively to all children
|
47 |
|
48 |
|
49 |
+
def set_good_block_indexes(c):
|
50 |
for i in c.containers:
|
51 |
for b in i.blocks:
|
52 |
for j in range(len(i.index)):
|
|
|
55 |
b.index = i.index
|
56 |
|
57 |
|
58 |
+
def set_indexes(c, path : str):
|
59 |
if "temp/generated_files" in path or "data/templates" in path:
|
60 |
return
|
61 |
+
dict_levels = create_dic_levels(c, dict_of_levels={})
|
62 |
myKeys = list(dict_levels.keys())
|
63 |
myKeys.sort()
|
64 |
dict_levels = {key: dict_levels[key] for key in myKeys}
|