Compare commits

...

2 Commits

Author SHA1 Message Date
Fred Pauchet 0fe3c62f45 Ignore IDE configuration files 2023-01-10 21:02:39 +01:00
Fred Pauchet 23558ac1b4 Display section parent 2023-01-10 21:02:18 +01:00
3 changed files with 13 additions and 4 deletions

1
.gitignore vendored
View File

@ -161,3 +161,4 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.vscode/

View File

@ -143,16 +143,24 @@ class Site:
section_key.add(article)
if len(article.sections) > 1:
parent = section_key
for section in article.sections[1:]:
section_key = section_key.sections.setdefault(section, Section(section))
section_key = section_key.sections.setdefault(
section, Section(section, parent=parent)
)
section_key.add(article)
parent = section
def write(self):
LOGGER.info("Writing site articles")
for article in self.articles:
with open(os.path.join(self.root_directory, "index.html"), "w") as html_file:
html_file.write("""<html><body><p>{}</p></body></html>""".format(self.articles))
with open(
os.path.join(self.root_directory, "index.html"), "w"
) as html_file:
html_file.write(
"""<html><body><p>{}</p></body></html>""".format(self.articles)
)
LOGGER.info("Writing site categories")
for section in self.sections.values():

View File

@ -1,4 +1,4 @@
<h1>{{ section.parent }} >> {{ section.key }}</h1>
<h1>{{ section.parent.key }} >> {{ section.key }}</h1>
<ul>
{% for article in section.articles %}