Skip to content

Commit

Permalink
Fix news TOC structure
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Somers <[email protected]>
  • Loading branch information
bensmrs committed May 31, 2024
1 parent d773022 commit 10285d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion content/STRUCTURE.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"generator": "news",
"meta": {"dir": "/content/incus/news/",
"input": "incus/news.md",
"toc_depth": "2-2",
"toc_depth": "2-3",
"str_older": "Older news",
"str_back": "Back to the news overview"}},

Expand Down
8 changes: 7 additions & 1 deletion generate
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,14 @@ def gen_page(entry, override, prefix, **variables):
"<span class=\"text-muted\">%s</span>\n" % \
(title, article_date)

article_content = ""
for line in article["content"].splitlines(keepends=True):
if line.startswith("#"):
line = "##%s" % line
article_content += line

# Compose the content
article_content = "[TOC]\n" + article_title + article["content"]
article_content = "[TOC]\n" + article_title + article_content

# Get the file name and path
article_filename = date.strftime("%Y_%m_%d_%H_%M")+".html"
Expand Down

0 comments on commit 10285d4

Please sign in to comment.