Skip to content

Commit 3e4ff8c

Browse files
committed
simplify item html
1 parent 5fae3f1 commit 3e4ff8c

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ website:
3333
cd docs/; \
3434
tree -H '.' \
3535
-L 4 --noreport --charset utf-8 -P "*.html" -C \
36-
-T "Packages ($(shell date))" > items.html
36+
-T "Packages ($(shell date))" > items.html ; \
37+
cd .. ; \
38+
python -c 'import packaging as p; p.simplify_item_html("docs/items.html")'
39+

packaging/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from .packaging import file_table, tarballs, fingerprints, save_fingerprints
22

3+
from .website import simplify_item_html

packaging/website.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
def simplify_item_html(html_file:str):
3+
"""Simplify html file resulting from tree
4+
5+
i.e. remove second level folders and supplements
6+
"""
7+
8+
with open(html_file, "r", encoding="utf-8") as fl:
9+
content = fl.readlines()
10+
11+
with open(html_file, "w", encoding="utf-8") as fl:
12+
for l in content:
13+
if not (l.count(" ") == 2 or
14+
l.find(">media<")>=0 or
15+
l.find(">supplements")>=0):
16+
fl.write(l)

0 commit comments

Comments
 (0)