Skip to content

Commit 22807db

Browse files
authored
Merge branch 'main' into preview-popup
2 parents fea526c + d961f6f commit 22807db

File tree

16 files changed

+294
-154
lines changed

16 files changed

+294
-154
lines changed

utils.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pathlib import Path
1111
from pprint import PrettyPrinter
1212
from typing import Dict, List, Optional, Tuple, Union
13+
from unicodedata import category
1314
from urllib.parse import quote, unquote
1415

1516
from slugify import slugify
@@ -179,9 +180,12 @@ def section_sidebar(self) -> str:
179180
"""Gets the title of the section."""
180181
sidebar = str(self.old_rel_path)
181182
assert Settings.options["SUBSECTION_SYMBOL"] is not None
183+
section_symbol = Settings.options["SUBSECTION_SYMBOL"] if sidebar.count("/") > 0 else ""
182184
sidebar = (
183-
sidebar.count("/") * Settings.options["SUBSECTION_SYMBOL"]
185+
section_symbol
184186
) + sidebar.split("/")[-1]
187+
188+
print("sidebar", sidebar)
185189
return (
186190
sidebar
187191
if (sidebar != "" and sidebar != ".")
@@ -292,7 +296,7 @@ class Settings:
292296
"SLUGIFY": "y",
293297
"HOME_GRAPH": "y",
294298
"PAGE_GRAPH": "y",
295-
"SUBSECTION_SYMBOL": "👉",
299+
"SUBSECTION_SYMBOL": "<div class='folder'><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M448 96h-172.1L226.7 50.75C214.7 38.74 198.5 32 181.5 32H64C28.65 32 0 60.66 0 96v320c0 35.34 28.65 64 64 64h384c35.35 0 64-28.66 64-64V160C512 124.7 483.3 96 448 96zM64 80h117.5c4.273 0 8.293 1.664 11.31 4.688L256 144h192c8.822 0 16 7.176 16 16v32h-416V96C48 87.18 55.18 80 64 80zM448 432H64c-8.822 0-16-7.176-16-16V240h416V416C464 424.8 456.8 432 448 432z' /></svg></div>",
296300
"LOCAL_GRAPH": "",
297301
"GRAPH_LINK_REPLACE": "",
298302
"STRICT_LINE_BREAKS": "y",
@@ -431,22 +435,25 @@ def parse_graph(nodes: Dict[str, str], edges: List[Tuple[str, str]]):
431435
edge_counts[i] += 1
432436
edge_counts[j] += 1
433437

438+
# Node category if more than 2 nested level, take sub folder
439+
node_categories = set([ key.split("/")[2 if key.count("/") < 5 else 3] for key in nodes.keys() ])
440+
434441
# Choose the most connected nodes to be colored
435442
top_nodes = {
436443
node_url: i
437-
for i, (node_url, _) in enumerate(
438-
list(sorted(edge_counts.items(), key=lambda k: -k[1]))[: len(PASTEL_COLORS)]
444+
for i, node_url in enumerate(
445+
list(node_categories)[: len(PASTEL_COLORS)]
439446
)
440447
}
441-
448+
442449
# Generate graph data
443450
graph_info = {
444451
"nodes": [
445452
{
446453
"id": node_ids[url],
447454
"label": title,
448455
"url": url,
449-
"color": PASTEL_COLORS[top_nodes[url]] if url in top_nodes else None,
456+
"color": PASTEL_COLORS[top_nodes[url.split("/")[2 if url.count("/") < 5 else 3]]] if url.split("/")[2 if url.count("/") < 5 else 3] in top_nodes else None,
450457
"value": math.log10(edge_counts[url] + 1) + 1,
451458
"opacity": 0.1,
452459
}

zola/sass/bootstrap/scss/_reboot.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ h6 {
129129

130130
p {
131131
margin-top: 0;
132-
margin-bottom: $paragraph-margin-bottom;
132+
// margin-bottom: $paragraph-margin-bottom;
133+
margin-bottom: 0;
133134
}
134135

135136

zola/sass/common/_dark.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,17 @@ body.dark .copy-status:active::after {
331331
display: block;
332332
color: $link-color-dark;
333333
}
334+
335+
336+
body.dark .folder svg {
337+
color: white;
338+
fill: white;
339+
}
340+
341+
body.dark .collapsible-section:after {
342+
content: url("/assets/arrowdown-dark.svg");
343+
}
344+
345+
body.dark .collapsible-section.open:after {
346+
content: url("/assets/arrowup-dark.svg");
347+
}

zola/sass/common/_global.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ h6,
4646
}
4747
}
4848

49+
h1.collapsible-section,
50+
h2.collapsible-section,
51+
h3.collapsible-section,
52+
h4.collapsible-section,
53+
h5.collapsible-section,
54+
h6.collapsible-section,
55+
.h1.collapsible-section,
56+
.h2.collapsible-section,
57+
.h3.collapsible-section,
58+
.h4.collapsible-section,
59+
.h5.collapsible-section,
60+
.h6.collapsible-section {
61+
margin: 0.5em 24px 0.5em 0;
62+
}
63+
64+
4965
.home h1 {
5066
/* font-size: calc(1.375rem + 1.5vw); */
5167
font-size: calc(1.875rem + 1.5vw);
@@ -229,4 +245,11 @@ article {
229245
hr {
230246
margin: 3rem 0;
231247
}
248+
}
249+
250+
.folder {
251+
width: 15px;
252+
height: 15px;
253+
display: inline-block;
254+
margin: 0 0.5em 0.5em 0;
232255
}

zola/sass/custom.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
.collapsible-section{
2+
position: relative;
3+
}
14
.collapsible-section:hover {
25
cursor: pointer;
36
text-decoration: underline;
47
}
58

69
.collapsible-section:after {
7-
content: ""; /* Unicode character for "plus" sign (+) */
10+
content: url("/assets/arrowdown.svg");
811
font-size: 0.8rem;
12+
width: 20px;
13+
height: 20px;
914
float: right;
1015
}
1116

1217
.collapsible-section.open:after {
13-
content: ""; /* Unicode character for "minus" sign (-) */
18+
content: url("/assets/arrowup.svg");
1419
}
1520

1621
.dark .collapsible-section:after,
@@ -23,3 +28,7 @@
2328
overflow: hidden;
2429
transition: height 0.5s ease-out;
2530
}
31+
32+
.collapsible-wrapper {
33+
display: none;
34+
}

zola/sass/graph.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ body.home {
1010
z-index: 1;
1111

1212
div.home-background {
13-
background: rgba(255,255,255,0.85);
13+
background: rgba(255,255,255,0.3);
1414
z-index: 2;
15+
pointer-events: none;
1516
}
1617

1718
#graph {
@@ -32,11 +33,16 @@ body.home {
3233

3334
body.dark {
3435
> div.home div.home-background,footer{
35-
background: rgba($color: #212529, $alpha: 0.85);
36+
background: rgba($color: #212529, $alpha: 0.3);
3637
z-index: 2;
38+
pointer-events: none;
3739
}
3840
}
3941

42+
a {
43+
pointer-events: all;
44+
}
45+
4046
div.docs-graph {
4147
width: 100%;
4248
// height: 30vh;

zola/static/assets/arrowdown-dark.svg

Lines changed: 6 additions & 0 deletions
Loading

zola/static/assets/arrowdown.svg

Lines changed: 6 additions & 0 deletions
Loading

zola/static/assets/arrowup-dark.svg

Lines changed: 6 additions & 0 deletions
Loading

zola/static/assets/arrowup.svg

Lines changed: 6 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)