From 8a40233824bcabb65d3f2d0463012bd55c4a029b Mon Sep 17 00:00:00 2001 From: Unrud Date: Sat, 18 Apr 2020 13:01:05 +0200 Subject: [PATCH] Specify selectors --- documentation-generator/postprocessor.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/documentation-generator/postprocessor.py b/documentation-generator/postprocessor.py index a17511cc..76e36370 100755 --- a/documentation-generator/postprocessor.py +++ b/documentation-generator/postprocessor.py @@ -17,14 +17,15 @@ def main(): soup = BeautifulSoup(sys.stdin.buffer, "html.parser") # Mark the hierachical levels in the navigation - for section in soup.select("section"): - link = soup.find("a", href="#" + section["id"]) + nav = soup.select("main nav")[0] + for section in soup.select("main section"): + link = nav.find("a", href="#" + section["id"]) if link is None: continue add_class(link.parent, section["class"][0]) # Mark last section - add_class(soup.select("section")[-1], "last") + add_class(soup.select("main section")[-1], "last") # Wrap tables in a div container (for scrolling) for table in soup.select("main table"): @@ -33,7 +34,7 @@ def main(): table.wrap(container) # Add a link with the fragment to every header - for header in soup.select("section > *:first-child"): + for header in soup.select("main section > *:first-child"): section = header.parent link = soup.new_tag("a") add_class(link, "headerlink")