|
@@ -165,7 +165,7 @@ def githubCommitBadge(p, showInline = False):
|
165
|
165
|
ret += ".svg?logo=git&style=flat\" /></a>"
|
166
|
166
|
return ret
|
167
|
167
|
|
168
|
|
-def printMenuItem(p, yearsAsHeading = False, showDateSpan = False, showOnlyStartDate = False, nicelyFormatFullDate = False, lastyear = "0", lang = "", showLastCommit = True, hide_description = False, updates_as_heading = False):
|
|
168
|
+def printMenuItem(p, yearsAsHeading = False, showDateSpan = False, showOnlyStartDate = False, nicelyFormatFullDate = False, lastyear = "0", lang = "", showLastCommit = True, hide_description = False, updates_as_heading = False, desc_has_collapse = False):
|
169
|
169
|
title = p.title
|
170
|
170
|
if lang != "":
|
171
|
171
|
if p.get("title_" + lang, "") != "":
|
|
@@ -202,9 +202,11 @@ def printMenuItem(p, yearsAsHeading = False, showDateSpan = False, showOnlyStart
|
202
|
202
|
if p.get("description", "") != "":
|
203
|
203
|
description = p.get("description", "")
|
204
|
204
|
if lang != "":
|
205
|
|
- if p.get("description_" + lang, "") != "":
|
206
|
|
- description = p.get("description_" + lang, "")
|
207
|
|
- print("<br><span class=\"listdesc\">" + description + "</span>")
|
|
205
|
+ description = p.get("description_" + lang, description)
|
|
206
|
+ if desc_has_collapse:
|
|
207
|
+ print("<br><span class=\"listdesc collapse_menu\">" + description + "</span>")
|
|
208
|
+ else:
|
|
209
|
+ print("<br><span class=\"listdesc\">" + description + "</span>")
|
208
|
210
|
|
209
|
211
|
if showLastCommit:
|
210
|
212
|
link = githubCommitBadge(p)
|
|
@@ -251,6 +253,7 @@ def printProjectsMenu():
|
251
|
253
|
# prints all pages with parent 'projects' or 'stuff'.
|
252
|
254
|
# first the ones without date, sorted by position.
|
253
|
255
|
# this first section includes sub-headings for children
|
|
256
|
+ # in a hidden div, expanding when clicking the description.
|
254
|
257
|
# then afterwards those with date, split by year.
|
255
|
258
|
# also supports blog posts with parent.
|
256
|
259
|
enpages = [p for p in pages if p.lang == "en"]
|
|
@@ -266,20 +269,24 @@ def printProjectsMenu():
|
266
|
269
|
|
267
|
270
|
# print all pages
|
268
|
271
|
for p in mpages:
|
269
|
|
- printMenuItem(p)
|
270
|
|
-
|
271
|
|
- # print subpages for these top-level items
|
|
272
|
+ # fetch subpages for these top-level items
|
272
|
273
|
subpages = [sub for sub in enpages if sub.get("parent", "none") == p.get("child-id", "unknown")]
|
273
|
274
|
order = p.get("sort-order", "date")
|
274
|
275
|
if order == "position":
|
275
|
276
|
subpages.sort(key=lambda p: p["position"])
|
276
|
277
|
else:
|
277
|
278
|
subpages.sort(key=lambda p: p["date"], reverse = True)
|
|
279
|
+
|
|
280
|
+ printMenuItem(p, False, False, False, False, "0", "", True, False, False, len(subpages) > 0)
|
|
281
|
+
|
|
282
|
+ # print subpages
|
278
|
283
|
if len(subpages) > 0:
|
|
284
|
+ print("<div class='collapsecontent_menu'>")
|
279
|
285
|
print("<ul>")
|
280
|
286
|
for sp in subpages:
|
281
|
287
|
printMenuItem(sp, False, True, True, False, "0", "", False, True)
|
282
|
288
|
print("</ul>")
|
|
289
|
+ print("</div>")
|
283
|
290
|
|
284
|
291
|
# slect pages with a date
|
285
|
292
|
dpages = [p for p in enpages if p.get("date", "") != ""]
|
|
@@ -291,20 +298,24 @@ def printProjectsMenu():
|
291
|
298
|
# print all pages
|
292
|
299
|
lastyear = "0"
|
293
|
300
|
for p in mpages:
|
294
|
|
- lastyear = printMenuItem(p, True, True, False, False, lastyear)
|
295
|
|
-
|
296
|
|
- # print subpages for these top-level items
|
|
301
|
+ # fetch subpages for these top-level items
|
297
|
302
|
subpages = [sub for sub in enpages if sub.get("parent", "none") == p.get("child-id", "unknown")]
|
298
|
303
|
order = p.get("sort-order", "date")
|
299
|
304
|
if order == "position":
|
300
|
305
|
subpages.sort(key=lambda p: p["position"])
|
301
|
306
|
else:
|
302
|
307
|
subpages.sort(key=lambda p: p["date"], reverse = True)
|
|
308
|
+
|
|
309
|
+ lastyear = printMenuItem(p, True, True, False, False, lastyear, "", True, False, False, len(subpages) > 0)
|
|
310
|
+
|
|
311
|
+ # print subpages
|
303
|
312
|
if len(subpages) > 0:
|
|
313
|
+ print("<div class='collapsecontent_menu'>")
|
304
|
314
|
print("<ul>")
|
305
|
315
|
for sp in subpages:
|
306
|
316
|
printMenuItem(sp, False, True, True, False, "0", "", False, True)
|
307
|
317
|
print("</ul>")
|
|
318
|
+ print("</div>")
|
308
|
319
|
|
309
|
320
|
print("</ul>")
|
310
|
321
|
|