Display section parent
This commit is contained in:
parent
b5af5d20da
commit
23558ac1b4
|
@ -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():
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<h1>{{ section.parent }} >> {{ section.key }}</h1>
|
||||
<h1>{{ section.parent.key }} >> {{ section.key }}</h1>
|
||||
|
||||
<ul>
|
||||
{% for article in section.articles %}
|
||||
|
|
Loading…
Reference in New Issue