File tree Expand file tree Collapse file tree 3 files changed +44
-1
lines changed
mkdocs_git_revision_date_localized_plugin Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -87,3 +87,21 @@ When writing your own [custom themes](https://www.mkdocs.org/user-guide/custom-t
87
87
Last update: {{ page.meta.git_revision_date_localized }}
88
88
{% endif %}
89
89
```
90
+
91
+ As a developer you might want access to more raw date formats that also do not have the ` <span> ` elements. You can also use:
92
+
93
+ - ` page.meta.git_revision_date_localized `
94
+ - ` page.meta.git_revision_date_localized_raw_date `
95
+ - ` page.meta.git_revision_date_localized_raw_datetime `
96
+ - ` page.meta.git_revision_date_localized_raw_iso_date `
97
+ - ` page.meta.git_revision_date_localized_raw_iso_datetime `
98
+ - ` page.meta.git_revision_date_localized_raw_timeago `
99
+
100
+ And if you've enable creation date in the config:
101
+
102
+ - ` page.meta.git_creation_date_localized `
103
+ - ` page.meta.git_creation_date_localized_raw_date `
104
+ - ` page.meta.git_creation_date_localized_raw_datetime `
105
+ - ` page.meta.git_creation_date_localized_raw_iso_date `
106
+ - ` page.meta.git_creation_date_localized_raw_iso_datetime `
107
+ - ` page.meta.git_creation_date_localized_raw_timeago `
Original file line number Diff line number Diff line change @@ -204,6 +204,31 @@ def on_page_markdown(
204
204
flags = re .IGNORECASE ,
205
205
)
206
206
207
+ # Developers might want access to the raw date strings
208
+ # Let's expose them also
209
+ revision_dates = self .util ._date_formats (
210
+ unix_timestamp = self .util .get_git_commit_timestamp (
211
+ path = page .file .abs_src_path ,
212
+ is_first_commit = False ,
213
+ ),
214
+ time_zone = self .config .get ("time_zone" ),
215
+ locale = self .config .get ("locale" )
216
+ )
217
+ for date_type , date_string in revision_dates .items ():
218
+ page .meta ["git_revision_date_localized_raw_%s" % date_type ] = date_string
219
+
220
+ if self .config .get ("enable_creation_date" ):
221
+ creation_dates = self .util ._date_formats (
222
+ unix_timestamp = self .util .get_git_commit_timestamp (
223
+ path = page .file .abs_src_path ,
224
+ is_first_commit = False ,
225
+ ),
226
+ time_zone = self .config .get ("time_zone" ),
227
+ locale = self .config .get ("locale" )
228
+ )
229
+ for date_type , date_string in creation_dates .items ():
230
+ page .meta ["git_creation_date_localized_raw_%s" % date_type ] = date_string
231
+
207
232
return markdown
208
233
209
234
def on_post_build (self , config : Dict [str , Any ], ** kwargs ) -> None :
Original file line number Diff line number Diff line change 12
12
13
13
setup (
14
14
name = "mkdocs-git-revision-date-localized-plugin" ,
15
- version = "0.10.0 " ,
15
+ version = "0.10.1 " ,
16
16
description = "Mkdocs plugin that enables displaying the localized date of the last git modification of a markdown file." ,
17
17
long_description = LONG_DESCRIPTION ,
18
18
long_description_content_type = "text/markdown" ,
You can’t perform that action at this time.
0 commit comments