|
@@ -265,6 +265,11 @@ def printProjectsMenu():
|
265
|
265
|
|
266
|
266
|
# print subpages for these top-level items
|
267
|
267
|
subpages = [sub for sub in enpages if sub.get("parent", "none") == p.get("child-id", "unknown")]
|
|
268
|
+ order = p.get("sort-order", "date")
|
|
269
|
+ if order == "position":
|
|
270
|
+ subpages.sort(key=lambda p: p["position"])
|
|
271
|
+ else:
|
|
272
|
+ subpages.sort(key=lambda p: p["date"], reverse = True)
|
268
|
273
|
if len(subpages) > 0:
|
269
|
274
|
print("<ul>")
|
270
|
275
|
for sp in subpages:
|
|
@@ -285,7 +290,11 @@ def printProjectsMenu():
|
285
|
290
|
|
286
|
291
|
# print subpages for these top-level items
|
287
|
292
|
subpages = [sub for sub in enpages if sub.get("parent", "none") == p.get("child-id", "unknown")]
|
288
|
|
- subpages.sort(key=lambda p: [p.get("date", "9999-01-01")], reverse = True)
|
|
293
|
+ order = p.get("sort-order", "date")
|
|
294
|
+ if order == "position":
|
|
295
|
+ subpages.sort(key=lambda p: p["position"])
|
|
296
|
+ else:
|
|
297
|
+ subpages.sort(key=lambda p: p["date"], reverse = True)
|
289
|
298
|
if len(subpages) > 0:
|
290
|
299
|
print("<ul>")
|
291
|
300
|
for sp in subpages:
|
|
@@ -294,7 +303,7 @@ def printProjectsMenu():
|
294
|
303
|
|
295
|
304
|
print("</ul>")
|
296
|
305
|
|
297
|
|
-def printMenu(mpages = None, sortKey = None, sortReverse = True):
|
|
306
|
+def printMenuGeneric(mpages = None, sortKey = None, sortReverse = True):
|
298
|
307
|
if mpages == None:
|
299
|
308
|
mpages = [p for p in pages if p.get("parent", "__none__") == page["child-id"] and p.lang == "en"]
|
300
|
309
|
if sortKey != None:
|
|
@@ -308,10 +317,17 @@ def printMenu(mpages = None, sortKey = None, sortReverse = True):
|
308
|
317
|
|
309
|
318
|
def printMenuDate(mpages = None, sortReverse = True):
|
310
|
319
|
sortKey = lambda p: p["date"]
|
311
|
|
- printMenu(mpages, sortKey, sortReverse)
|
|
320
|
+ printMenuGeneric(mpages, sortKey, sortReverse)
|
312
|
321
|
|
313
|
322
|
def printMenuPositional(mpages = None):
|
314
|
|
- printMenu(mpages, lambda p: int(p["position"]), False)
|
|
323
|
+ printMenuGeneric(mpages, lambda p: int(p["position"]), False)
|
|
324
|
+
|
|
325
|
+def printMenu(mpages = None):
|
|
326
|
+ order = page.get("sort-order", "date")
|
|
327
|
+ if order == "position":
|
|
328
|
+ printMenuPositional(mpages)
|
|
329
|
+ else:
|
|
330
|
+ printMenuDate(mpages)
|
315
|
331
|
|
316
|
332
|
def printRobotMenuEnglish():
|
317
|
333
|
mpages = [p for p in pages if p.get("parent", "") == "xyrobot" and p.lang == "en"]
|