Parcourir la source

Fix toc display by removing the title

Title was displayed in the table of content, we do not want this
behaviour. The plugin has been directly modified in order to fix
that.
Maxime Vidori il y a 9 ans
Parent
commit
20a30b0aa8
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      plugins/pelican-toc/toc.py

+ 2 - 2
plugins/pelican-toc/toc.py

@@ -77,7 +77,7 @@ class HtmlTreeNode(object):
 
     def __str__(self):
         ret = "<a class='toc-href' href='#{0}' title='{1}'>{1}</a>".format(
-                self.id, self.header)
+                self.id, self.header) if self.header else ""
 
         if self.children:
             ret += "<ul>{}</ul>".format('{}'*len(self.children)).format(
@@ -116,7 +116,7 @@ def generate_toc(content):
 
     all_ids = set()
     title = content.metadata.get('title', 'Title')
-    tree = node = HtmlTreeNode(None, title, 'h0', '')
+    tree = node = HtmlTreeNode(None, '', 'h0', '')
     soup = BeautifulSoup(content._content, 'html.parser')
     settoc = False