mkdocs-document-dates 2.3.1__tar.gz → 2.3.3__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.
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/PKG-INFO +14 -12
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/README.md +11 -10
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/__init__.py +1 -1
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/plugin.py +16 -4
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates.egg-info/PKG-INFO +14 -12
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/setup.py +1 -1
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/LICENSE +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/hooks/pre-commit +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/hooks_installer.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/__init__.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/ar.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/de.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/en.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/es.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/fr.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/ja.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/ko.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/ru.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/zh.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/zh_tw.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/styles.py +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates.egg-info/requires.txt +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
- {mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: mkdocs-document-dates
|
3
|
-
Version: 2.3.
|
3
|
+
Version: 2.3.3
|
4
4
|
Summary: A MkDocs plugin for displaying accurate document creation and last modification dates.
|
5
5
|
Home-page: https://github.com/jaywhj/mkdocs-document-dates
|
6
6
|
Author: Aaron Wang
|
@@ -16,6 +16,7 @@ Dynamic: classifier
|
|
16
16
|
Dynamic: description
|
17
17
|
Dynamic: description-content-type
|
18
18
|
Dynamic: home-page
|
19
|
+
Dynamic: license-file
|
19
20
|
Dynamic: requires-dist
|
20
21
|
Dynamic: requires-python
|
21
22
|
Dynamic: summary
|
@@ -86,7 +87,8 @@ modified: 2025-02-23
|
|
86
87
|
# Document Title
|
87
88
|
```
|
88
89
|
|
89
|
-
|
90
|
+
- `created` can be replaced by any of the following fields: `created, date, creation_date, created_at, date_created`
|
91
|
+
- `modified` can be replaced by any of the following fields: `modified, updated, last_modified, updated_at, date_modified, last_update`
|
90
92
|
|
91
93
|
## Configuration Options
|
92
94
|
|
@@ -107,18 +109,18 @@ modified: 2025-02-23
|
|
107
109
|
|
108
110
|
## Notes
|
109
111
|
|
110
|
-
- It still works when using CI/CD build systems (e.g. Github Actions)
|
111
|
-
|
112
|
-
- You can configure it like this in your .github/workflows/ci.yml:
|
113
|
-
|
112
|
+
- It still works when using CI/CD build systems (e.g. Github Actions), used a cache file `.dates_cache.json` to solve this problem:
|
113
|
+
1. First, you can configure the workflow like this (penultimate line) in your .github/workflows/ci.yml:
|
114
114
|
```
|
115
115
|
...
|
116
116
|
|
117
|
-
|
118
|
-
|
117
|
+
- run: pip install mkdocs-document-dates
|
118
|
+
- run: mkdocs gh-deploy --force
|
119
119
|
```
|
120
|
-
|
121
|
-
|
120
|
+
2. Then update your Markdown document in MkDocs as normal
|
121
|
+
3. After running git add and git commit, you will see the auto-generated cache file .dates_cache.json (hidden by default) in the `docs` folder under MkDocs
|
122
|
+
- Make sure you have installed python3 ahead of time and set environment variables
|
123
|
+
4. Finally, run git push, and you can see that there are also .dates_cache.json files in the docs directory in the GitHub repository, which means success
|
122
124
|
- Priority of time reads:
|
123
|
-
|
125
|
+
- `Front Matter` > `Cache file` > `Filesystem timestamp`
|
124
126
|
- If you are using MkDocs on a Linux system, the modification time is used as the creation time because of system limitations. If you need the exact creation time, you can specify it manually in Front Matter
|
@@ -64,7 +64,8 @@ modified: 2025-02-23
|
|
64
64
|
# Document Title
|
65
65
|
```
|
66
66
|
|
67
|
-
|
67
|
+
- `created` can be replaced by any of the following fields: `created, date, creation_date, created_at, date_created`
|
68
|
+
- `modified` can be replaced by any of the following fields: `modified, updated, last_modified, updated_at, date_modified, last_update`
|
68
69
|
|
69
70
|
## Configuration Options
|
70
71
|
|
@@ -85,18 +86,18 @@ modified: 2025-02-23
|
|
85
86
|
|
86
87
|
## Notes
|
87
88
|
|
88
|
-
- It still works when using CI/CD build systems (e.g. Github Actions)
|
89
|
-
|
90
|
-
- You can configure it like this in your .github/workflows/ci.yml:
|
91
|
-
|
89
|
+
- It still works when using CI/CD build systems (e.g. Github Actions), used a cache file `.dates_cache.json` to solve this problem:
|
90
|
+
1. First, you can configure the workflow like this (penultimate line) in your .github/workflows/ci.yml:
|
92
91
|
```
|
93
92
|
...
|
94
93
|
|
95
|
-
|
96
|
-
|
94
|
+
- run: pip install mkdocs-document-dates
|
95
|
+
- run: mkdocs gh-deploy --force
|
97
96
|
```
|
98
|
-
|
99
|
-
|
97
|
+
2. Then update your Markdown document in MkDocs as normal
|
98
|
+
3. After running git add and git commit, you will see the auto-generated cache file .dates_cache.json (hidden by default) in the `docs` folder under MkDocs
|
99
|
+
- Make sure you have installed python3 ahead of time and set environment variables
|
100
|
+
4. Finally, run git push, and you can see that there are also .dates_cache.json files in the docs directory in the GitHub repository, which means success
|
100
101
|
- Priority of time reads:
|
101
|
-
|
102
|
+
- `Front Matter` > `Cache file` > `Filesystem timestamp`
|
102
103
|
- If you are using MkDocs on a Linux system, the modification time is used as the creation time because of system limitations. If you need the exact creation time, you can specify it manually in Front Matter
|
@@ -16,6 +16,8 @@ class DocumentDatesPlugin(BasePlugin):
|
|
16
16
|
('time_format', config_options.Type(str, default='%H:%M:%S')),
|
17
17
|
('position', config_options.Type(str, default='bottom')),
|
18
18
|
('exclude', config_options.Type(list, default=[])),
|
19
|
+
('created_field_names', config_options.Type(list, default=['created', 'date', 'creation_date', 'created_at', 'date_created'])),
|
20
|
+
('modified_field_names', config_options.Type(list, default=['modified', 'updated', 'last_modified', 'updated_at', 'date_modified', 'last_update'])),
|
19
21
|
)
|
20
22
|
|
21
23
|
def __init__(self):
|
@@ -51,9 +53,9 @@ class DocumentDatesPlugin(BasePlugin):
|
|
51
53
|
return (
|
52
54
|
f"<div class='document-dates-plugin-wrapper'>"
|
53
55
|
f"<div class='document-dates-plugin'>"
|
54
|
-
f"<span title='{t['created_time']}'><span class='material-icons'>add_circle</span>"
|
56
|
+
f"<span title='{t['created_time']}: {created.strftime(self.config['date_format'])}'><span class='material-icons'>add_circle</span>"
|
55
57
|
f"{self._get_formatted_date(created)}</span>"
|
56
|
-
f"<span title='{t['modified_time']}'><span class='material-icons'>update</span>"
|
58
|
+
f"<span title='{t['modified_time']}: {modified.strftime(self.config['date_format'])}'><span class='material-icons'>update</span>"
|
57
59
|
f"{self._get_formatted_date(modified)}</span>"
|
58
60
|
f"</div>"
|
59
61
|
f"</div>"
|
@@ -122,9 +124,19 @@ class DocumentDatesPlugin(BasePlugin):
|
|
122
124
|
except ValueError:
|
123
125
|
return False
|
124
126
|
|
127
|
+
def _find_meta_date(self, meta: dict, field_names: list, default_date: datetime) -> datetime:
|
128
|
+
"""从meta中查找第一个匹配的日期字段"""
|
129
|
+
for field in field_names:
|
130
|
+
if field in meta:
|
131
|
+
result = self._parse_meta_date(meta[field], default_date)
|
132
|
+
if result != default_date: # 找到有效日期
|
133
|
+
return result
|
134
|
+
return default_date
|
135
|
+
|
125
136
|
def _process_meta_dates(self, meta: dict, created: datetime, modified: datetime) -> tuple[datetime, datetime]:
|
126
|
-
|
127
|
-
|
137
|
+
"""处理meta中的日期字段,支持多种字段名"""
|
138
|
+
result_created = self._find_meta_date(meta, self.config['created_field_names'], created)
|
139
|
+
result_modified = self._find_meta_date(meta, self.config['modified_field_names'], modified)
|
128
140
|
return result_created, result_modified
|
129
141
|
|
130
142
|
def _parse_meta_date(self, date_str: str | None, default_date: datetime) -> datetime:
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: mkdocs-document-dates
|
3
|
-
Version: 2.3.
|
3
|
+
Version: 2.3.3
|
4
4
|
Summary: A MkDocs plugin for displaying accurate document creation and last modification dates.
|
5
5
|
Home-page: https://github.com/jaywhj/mkdocs-document-dates
|
6
6
|
Author: Aaron Wang
|
@@ -16,6 +16,7 @@ Dynamic: classifier
|
|
16
16
|
Dynamic: description
|
17
17
|
Dynamic: description-content-type
|
18
18
|
Dynamic: home-page
|
19
|
+
Dynamic: license-file
|
19
20
|
Dynamic: requires-dist
|
20
21
|
Dynamic: requires-python
|
21
22
|
Dynamic: summary
|
@@ -86,7 +87,8 @@ modified: 2025-02-23
|
|
86
87
|
# Document Title
|
87
88
|
```
|
88
89
|
|
89
|
-
|
90
|
+
- `created` can be replaced by any of the following fields: `created, date, creation_date, created_at, date_created`
|
91
|
+
- `modified` can be replaced by any of the following fields: `modified, updated, last_modified, updated_at, date_modified, last_update`
|
90
92
|
|
91
93
|
## Configuration Options
|
92
94
|
|
@@ -107,18 +109,18 @@ modified: 2025-02-23
|
|
107
109
|
|
108
110
|
## Notes
|
109
111
|
|
110
|
-
- It still works when using CI/CD build systems (e.g. Github Actions)
|
111
|
-
|
112
|
-
- You can configure it like this in your .github/workflows/ci.yml:
|
113
|
-
|
112
|
+
- It still works when using CI/CD build systems (e.g. Github Actions), used a cache file `.dates_cache.json` to solve this problem:
|
113
|
+
1. First, you can configure the workflow like this (penultimate line) in your .github/workflows/ci.yml:
|
114
114
|
```
|
115
115
|
...
|
116
116
|
|
117
|
-
|
118
|
-
|
117
|
+
- run: pip install mkdocs-document-dates
|
118
|
+
- run: mkdocs gh-deploy --force
|
119
119
|
```
|
120
|
-
|
121
|
-
|
120
|
+
2. Then update your Markdown document in MkDocs as normal
|
121
|
+
3. After running git add and git commit, you will see the auto-generated cache file .dates_cache.json (hidden by default) in the `docs` folder under MkDocs
|
122
|
+
- Make sure you have installed python3 ahead of time and set environment variables
|
123
|
+
4. Finally, run git push, and you can see that there are also .dates_cache.json files in the docs directory in the GitHub repository, which means success
|
122
124
|
- Priority of time reads:
|
123
|
-
|
125
|
+
- `Front Matter` > `Cache file` > `Filesystem timestamp`
|
124
126
|
- If you are using MkDocs on a Linux system, the modification time is used as the creation time because of system limitations. If you need the exact creation time, you can specify it manually in Front Matter
|
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/hooks/pre-commit
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/hooks_installer.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/__init__.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/ar.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/de.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/en.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/es.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/fr.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/ja.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/ko.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/ru.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/zh.py
RENAMED
File without changes
|
{mkdocs_document_dates-2.3.1 → mkdocs_document_dates-2.3.3}/mkdocs_document_dates/lang/zh_tw.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|