|
@@ -76,7 +76,15 @@ def tableHelper(style, header, content):
|
76
|
76
|
# menu helper macro
|
77
|
77
|
# -----------------------------------------------------------------------------
|
78
|
78
|
|
79
|
|
-def printMenuItem(p, yearsAsHeading = False, showDateSpan = False, showOnlyStartDate = False, nicelyFormatFullDate = False, lastyear = "0", lang = ""):
|
|
79
|
+def githubCommitBadge(p):
|
|
80
|
+ if p.get("github", "") != "":
|
|
81
|
+ link = p.get("git", p.github)
|
|
82
|
+ linkParts = p.github.split("/")
|
|
83
|
+ if len(linkParts) >= 5:
|
|
84
|
+ return "<a href=\"" + link + "\"><img src=\"https://img.shields.io/github/last-commit/" + linkParts[3] + "/" + linkParts[4] + ".svg?logo=git&style=flat\" /></a>"
|
|
85
|
+ return ""
|
|
86
|
+
|
|
87
|
+def printMenuItem(p, yearsAsHeading = False, showDateSpan = False, showOnlyStartDate = False, nicelyFormatFullDate = False, lastyear = "0", lang = "", showLastCommit = True):
|
80
|
88
|
title = p.title
|
81
|
89
|
if lang != "":
|
82
|
90
|
if p.get("title_" + lang, "") != "":
|
|
@@ -112,13 +120,18 @@ def printMenuItem(p, yearsAsHeading = False, showDateSpan = False, showOnlyStart
|
112
|
120
|
description = p.get("description_" + lang, "")
|
113
|
121
|
print "<br><span class=\"listdesc\">" + description + "</span>"
|
114
|
122
|
|
|
123
|
+ if showLastCommit:
|
|
124
|
+ link = githubCommitBadge(p)
|
|
125
|
+ if len(link) > 0:
|
|
126
|
+ print "<br>" + link
|
|
127
|
+
|
115
|
128
|
return lastyear
|
116
|
129
|
|
117
|
130
|
def printRecentMenu(count = 5):
|
118
|
131
|
posts = [p for p in pages if "date" in p]
|
119
|
132
|
posts.sort(key=lambda p: p.get("update", p.get("date")), reverse=True)
|
120
|
133
|
for p in posts[0:count]:
|
121
|
|
- printMenuItem(p, False, False, False, True)
|
|
134
|
+ printMenuItem(p, False, False, False, True, "0", "", False)
|
122
|
135
|
|
123
|
136
|
def printBlogMenu():
|
124
|
137
|
posts = [p for p in pages if "post" in p]
|