Cybrkyd's Git Repositories

GitGen - commit: 1624bed

commit 1624bed525e4aef0ea91139cab55f99b2586611f3badab76a2dec8304bc33c84
author cybrkyd <noreply@cybrkyd.com> 2026-02-10 11:14:18 +0000
committer cybrkyd <noreply@cybrkyd.com> 2026-02-10 11:14:18 +0000

Commit Message

Footer generated-on timestamp

- Declared one global timestamp for all pages
- Added <p>Generated on {self.time_str}</p> to all footers on all pages

📊 Diffstat

gitgen.py 30
1 files changed, 18 insertions(+), 12 deletions(-)

Diff

diff --git a/gitgen.py b/gitgen.py
index 8f40fc8..c0b2b06 100644
--- a/gitgen.py
+++ b/gitgen.py
@@ -271,11 +271,13 @@ class HTMLGenerator:
self.output_dir = Path(output_dir)
self.output_dir.mkdir(exist_ok=True)
+ # Generate timestamp once for all pages
+ self.current_time = datetime.datetime.now()
+ self.footer_time = datetime.datetime.now(datetime.timezone.utc)
+ self.time_str = self.footer_time.strftime('%Y-%m-%d %H:%M:%S %z')
+
def generate_index(self, repos: List[Dict]) -> str:
"""Generate main index page"""
- current_time = datetime.datetime.now()
- footer_time = datetime.datetime.now(datetime.timezone.utc)
- time_str = footer_time.strftime('%Y-%m-%d %H:%M:%S %z')
html_fragments = [
f"""<!DOCTYPE html>
@@ -342,7 +344,7 @@ class HTMLGenerator:
try:
# Parse just the %Y-%m-%d portion
commit_date = datetime.datetime.strptime(last_commit_date, "%Y-%m-%d")
- age_days = (current_time - commit_date).days
+ age_days = (self.current_time - commit_date).days
if age_days <= 31:
date_style = ' style="color: #00cd00; font-weight: bold;"'
except (ValueError, TypeError):
@@ -358,14 +360,14 @@ class HTMLGenerator:
""")
html_fragments.append(f"""
- </tbody>
- </table>
- </div>
-
- <div class="footer">
- <p>Made with <a href="https://git.cybrkyd.com/GitGen" target="&#95;blank" rel="noopener">GitGen</a> by Cybrkyd</p>
- <p>Generated on {time_str}</p>
- </div>
+ </tbody>
+ </table>
+ </div>
+
+ <div class="footer">
+ <p>Made with <a href="https://git.cybrkyd.com/GitGen" target="&#95;blank" rel="noopener">GitGen</a> by Cybrkyd</p>
+ <p>Generated on {self.time_str}</p>
+ </div>
</body>
</html>""")
@@ -442,6 +444,7 @@ class HTMLGenerator:
<div class="footer">
<p>Made with <a href="https://git.cybrkyd.com/GitGen" target="&#95;blank" rel="noopener">GitGen</a> by Cybrkyd</p>
+ <p>Generated on {self.time_str}</p>
</div>
</body>
</html>"""
@@ -540,6 +543,7 @@ class HTMLGenerator:
<div class="footer">
<p>Made with <a href="https://git.cybrkyd.com/GitGen" target="&#95;blank" rel="noopener">GitGen</a> by Cybrkyd</p>
+ <p>Generated on {self.time_str}</p>
</div>
</body>
</html>""")
@@ -660,6 +664,7 @@ class HTMLGenerator:
<div class="footer">
<p>Made with <a href="https://git.cybrkyd.com/GitGen" target="&#95;blank" rel="noopener">GitGen</a> by Cybrkyd</p>
+ <p>Generated on {self.time_str}</p>
</div>
</body>
</html>""")
@@ -860,6 +865,7 @@ class HTMLGenerator:
<div class="footer">
<p>Made with <a href="https://git.cybrkyd.com/GitGen" target="&#95;blank" rel="noopener">GitGen</a> by Cybrkyd</p>
+ <p>Generated on {self.time_str}</p>
</div>
</body>
</html>"""