Procházet zdrojové kódy

fix badge vertical align when shown inline

Thomas Buck před 2 roky
rodič
revize
1a98a0b508
2 změnil soubory, kde provedl 10 přidání a 4 odebrání
  1. 9
    3
      macros.py
  2. 1
    1
      page.html

+ 9
- 3
macros.py Zobrazit soubor

@@ -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 Zobrazit soubor

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

Loading…
Zrušit
Uložit