Skip to content

Commit c982332

Browse files
committed
Add navigation exclude option
1 parent 7f6a841 commit c982332

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

www/build.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def __init__(self, *_, **__) -> None:
1313
super().__init__(*_, *__)
1414
self.title = None
1515
self.updates = 0
16+
self.include = True
1617

1718
def handle_starttag(self, tag, attrs):
1819
if tag == "meta":
@@ -27,6 +28,8 @@ def handle_starttag(self, tag, attrs):
2728
print(f" > Found nav-title {self.title}")
2829
else:
2930
print(f" > Found nav-title {self.title}")
31+
else:
32+
self.include = False
3033

3134

3235
html_files = {}
@@ -69,11 +72,16 @@ def handle_starttag(self, tag, attrs):
6972
p = NavHTMLParser()
7073
p.feed(open(os.path.join(dir, file), "rb").read().decode())
7174
p.close()
72-
html_files[os.path.join(dir[6:], file)] = p.title
73-
if p.updates > 1:
75+
if not p.include:
7476
print(
75-
f" > Warning: More than 1 nav-title tags found ({p.updates}), the latest one will be used."
77+
" > Found empty nav-title, file will not be included in navigation"
7678
)
79+
else:
80+
html_files[os.path.join(dir[6:], file)] = p.title
81+
if p.updates > 1:
82+
print(
83+
f" > Warning: More than 1 nav-title tags found ({p.updates}), the latest one will be used."
84+
)
7785
except Exception as e:
7886
print(f" > Failed ({e})")
7987

www/indux.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Document</title>
7+
<meta name="nav-title" />
78
</head>
89
<body>
910
Among Us

0 commit comments

Comments
 (0)