This is an automated email from the ASF dual-hosted git repository.
wave pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/petri-site.git
The following commit(s) were added to refs/heads/master by this push:
new 75477bc Clean up flake warnings
75477bc is described below
commit 75477bcb6087cc61f467e49a1e3033d496bfd954
Author: Dave Fisher <[email protected]>
AuthorDate: Mon Apr 12 13:18:18 2021 -0700
Clean up flake warnings
---
theme/plugins/toc2.py | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/theme/plugins/toc2.py b/theme/plugins/toc2.py
index 87885c3..d19d6db 100644
--- a/theme/plugins/toc2.py
+++ b/theme/plugins/toc2.py
@@ -36,6 +36,8 @@ def unique(id, ids):
id = '%s_%d' % (id, 1)
ids.add(id)
return id
+
+
'''
end
'''
@@ -56,8 +58,8 @@ class HtmlTreeNode(object):
if not new_string:
new_string = new_header.find_all(
- text=lambda t: not isinstance(t, Comment),
- recursive=True)
+ text=lambda t: not isinstance(t, Comment),
+ recursive=True)
new_string = "".join(new_string)
if not new_id:
@@ -81,11 +83,11 @@ class HtmlTreeNode(object):
ret = ""
if self.parent:
ret = "<a class='toc-href' href='#{0}' title='{1}'>{1}</a>".format(
- self.id, self.header)
+ self.id, self.header)
if self.children:
- ret += "<ul>{}</ul>".format('{}'*len(self.children)).format(
- *self.children)
+ ret += "<ul>{}</ul>".format('{}' * len(self.children)).format(
+ *self.children)
if self.parent:
ret = "<li>{}</li>".format(ret)
@@ -128,25 +130,27 @@ def generate_toc(content):
raise e
# Find TOC tag
- tocTag = soup.find('p', text = '[TOC]')
+ tocTag = soup.find('p', text='[TOC]')
if tocTag:
for header in tocTag.findAllNext(header_re):
settoc = True
node, new_header = node.add(header, all_ids)
header.replaceWith(new_header) # to get our ids back into soup
-
+
if settoc:
print("Generating ToC for %s" % content.slug)
tree_string = '{}'.format(tree)
tree_soup = BeautifulSoup(tree_string, 'html.parser')
content.toc = tree_soup.decode(formatter='html')
- itoc = soup.find('p', text = '[TOC]')
+ itoc = soup.find('p', text='[TOC]')
if itoc:
itoc.replaceWith(tree_soup)
-
+
content._content = soup.decode(formatter='html')
def register():
signals.initialized.connect(init_default_config)
+
+
signals.content_object_init.connect(generate_toc)