ソースを参照

fix badge vertical align when shown inline

Thomas Buck 2年前
コミット
1a98a0b508
2個のファイルの変更10行の追加4行の削除
  1. 9
    3
      macros.py
  2. 1
    1
      page.html

+ 9
- 3
macros.py ファイルの表示

@@ -76,13 +76,19 @@ def tableHelper(style, header, content):
76 76
 # menu helper macro
77 77
 # -----------------------------------------------------------------------------
78 78
 
79
-def githubCommitBadge(p):
79
+def githubCommitBadge(p, showInline = False):
80
+    ret = ""
80 81
     if p.get("github", "") != "":
81 82
         link = p.get("git", p.github)
82 83
         linkParts = p.github.split("/")
83 84
         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 ""
85
+            ret += "<a href=\"" + link + "\"><img "
86
+            if showInline:
87
+                ret += "style =\"vertical-align: top;\" "
88
+            ret += "src=\"https://img.shields.io/github/last-commit/"
89
+            ret += linkParts[3] + "/" + linkParts[4]
90
+            ret += ".svg?logo=git&style=flat\" /></a>"
91
+    return ret
86 92
 
87 93
 def printMenuItem(p, yearsAsHeading = False, showDateSpan = False, showOnlyStartDate = False, nicelyFormatFullDate = False, lastyear = "0", lang = "", showLastCommit = True):
88 94
     title = p.title

+ 1
- 1
page.html ファイルの表示

@@ -105,7 +105,7 @@ else:
105 105
                         date = datetime.strptime(page["update"], "%Y-%m-%d").strftime("%B %d, %Y")
106 106
                         print "<i>Last updated on %s.</i>" % date
107 107
 
108
-            link = githubCommitBadge(page)
108
+            link = githubCommitBadge(page, True)
109 109
             if len(link) > 0:
110 110
                 print "<p>Recent activity on GitHub: " + link + "</p>"
111 111
         %-->

読み込み中…
キャンセル
保存