mirror of
https://github.com/Kozea/Radicale.git
synced 2025-07-02 16:58:30 +00:00
Specify selectors
This commit is contained in:
parent
5c4ff4f93f
commit
8a40233824
1 changed files with 5 additions and 4 deletions
|
@ -17,14 +17,15 @@ def main():
|
||||||
soup = BeautifulSoup(sys.stdin.buffer, "html.parser")
|
soup = BeautifulSoup(sys.stdin.buffer, "html.parser")
|
||||||
|
|
||||||
# Mark the hierachical levels in the navigation
|
# Mark the hierachical levels in the navigation
|
||||||
for section in soup.select("section"):
|
nav = soup.select("main nav")[0]
|
||||||
link = soup.find("a", href="#" + section["id"])
|
for section in soup.select("main section"):
|
||||||
|
link = nav.find("a", href="#" + section["id"])
|
||||||
if link is None:
|
if link is None:
|
||||||
continue
|
continue
|
||||||
add_class(link.parent, section["class"][0])
|
add_class(link.parent, section["class"][0])
|
||||||
|
|
||||||
# Mark last section
|
# 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)
|
# Wrap tables in a div container (for scrolling)
|
||||||
for table in soup.select("main table"):
|
for table in soup.select("main table"):
|
||||||
|
@ -33,7 +34,7 @@ def main():
|
||||||
table.wrap(container)
|
table.wrap(container)
|
||||||
|
|
||||||
# Add a link with the fragment to every header
|
# 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
|
section = header.parent
|
||||||
link = soup.new_tag("a")
|
link = soup.new_tag("a")
|
||||||
add_class(link, "headerlink")
|
add_class(link, "headerlink")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue