mirror of
https://github.com/ShayManor/github-readme-stats.git
synced 2026-12-02 11:53:48 +05:30
feat(api): add endpoint for retrieving growth data for the dashboard
This commit is contained in:
@@ -15,7 +15,7 @@ _ATTRIBUTION_H_RE = re.compile(r'\bdata-gh-h="(\d+)"')
|
||||
def _extract_inner(svg: str, widget_key: str) -> tuple[str, int]:
|
||||
"""Extract the inner content from a widget SVG and rewrite IDs to be unique.
|
||||
|
||||
Also strips any per-widget "Generated with gh-stats" attribution text
|
||||
Also strips any per-widget "Generated with gh-stats.com" attribution text
|
||||
(marked with data-gh-attribution="1") and shrinks the reported height
|
||||
by data-gh-h so the composite doesn't reserve empty space for the
|
||||
removed footer. The composite has its own attribution at the bottom
|
||||
@@ -127,5 +127,5 @@ def compose_widget(
|
||||
{embedded}
|
||||
<text x="{total_w // 2}" y="{total_h - 8}" text-anchor="middle"
|
||||
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
|
||||
font-size="9" fill="{t["text_secondary"]}" opacity="0.5">Generated with gh-stats</text>
|
||||
font-size="9" fill="{t["text_secondary"]}" opacity="0.5">Generated with gh-stats.com</text>
|
||||
</svg>'''
|
||||
|
||||
@@ -128,7 +128,7 @@ def render_grade_widget(data: GradeData, theme_name: str = "dark", settings: dic
|
||||
stats_y = 100
|
||||
tags_y = stats_y + 54
|
||||
tag_padding = 18 if tags_h > 24 else 14
|
||||
# Reserve space at the bottom for the "Generated with gh-stats"
|
||||
# Reserve space at the bottom for the "Generated with gh-stats.com"
|
||||
# attribution. Matches the composite widget's footer convention so
|
||||
# the standalone grade widget feels visually consistent when it's
|
||||
# embedded on its own (the /api/<u>/grade.svg path).
|
||||
@@ -182,6 +182,6 @@ def render_grade_widget(data: GradeData, theme_name: str = "dark", settings: dic
|
||||
<text data-gh-attribution="1" data-gh-h="{footer_h}"
|
||||
x="190" y="{card_h - 8}" text-anchor="middle"
|
||||
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
|
||||
font-size="9" fill="{t["text_secondary"]}" opacity="0.5">Generated with gh-stats</text>'''
|
||||
font-size="9" fill="{t["text_secondary"]}" opacity="0.5">Generated with gh-stats.com</text>'''
|
||||
|
||||
return card_wrapper(inner, 380, card_h, t, "")
|
||||
|
||||
@@ -109,5 +109,5 @@ def render_languages_widget(languages: list[LanguageData], theme_name: str = "da
|
||||
<text data-gh-attribution="1" data-gh-h="{footer_h}"
|
||||
x="190" y="{card_h - 36 - 8}" text-anchor="middle"
|
||||
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
|
||||
font-size="9" fill="{t["text_secondary"]}" opacity="0.5">Generated with gh-stats</text>'''
|
||||
font-size="9" fill="{t["text_secondary"]}" opacity="0.5">Generated with gh-stats.com</text>'''
|
||||
return card_wrapper(inner, 380, card_h, t, "Languages")
|
||||
|
||||
Reference in New Issue
Block a user