Bläddra i källkod

add shields.io recent commit badge to sites with github repo

Thomas Buck 2 år sedan
förälder
incheckning
1a93a4ebbb

+ 1
- 1
input/blog/2019/2019_06_20_rfid.md Visa fil

@@ -3,7 +3,7 @@ post: Arduino RFID door lock
3 3
 description: Simple solenoid lock with serial RFID reader
4 4
 date: 2019-06-20
5 5
 comments: true
6
-github: https://git.xythobuz.de/thomas/RFID-Door
6
+git: https://git.xythobuz.de/thomas/RFID-Door
7 7
 parent: projects
8 8
 ---
9 9
 

+ 2
- 1
input/projects/3d-printing/bed-leveling-util.md Visa fil

@@ -3,7 +3,8 @@ description: Python wxWidgets Marlin Mesh Bed Leveling helper
3 3
 parent: 3d-printing
4 4
 position: 60
5 5
 comments: true
6
-github: https://git.xythobuz.de/thomas/Bed-Leveling-Utility
6
+git: https://git.xythobuz.de/thomas/Bed-Leveling-Utility
7
+github: https://github.com/xythobuz/Bed-Leveling-Utility
7 8
 date: 2016-06-07
8 9
 update: 2016-06-12
9 10
 ---

+ 2
- 1
input/projects/3d-printing/octotray.md Visa fil

@@ -3,7 +3,8 @@ description: Linux PyQt tray application to control OctoPrint
3 3
 parent: 3d-printing
4 4
 position: 50
5 5
 comments: true
6
-github: https://git.xythobuz.de/thomas/OctoTray
6
+git: https://git.xythobuz.de/thomas/OctoTray
7
+github: https://github.com/xythobuz/OctoTray
7 8
 date: 2021-05-08
8 9
 update: 2021-05-13
9 10
 ---

+ 2
- 1
input/projects/giessomat.md Visa fil

@@ -2,7 +2,8 @@ title: Gieß-o-mat
2 2
 description: DIY fertilizer mixer and plant watering machine
3 3
 parent: projects
4 4
 position: 6
5
-github: https://git.xythobuz.de/thomas/giess-o-mat
5
+git: https://git.xythobuz.de/thomas/giess-o-mat
6
+github: https://github.com/xythobuz/giess-o-mat
6 7
 date: 2021-03-29
7 8
 update: 2022-03-25
8 9
 ---

+ 2
- 1
input/projects/openraider.md Visa fil

@@ -1,7 +1,8 @@
1 1
 title: OpenRaider
2 2
 description: Classic Tomb Raider game engine re-implementation
3 3
 parent: projects
4
-github: https://git.xythobuz.de/thomas/OpenRaider
4
+git: https://git.xythobuz.de/thomas/OpenRaider
5
+github: https://github.com/xythobuz/OpenRaider
5 6
 date: 2013-12-15
6 7
 update: 2015-08-13
7 8
 ---

+ 15
- 2
macros.py Visa fil

@@ -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]

+ 12
- 1
page.html Visa fil

@@ -22,11 +22,18 @@ else:
22 22
 </head>
23 23
 <body onload="sh_highlightDocument('/js/sh/', '.min.js');">
24 24
     <!--%
25
+        link = ""
26
+
25 27
         if page.get("github", "") != "":
28
+            link = page.github
29
+        if page.get("git", "") != "":
30
+            link = page.git
31
+
32
+        if link != "":
26 33
             # GitHub Fork-Me Ribbon
27 34
             print '<div class="github-fork-ribbon-wrapper right-bottom">'
28 35
             print '<div class="github-fork-ribbon"><a href="'
29
-            print page.github
36
+            print link
30 37
             print '">Fork this with Git</a></div></div>'
31 38
     %-->
32 39
     <div id="wrap"><div id="nav">
@@ -97,6 +104,10 @@ else:
97 104
                     else:
98 105
                         date = datetime.strptime(page["update"], "%Y-%m-%d").strftime("%B %d, %Y")
99 106
                         print "<i>Last updated on %s.</i>" % date
107
+
108
+            link = githubCommitBadge(page)
109
+            if len(link) > 0:
110
+                print "<p>Recent activity on GitHub: " + link + "</p>"
100 111
         %-->
101 112
         {{ __content__ }}
102 113
         <hr>

Laddar…
Avbryt
Spara