moosey-cms 0.6.0__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/PKG-INFO +1 -1
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/pyproject.toml +1 -1
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/filters.py +13 -8
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/.gitignore +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/.python-version +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/README.md +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/docs/filters.md +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/assets/example-1.jpeg +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/assets/example-2.jpeg +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/content/about.md +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/content/index.md +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/content/pages/features.md +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/content/posts/building-modern-apps.md +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/content/posts/index.md +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/main.py +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/templates/404.html +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/templates/components/sidebar.html +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/templates/index.html +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/templates/layout/base.html +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/templates/page.html +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/templates/post.html +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/example/templates/posts.html +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/__init__.py +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/cache.py +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/file_watcher.py +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/helpers.py +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/hot_reload_script.py +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/main.py +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/md.py +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/models.py +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/seo.py +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/src/moosey_cms/static/js/reload-script.js +0 -0
- {moosey_cms-0.6.0 → moosey_cms-0.7.0}/uv.lock +0 -0
|
@@ -47,13 +47,15 @@ def iso_date(dt):
|
|
|
47
47
|
return dt.strftime('%Y-%m-%d')
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
def relative_time(dt):
|
|
50
|
+
def relative_time(dt, showAgo=True):
|
|
51
51
|
"""Format date as relative time (e.g., '2 hours ago', 'yesterday')"""
|
|
52
52
|
if not dt:
|
|
53
53
|
return ""
|
|
54
54
|
|
|
55
55
|
now = datetime.now()
|
|
56
56
|
diff = now - dt
|
|
57
|
+
|
|
58
|
+
ago = " ago" if showAgo else ""
|
|
57
59
|
|
|
58
60
|
seconds = diff.total_seconds()
|
|
59
61
|
|
|
@@ -61,10 +63,10 @@ def relative_time(dt):
|
|
|
61
63
|
return "just now"
|
|
62
64
|
elif seconds < 3600:
|
|
63
65
|
minutes = int(seconds / 60)
|
|
64
|
-
return f"{minutes} minute{'s' if minutes != 1 else ''}
|
|
66
|
+
return f"{minutes} minute{'s' if minutes != 1 else ''}{ago}"
|
|
65
67
|
elif seconds < 86400:
|
|
66
68
|
hours = int(seconds / 3600)
|
|
67
|
-
return f"{hours} hour{'s' if hours != 1 else ''}
|
|
69
|
+
return f"{hours} hour{'s' if hours != 1 else ''}{ago}"
|
|
68
70
|
elif seconds < 172800:
|
|
69
71
|
return "yesterday"
|
|
70
72
|
elif seconds < 604800:
|
|
@@ -72,13 +74,13 @@ def relative_time(dt):
|
|
|
72
74
|
return f"{days} days ago"
|
|
73
75
|
elif seconds < 2592000:
|
|
74
76
|
weeks = int(seconds / 604800)
|
|
75
|
-
return f"{weeks} week{'s' if weeks != 1 else ''}
|
|
77
|
+
return f"{weeks} week{'s' if weeks != 1 else ''}{ago}"
|
|
76
78
|
elif seconds < 31536000:
|
|
77
79
|
months = int(seconds / 2592000)
|
|
78
|
-
return f"{months} month{'s' if months != 1 else ''}
|
|
80
|
+
return f"{months} month{'s' if months != 1 else ''}{ago}"
|
|
79
81
|
else:
|
|
80
82
|
years = int(seconds / 31536000)
|
|
81
|
-
return f"{years} year{'s' if years != 1 else ''}
|
|
83
|
+
return f"{years} year{'s' if years != 1 else ''}{ago}"
|
|
82
84
|
|
|
83
85
|
|
|
84
86
|
def time_only(dt):
|
|
@@ -90,7 +92,8 @@ def time_only(dt):
|
|
|
90
92
|
formatted = formatted[1:]
|
|
91
93
|
return formatted
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
def strptime(s, fmt):
|
|
96
|
+
return datetime.strptime(s, fmt)
|
|
94
97
|
# ============================================================================
|
|
95
98
|
# CURRENCY FILTERS
|
|
96
99
|
# ============================================================================
|
|
@@ -529,6 +532,7 @@ def register_filters(jinja_env):
|
|
|
529
532
|
'short_date': short_date,
|
|
530
533
|
'iso_date': iso_date,
|
|
531
534
|
'relative_time': relative_time,
|
|
535
|
+
'strptime': strptime,
|
|
532
536
|
'time_only': time_only,
|
|
533
537
|
'currency': currency,
|
|
534
538
|
'compact_currency': compact_currency,
|
|
@@ -550,7 +554,8 @@ def register_filters(jinja_env):
|
|
|
550
554
|
'yesno': yesno,
|
|
551
555
|
'read_time':read_time,
|
|
552
556
|
'strip_comments': strip_comments,
|
|
553
|
-
'minify_html': minify_html
|
|
557
|
+
'minify_html': minify_html,
|
|
558
|
+
|
|
554
559
|
}
|
|
555
560
|
|
|
556
561
|
for name, func in filters_dict.items():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|