mkdocs-document-dates 3.4.9__tar.gz → 3.5__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-3.4.9/mkdocs_document_dates.egg-info → mkdocs_document_dates-3.5}/PKG-INFO +17 -15
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/README.md +16 -14
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/plugin.py +72 -65
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/config/user.config.css +4 -2
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/config/user.config.js +3 -3
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/core/core.css +3 -3
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/core/core.js +1 -1
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/core/default.config.js +12 -12
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/templates/recently_updated.html +4 -4
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/utils.py +33 -34
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5/mkdocs_document_dates.egg-info}/PKG-INFO +17 -15
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/setup.py +1 -1
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/LICENSE +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/MANIFEST.in +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/__init__.py +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/cache_manager.py +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/hooks/pre-commit +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/hooks_installer.py +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/core/timeago.full.min.js +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/core/timeago.min.js +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/core/utils.js +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/fonts/material-icons.css +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/fonts/materialicons.woff2 +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/tippy/backdrop.css +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/tippy/light.css +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/tippy/material.css +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/tippy/popper.min.js +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/tippy/scale.css +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/tippy/shift-away.css +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/tippy/tippy.css +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/tippy/tippy.umd.min.js +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates.egg-info/requires.txt +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/pyproject.toml +0 -0
- {mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/setup.cfg +0 -0
{mkdocs_document_dates-3.4.9/mkdocs_document_dates.egg-info → mkdocs_document_dates-3.5}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mkdocs-document-dates
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.5
|
|
4
4
|
Summary: A new generation MkDocs plugin for displaying exact creation time, last update time, authors, email of documents
|
|
5
5
|
Home-page: https://github.com/jaywhj/mkdocs-document-dates
|
|
6
6
|
Author: Aaron Wang
|
|
@@ -30,16 +30,16 @@ English | [简体中文](README_zh.md)
|
|
|
30
30
|
|
|
31
31
|
<br />
|
|
32
32
|
|
|
33
|
-
A new generation MkDocs plugin for displaying exact **creation
|
|
33
|
+
A new generation MkDocs plugin for displaying exact **creation date, last updated date, authors, email** of documents
|
|
34
34
|
|
|
35
35
|

|
|
36
36
|
|
|
37
37
|
## Features
|
|
38
38
|
|
|
39
|
-
- [x] Always displays **exact** meta information of the document and works in any environment (no
|
|
40
|
-
- [x] Support list display of recently updated documents (in descending order of update
|
|
41
|
-
- [x] Support for manually specifying
|
|
42
|
-
- [x] Support for multiple
|
|
39
|
+
- [x] Always displays **exact** meta information of the document and works in any environment (no-Git, Git environments, Docker, all CI/CD build systems, etc.)
|
|
40
|
+
- [x] Support list display of recently updated documents (in descending order of update date)
|
|
41
|
+
- [x] Support for manually specifying date and author in `Front Matter`
|
|
42
|
+
- [x] Support for multiple date formats (date, datetime, timeago)
|
|
43
43
|
- [x] Support for multiple author modes (avatar, text, hidden)
|
|
44
44
|
- [x] Support for manually configuring author's name, link, avatar, email, etc.
|
|
45
45
|
- [x] Flexible display position (top or bottom)
|
|
@@ -51,7 +51,7 @@ A new generation MkDocs plugin for displaying exact **creation time, last update
|
|
|
51
51
|
|
|
52
52
|
| Build Speed Comparison: | 100 md: | 1000 md: | Time Complexity: |
|
|
53
53
|
| --------------------------- | :-----: | :------: | :----------: |
|
|
54
|
-
| git-revision-date-localized |
|
|
54
|
+
| git-revision-date-localized<br />git-authors | > 3 s | > 30 s | O(n) |
|
|
55
55
|
| document-dates | < 0.1 s | < 0.15 s | O(1) |
|
|
56
56
|
|
|
57
57
|
## Installation
|
|
@@ -74,28 +74,30 @@ Or, full configuration:
|
|
|
74
74
|
```yaml
|
|
75
75
|
plugins:
|
|
76
76
|
- document-dates:
|
|
77
|
-
position: top # Display position: top(after title) bottom(end of document)
|
|
77
|
+
position: top # Display position: top(after title) bottom(end of document), default: top
|
|
78
78
|
type: date # Date type: date datetime timeago, default: date
|
|
79
79
|
exclude: # List of excluded files
|
|
80
80
|
- temp.md # Example: exclude the specified file
|
|
81
81
|
- blog/* # Example: exclude all files in blog folder, including subfolders
|
|
82
82
|
date_format: '%Y-%m-%d' # Date format strings (e.g., %Y-%m-%d, %b %d, %Y)
|
|
83
83
|
time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
|
|
84
|
-
|
|
84
|
+
show_created: true # Show creation date: true false, default: true
|
|
85
|
+
show_updated: true # Show last updated date: true false, default: true
|
|
86
|
+
show_author: true # Show author: true(avatar) text(text) false(hidden), default: true
|
|
85
87
|
```
|
|
86
88
|
|
|
87
89
|
## Customization Settings
|
|
88
90
|
|
|
89
91
|
In addition to the above basic configuration, the plug-in also provides a wealth of customization options to meet a variety of individual needs:
|
|
90
92
|
|
|
91
|
-
- [Specify Datetime](https://jaywhj.netlify.app/document-dates-en#Specify-Datetime):
|
|
92
|
-
- [Specify Author](https://jaywhj.netlify.app/document-dates-en#Specify-Author):
|
|
93
|
-
- [Specify Avatar](https://jaywhj.netlify.app/document-dates-en#Specify-Avatar): You can manually specify the avatar for each author
|
|
94
|
-
- [Set Plugin Style](https://jaywhj.netlify.app/document-dates-en#Set-Plugin-Style):
|
|
93
|
+
- [Specify Datetime](https://jaywhj.netlify.app/document-dates-en#Specify-Datetime): Introduces the mechanism for obtaining document dates and methods for personalized customization, you can manually specify the creation date and last updated date for each document
|
|
94
|
+
- [Specify Author](https://jaywhj.netlify.app/document-dates-en#Specify-Author): Introduces the mechanism for obtaining document authors and methods for personalized customization, you can manually specify the author information for each document, such as name, link, avatar, email, etc.
|
|
95
|
+
- [Specify Avatar](https://jaywhj.netlify.app/document-dates-en#Specify-Avatar): You can manually specify the avatar for each author, support local file path and URL path
|
|
96
|
+
- [Set Plugin Style](https://jaywhj.netlify.app/document-dates-en#Set-Plugin-Style): You can quickly set the plugin styles through preset entrances, such as icons, themes, colors, fonts, animations, dividing line and so on
|
|
95
97
|
- [Add Localization Language](https://jaywhj.netlify.app/document-dates-en#Add-Localization-Language): More localization languages for `timeago` and `tooltip`
|
|
96
98
|
- [Use Template Variables](https://jaywhj.netlify.app/document-dates-en#Use-Template-Variables): Can be used to optimize `sitemap.xml` for site SEO, can be used to re-customize plug-ins, etc.
|
|
97
|
-
- [Add Recently Updated Module](https://jaywhj.netlify.app/document-dates-en#Add-Recently-Updated-Module): Enable list of recently updated documents (in descending order of update
|
|
98
|
-
- [Other Tips](https://jaywhj.netlify.app/document-dates-en#Other-Tips):
|
|
99
|
+
- [Add Recently Updated Module](https://jaywhj.netlify.app/document-dates-en#Add-Recently-Updated-Module): Enable list of recently updated documents (in descending order of update date), this is ideal for sites with a large number of documents, so that readers can quickly see what's new
|
|
100
|
+
- [Other Tips](https://jaywhj.netlify.app/document-dates-en#Other-Tips): Introducing the Do's of using plugin in Docker
|
|
99
101
|
- [Development Stories](https://jaywhj.netlify.app/document-dates-en#Development-Stories): Describes the origin of the plug-in, the difficulties and solutions encountered in development, and the principles and directions of product design
|
|
100
102
|
|
|
101
103
|
See the documentation for details: https://jaywhj.netlify.app/document-dates-en
|
|
@@ -4,16 +4,16 @@ English | [简体中文](README_zh.md)
|
|
|
4
4
|
|
|
5
5
|
<br />
|
|
6
6
|
|
|
7
|
-
A new generation MkDocs plugin for displaying exact **creation
|
|
7
|
+
A new generation MkDocs plugin for displaying exact **creation date, last updated date, authors, email** of documents
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
|
-
- [x] Always displays **exact** meta information of the document and works in any environment (no
|
|
14
|
-
- [x] Support list display of recently updated documents (in descending order of update
|
|
15
|
-
- [x] Support for manually specifying
|
|
16
|
-
- [x] Support for multiple
|
|
13
|
+
- [x] Always displays **exact** meta information of the document and works in any environment (no-Git, Git environments, Docker, all CI/CD build systems, etc.)
|
|
14
|
+
- [x] Support list display of recently updated documents (in descending order of update date)
|
|
15
|
+
- [x] Support for manually specifying date and author in `Front Matter`
|
|
16
|
+
- [x] Support for multiple date formats (date, datetime, timeago)
|
|
17
17
|
- [x] Support for multiple author modes (avatar, text, hidden)
|
|
18
18
|
- [x] Support for manually configuring author's name, link, avatar, email, etc.
|
|
19
19
|
- [x] Flexible display position (top or bottom)
|
|
@@ -25,7 +25,7 @@ A new generation MkDocs plugin for displaying exact **creation time, last update
|
|
|
25
25
|
|
|
26
26
|
| Build Speed Comparison: | 100 md: | 1000 md: | Time Complexity: |
|
|
27
27
|
| --------------------------- | :-----: | :------: | :----------: |
|
|
28
|
-
| git-revision-date-localized |
|
|
28
|
+
| git-revision-date-localized<br />git-authors | > 3 s | > 30 s | O(n) |
|
|
29
29
|
| document-dates | < 0.1 s | < 0.15 s | O(1) |
|
|
30
30
|
|
|
31
31
|
## Installation
|
|
@@ -48,28 +48,30 @@ Or, full configuration:
|
|
|
48
48
|
```yaml
|
|
49
49
|
plugins:
|
|
50
50
|
- document-dates:
|
|
51
|
-
position: top # Display position: top(after title) bottom(end of document)
|
|
51
|
+
position: top # Display position: top(after title) bottom(end of document), default: top
|
|
52
52
|
type: date # Date type: date datetime timeago, default: date
|
|
53
53
|
exclude: # List of excluded files
|
|
54
54
|
- temp.md # Example: exclude the specified file
|
|
55
55
|
- blog/* # Example: exclude all files in blog folder, including subfolders
|
|
56
56
|
date_format: '%Y-%m-%d' # Date format strings (e.g., %Y-%m-%d, %b %d, %Y)
|
|
57
57
|
time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
|
|
58
|
-
|
|
58
|
+
show_created: true # Show creation date: true false, default: true
|
|
59
|
+
show_updated: true # Show last updated date: true false, default: true
|
|
60
|
+
show_author: true # Show author: true(avatar) text(text) false(hidden), default: true
|
|
59
61
|
```
|
|
60
62
|
|
|
61
63
|
## Customization Settings
|
|
62
64
|
|
|
63
65
|
In addition to the above basic configuration, the plug-in also provides a wealth of customization options to meet a variety of individual needs:
|
|
64
66
|
|
|
65
|
-
- [Specify Datetime](https://jaywhj.netlify.app/document-dates-en#Specify-Datetime):
|
|
66
|
-
- [Specify Author](https://jaywhj.netlify.app/document-dates-en#Specify-Author):
|
|
67
|
-
- [Specify Avatar](https://jaywhj.netlify.app/document-dates-en#Specify-Avatar): You can manually specify the avatar for each author
|
|
68
|
-
- [Set Plugin Style](https://jaywhj.netlify.app/document-dates-en#Set-Plugin-Style):
|
|
67
|
+
- [Specify Datetime](https://jaywhj.netlify.app/document-dates-en#Specify-Datetime): Introduces the mechanism for obtaining document dates and methods for personalized customization, you can manually specify the creation date and last updated date for each document
|
|
68
|
+
- [Specify Author](https://jaywhj.netlify.app/document-dates-en#Specify-Author): Introduces the mechanism for obtaining document authors and methods for personalized customization, you can manually specify the author information for each document, such as name, link, avatar, email, etc.
|
|
69
|
+
- [Specify Avatar](https://jaywhj.netlify.app/document-dates-en#Specify-Avatar): You can manually specify the avatar for each author, support local file path and URL path
|
|
70
|
+
- [Set Plugin Style](https://jaywhj.netlify.app/document-dates-en#Set-Plugin-Style): You can quickly set the plugin styles through preset entrances, such as icons, themes, colors, fonts, animations, dividing line and so on
|
|
69
71
|
- [Add Localization Language](https://jaywhj.netlify.app/document-dates-en#Add-Localization-Language): More localization languages for `timeago` and `tooltip`
|
|
70
72
|
- [Use Template Variables](https://jaywhj.netlify.app/document-dates-en#Use-Template-Variables): Can be used to optimize `sitemap.xml` for site SEO, can be used to re-customize plug-ins, etc.
|
|
71
|
-
- [Add Recently Updated Module](https://jaywhj.netlify.app/document-dates-en#Add-Recently-Updated-Module): Enable list of recently updated documents (in descending order of update
|
|
72
|
-
- [Other Tips](https://jaywhj.netlify.app/document-dates-en#Other-Tips):
|
|
73
|
+
- [Add Recently Updated Module](https://jaywhj.netlify.app/document-dates-en#Add-Recently-Updated-Module): Enable list of recently updated documents (in descending order of update date), this is ideal for sites with a large number of documents, so that readers can quickly see what's new
|
|
74
|
+
- [Other Tips](https://jaywhj.netlify.app/document-dates-en#Other-Tips): Introducing the Do's of using plugin in Docker
|
|
73
75
|
- [Development Stories](https://jaywhj.netlify.app/document-dates-en#Development-Stories): Describes the origin of the plug-in, the difficulties and solutions encountered in development, and the principles and directions of product design
|
|
74
76
|
|
|
75
77
|
See the documentation for details: https://jaywhj.netlify.app/document-dates-en
|
|
@@ -10,7 +10,7 @@ from mkdocs.config import config_options
|
|
|
10
10
|
from mkdocs.structure.pages import Page
|
|
11
11
|
from mkdocs.utils import get_relative_url
|
|
12
12
|
from urllib.parse import urlparse
|
|
13
|
-
from .utils import get_file_creation_time,
|
|
13
|
+
from .utils import get_file_creation_time, load_git_metadata, load_git_last_updated_date, read_jsonl_cache,is_excluded, get_recently_updated_files
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger("mkdocs.plugins.document_dates")
|
|
16
16
|
logger.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, CRITICAL
|
|
@@ -34,7 +34,9 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
34
34
|
('position', config_options.Type(str, default='top')),
|
|
35
35
|
('exclude', config_options.Type(list, default=[])),
|
|
36
36
|
('created_field_names', config_options.Type(list, default=['created', 'date'])),
|
|
37
|
-
('
|
|
37
|
+
('updated_field_names', config_options.Type(list, default=['updated', 'modified'])),
|
|
38
|
+
('show_created', config_options.Type(bool, default=True)),
|
|
39
|
+
('show_updated', config_options.Type(bool, default=True)),
|
|
38
40
|
('show_author', config_options.Choice((True, False, 'text'), default=True)),
|
|
39
41
|
('recently-updated', config_options.Type((dict, bool), default={}))
|
|
40
42
|
)
|
|
@@ -52,21 +54,20 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
52
54
|
docs_dir_path = Path(config['docs_dir'])
|
|
53
55
|
|
|
54
56
|
# 加载 author 配置
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# 覆盖 jsonl 文件缓存
|
|
57
|
+
self._extract_github_username(config.get('repo_url'))
|
|
58
|
+
authors_file = docs_dir_path / 'authors.yml'
|
|
59
|
+
if not authors_file.exists():
|
|
60
|
+
try:
|
|
61
|
+
blog_config = config['plugins']['material/blog'].config
|
|
62
|
+
authors_file_resolved = blog_config.authors_file.format(blog=blog_config.blog_dir)
|
|
63
|
+
authors_file = docs_dir_path / authors_file_resolved
|
|
64
|
+
except Exception:
|
|
65
|
+
pass
|
|
66
|
+
self._load_authors_from_yaml(authors_file)
|
|
67
|
+
|
|
68
|
+
# 加载文档元数据
|
|
69
|
+
self.dates_cache = load_git_metadata(docs_dir_path)
|
|
70
|
+
# 覆盖 jsonl 缓存
|
|
70
71
|
jsonl_cache_file = docs_dir_path / '.dates_cache.jsonl'
|
|
71
72
|
if jsonl_cache_file.exists():
|
|
72
73
|
jsonl_cache = read_jsonl_cache(jsonl_cache_file)
|
|
@@ -74,6 +75,10 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
74
75
|
if filename in self.dates_cache:
|
|
75
76
|
self.dates_cache[filename].update(new_info)
|
|
76
77
|
|
|
78
|
+
# 加载文档最近更新时间
|
|
79
|
+
self.last_updated_dates = load_git_last_updated_date(docs_dir_path)
|
|
80
|
+
|
|
81
|
+
|
|
77
82
|
# 复制配置文件到用户目录(如果不存在)
|
|
78
83
|
dest_dir = docs_dir_path / 'assets' / 'document_dates'
|
|
79
84
|
dest_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -136,35 +141,6 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
136
141
|
|
|
137
142
|
return config
|
|
138
143
|
|
|
139
|
-
def on_nav(self, nav, config, files):
|
|
140
|
-
recently_updated_config = self.config.get('recently-updated')
|
|
141
|
-
if recently_updated_config:
|
|
142
|
-
self.recent_enable = True
|
|
143
|
-
|
|
144
|
-
# 兼容 true 配置
|
|
145
|
-
if recently_updated_config is True:
|
|
146
|
-
recently_updated_config = {}
|
|
147
|
-
|
|
148
|
-
# 获取配置
|
|
149
|
-
exclude_list = recently_updated_config.get('exclude', [])
|
|
150
|
-
limit = recently_updated_config.get('limit', 10)
|
|
151
|
-
template_path = recently_updated_config.get('template')
|
|
152
|
-
|
|
153
|
-
# 获取最近更新日期和最近更新的文档数据
|
|
154
|
-
docs_dir = Path(config['docs_dir'])
|
|
155
|
-
self.last_updated_dates, recently_updated_docs = get_recently_updated_files(docs_dir, files, exclude_list, limit, self.recent_enable)
|
|
156
|
-
|
|
157
|
-
# 将数据注入到 config['extra'] 中供全局访问
|
|
158
|
-
if 'extra' not in config:
|
|
159
|
-
config['extra'] = {}
|
|
160
|
-
config['extra']['recently_updated_docs'] = recently_updated_docs
|
|
161
|
-
|
|
162
|
-
# 渲染HTML
|
|
163
|
-
if self.recent_enable:
|
|
164
|
-
self.recent_docs_html = self._render_recently_updated_html(docs_dir, template_path, recently_updated_docs)
|
|
165
|
-
|
|
166
|
-
return nav
|
|
167
|
-
|
|
168
144
|
def on_page_markdown(self, markdown, page: Page, config, files):
|
|
169
145
|
# 获取相对路径,src_uri 总是以"/"分隔
|
|
170
146
|
rel_path = getattr(page.file, 'src_uri', page.file.src_path)
|
|
@@ -174,11 +150,11 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
174
150
|
|
|
175
151
|
# 获取时间信息
|
|
176
152
|
created = self._find_meta_date(page.meta, self.config['created_field_names'])
|
|
177
|
-
|
|
153
|
+
updated = self._find_meta_date(page.meta, self.config['updated_field_names'])
|
|
178
154
|
if not created:
|
|
179
155
|
created = self._get_file_creation_time(file_path, rel_path)
|
|
180
|
-
if not
|
|
181
|
-
|
|
156
|
+
if not updated:
|
|
157
|
+
updated = self._get_file_modification_time(file_path, rel_path)
|
|
182
158
|
|
|
183
159
|
# 获取作者信息
|
|
184
160
|
authors = self._get_author_info(rel_path, page, config)
|
|
@@ -189,23 +165,54 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
189
165
|
|
|
190
166
|
# 在排除前暴露 meta 信息给前端使用
|
|
191
167
|
page.meta['document_dates_created'] = created.isoformat()
|
|
192
|
-
page.meta['
|
|
168
|
+
page.meta['document_dates_updated'] = updated.isoformat()
|
|
193
169
|
page.meta['document_dates_authors'] = authors
|
|
194
170
|
|
|
195
|
-
# 占位符替换
|
|
196
|
-
if self.recent_enable and '\n<!-- RECENTLY_UPDATED_DOCS -->' in markdown:
|
|
197
|
-
markdown = markdown.replace('\n<!-- RECENTLY_UPDATED_DOCS -->', self.recent_docs_html or '')
|
|
198
|
-
|
|
199
171
|
# 检查是否需要排除
|
|
200
172
|
if is_excluded(rel_path, self.config['exclude']):
|
|
201
173
|
return markdown
|
|
202
174
|
|
|
203
175
|
# 生成日期和作者信息 HTML
|
|
204
|
-
info_html = self._generate_html_info(created,
|
|
176
|
+
info_html = self._generate_html_info(created, updated, authors)
|
|
205
177
|
|
|
206
178
|
# 将信息写入 markdown
|
|
207
179
|
return self._insert_date_info(markdown, info_html)
|
|
208
180
|
|
|
181
|
+
def on_env(self, env, config, files):
|
|
182
|
+
recently_updated_config = self.config.get('recently-updated')
|
|
183
|
+
if recently_updated_config:
|
|
184
|
+
self.recent_enable = True
|
|
185
|
+
|
|
186
|
+
# 兼容 true 配置
|
|
187
|
+
if recently_updated_config is True:
|
|
188
|
+
recently_updated_config = {}
|
|
189
|
+
|
|
190
|
+
# 获取配置
|
|
191
|
+
exclude_list = recently_updated_config.get('exclude', [])
|
|
192
|
+
limit = recently_updated_config.get('limit', 10)
|
|
193
|
+
template_path = recently_updated_config.get('template')
|
|
194
|
+
|
|
195
|
+
# 获取最近更新的文档数据
|
|
196
|
+
recently_updated_docs = get_recently_updated_files(self.last_updated_dates, files, exclude_list, limit, self.recent_enable)
|
|
197
|
+
|
|
198
|
+
# 将数据注入到 config['extra'] 中供全局访问
|
|
199
|
+
if 'extra' not in config:
|
|
200
|
+
config['extra'] = {}
|
|
201
|
+
config['extra']['recently_updated_docs'] = recently_updated_docs
|
|
202
|
+
|
|
203
|
+
# 渲染HTML
|
|
204
|
+
if self.recent_enable:
|
|
205
|
+
docs_dir = Path(config['docs_dir'])
|
|
206
|
+
self.recent_docs_html = self._render_recently_updated_html(docs_dir, template_path, recently_updated_docs)
|
|
207
|
+
|
|
208
|
+
return env
|
|
209
|
+
|
|
210
|
+
def on_post_page(self, output, page, config):
|
|
211
|
+
if self.recent_enable and '\n<!-- RECENTLY_UPDATED_DOCS -->' in output:
|
|
212
|
+
output = output.replace('\n<!-- RECENTLY_UPDATED_DOCS -->', self.recent_docs_html or '')
|
|
213
|
+
|
|
214
|
+
return output
|
|
215
|
+
|
|
209
216
|
def on_post_build(self, config):
|
|
210
217
|
site_dest_dir = Path(config['site_dir']) / 'assets' / 'document_dates'
|
|
211
218
|
for dir_name in ['tippy', 'core', 'fonts']:
|
|
@@ -258,8 +265,8 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
258
265
|
|
|
259
266
|
# 加载模板
|
|
260
267
|
env = Environment(
|
|
261
|
-
loader=FileSystemLoader(str(template_dir)),
|
|
262
|
-
autoescape=select_autoescape(["html", "xml"])
|
|
268
|
+
loader = FileSystemLoader(str(template_dir)),
|
|
269
|
+
autoescape = select_autoescape(["html", "xml"])
|
|
263
270
|
)
|
|
264
271
|
template = env.get_template(template_file)
|
|
265
272
|
|
|
@@ -295,9 +302,6 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
295
302
|
|
|
296
303
|
|
|
297
304
|
def _get_author_info(self, rel_path, page, config):
|
|
298
|
-
if not self.config['show_author']:
|
|
299
|
-
return None
|
|
300
|
-
|
|
301
305
|
# 1. meta author
|
|
302
306
|
authors = self._process_meta_author(page.meta, page.url)
|
|
303
307
|
if authors:
|
|
@@ -374,7 +378,7 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
374
378
|
return date.strftime(f"{self.config['date_format']} {self.config['time_format']}")
|
|
375
379
|
return date.strftime(self.config['date_format'])
|
|
376
380
|
|
|
377
|
-
def _generate_html_info(self, created: datetime,
|
|
381
|
+
def _generate_html_info(self, created: datetime, updated: datetime, authors=None):
|
|
378
382
|
try:
|
|
379
383
|
# 构建基本的日期信息 HTML
|
|
380
384
|
html_parts = []
|
|
@@ -391,8 +395,10 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
391
395
|
f"{self._get_formatted_date(time_obj)}</time></span>"
|
|
392
396
|
)
|
|
393
397
|
|
|
394
|
-
|
|
395
|
-
|
|
398
|
+
if self.config['show_created']:
|
|
399
|
+
html_parts.append(build_time_icon(created, 'doc_created'))
|
|
400
|
+
if self.config['show_updated']:
|
|
401
|
+
html_parts.append(build_time_icon(updated, 'doc_updated'))
|
|
396
402
|
|
|
397
403
|
# 添加作者信息
|
|
398
404
|
if self.config['show_author'] and authors:
|
|
@@ -406,12 +412,13 @@ class DocumentDatesPlugin(BasePlugin):
|
|
|
406
412
|
if self.config['show_author'] == 'text':
|
|
407
413
|
# 显示文本模式
|
|
408
414
|
tooltip_text = ', '.join(get_author_tooltip(author) for author in authors)
|
|
409
|
-
author_text = ', '.join(author.name for author in authors)
|
|
415
|
+
# author_text = ', '.join(author.name for author in authors)
|
|
410
416
|
icon = 'doc_author' if len(authors) == 1 else 'doc_authors'
|
|
411
417
|
html_parts.append(
|
|
412
418
|
f"<span data-tippy-content data-tippy-raw='{tooltip_text}'>"
|
|
413
419
|
f"<span class='material-icons' data-icon='{icon}'></span>"
|
|
414
|
-
f"{
|
|
420
|
+
f"{tooltip_text}"
|
|
421
|
+
# f"{author_text}"
|
|
415
422
|
f"</span>"
|
|
416
423
|
)
|
|
417
424
|
else:
|
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
Google Fonts Icons (2500+): https://fonts.google.com/icons
|
|
15
15
|
|
|
16
16
|
doc_created: add_circle, add_circle, note_add, more_time
|
|
17
|
-
|
|
17
|
+
doc_updated: update, check_circle, task, refresh
|
|
18
18
|
doc_author: person, account_circle
|
|
19
19
|
doc_authors: group, groups */
|
|
20
|
+
|
|
20
21
|
/*
|
|
21
22
|
.document-dates-plugin .material-icons[data-icon="doc_created"]::before {
|
|
22
23
|
content: "more_time";
|
|
23
24
|
}
|
|
24
|
-
.document-dates-plugin .material-icons[data-icon="
|
|
25
|
+
.document-dates-plugin .material-icons[data-icon="doc_updated"]::before {
|
|
25
26
|
content: "refresh";
|
|
26
27
|
}
|
|
27
28
|
.document-dates-plugin .material-icons[data-icon="doc_author"]::before {
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
/* 2. Plug-in wrapper styles
|
|
37
38
|
including divider line, margin, padding, and the hiding of this plugin, etc
|
|
38
39
|
*/
|
|
40
|
+
|
|
39
41
|
/* Remove the divider line: */
|
|
40
42
|
/*
|
|
41
43
|
.document-dates-plugin-wrapper.document-dates-top,
|
|
@@ -70,7 +70,7 @@ Part 3:
|
|
|
70
70
|
// Way 1: User-defined one language
|
|
71
71
|
TooltipLanguage.register('en', {
|
|
72
72
|
created_time: "Custom Created",
|
|
73
|
-
|
|
73
|
+
updated_time: "Custom Last Update",
|
|
74
74
|
author: "Custom Author",
|
|
75
75
|
authors: "Custom Authors"
|
|
76
76
|
});
|
|
@@ -79,13 +79,13 @@ TooltipLanguage.register('en', {
|
|
|
79
79
|
const userLanguages = {
|
|
80
80
|
en: {
|
|
81
81
|
created_time: "Created",
|
|
82
|
-
|
|
82
|
+
updated_time: "Last Update",
|
|
83
83
|
author: "Author",
|
|
84
84
|
authors: "Authors"
|
|
85
85
|
},
|
|
86
86
|
zh: {
|
|
87
87
|
created_time: "创建时间",
|
|
88
|
-
|
|
88
|
+
updated_time: "最后更新",
|
|
89
89
|
author: "作者",
|
|
90
90
|
authors: "作者"
|
|
91
91
|
}
|
{mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/core/core.css
RENAMED
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
Google Fonts Icons (2500+): https://fonts.google.com/icons
|
|
36
36
|
|
|
37
37
|
doc_created: add_circle, add_circle, note_add, more_time
|
|
38
|
-
|
|
38
|
+
doc_updated: update, check_circle, task, refresh
|
|
39
39
|
doc_author: person, account_circle
|
|
40
40
|
doc_authors: group, groups */
|
|
41
41
|
.document-dates-plugin .material-icons[data-icon="doc_created"]::before {
|
|
42
42
|
content: "more_time";
|
|
43
43
|
}
|
|
44
|
-
.document-dates-plugin .material-icons[data-icon="
|
|
44
|
+
.document-dates-plugin .material-icons[data-icon="doc_updated"]::before {
|
|
45
45
|
content: "refresh";
|
|
46
46
|
}
|
|
47
47
|
.document-dates-plugin .material-icons[data-icon="doc_author"]::before {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
.document-dates-plugin-wrapper.document-dates-top,
|
|
60
60
|
.document-dates-plugin-wrapper.document-dates-bottom {
|
|
61
61
|
margin: 1rem 0;
|
|
62
|
-
border-bottom: 1px solid rgba(142, 142, 142, 0.
|
|
62
|
+
border-bottom: 1px solid rgba(142, 142, 142, 0.1);
|
|
63
63
|
}
|
|
64
64
|
.md-main .document-dates-plugin-wrapper.document-dates-top {
|
|
65
65
|
margin: -1rem 0 1rem 0;
|
|
@@ -86,73 +86,73 @@ window.TooltipLanguage = (function () {
|
|
|
86
86
|
const defaultLanguages = {
|
|
87
87
|
ar: {
|
|
88
88
|
created_time: "تاريخ الإنشاء",
|
|
89
|
-
|
|
89
|
+
updated_time: "تاريخ التعديل",
|
|
90
90
|
author: "المؤلف",
|
|
91
91
|
authors: "المؤلفون"
|
|
92
92
|
},
|
|
93
93
|
de: {
|
|
94
94
|
created_time: "Erstellungszeit",
|
|
95
|
-
|
|
95
|
+
updated_time: "Änderungszeit",
|
|
96
96
|
author: "Autor",
|
|
97
97
|
authors: "Autoren"
|
|
98
98
|
},
|
|
99
99
|
en: {
|
|
100
100
|
created_time: "Created",
|
|
101
|
-
|
|
101
|
+
updated_time: "Last Update",
|
|
102
102
|
author: "Author",
|
|
103
103
|
authors: "Authors"
|
|
104
104
|
},
|
|
105
105
|
es: {
|
|
106
106
|
created_time: "Fecha de creación",
|
|
107
|
-
|
|
107
|
+
updated_time: "Fecha de modificación",
|
|
108
108
|
author: "Autor",
|
|
109
109
|
authors: "Autores"
|
|
110
110
|
},
|
|
111
111
|
fr: {
|
|
112
112
|
created_time: "Date de création",
|
|
113
|
-
|
|
113
|
+
updated_time: "Date de modification",
|
|
114
114
|
author: "Auteur",
|
|
115
115
|
authors: "Auteurs"
|
|
116
116
|
},
|
|
117
117
|
ja: {
|
|
118
118
|
created_time: "作成日時",
|
|
119
|
-
|
|
119
|
+
updated_time: "更新日時",
|
|
120
120
|
author: "著者",
|
|
121
121
|
authors: "著者"
|
|
122
122
|
},
|
|
123
123
|
ko: {
|
|
124
124
|
created_time: "작성일",
|
|
125
|
-
|
|
125
|
+
updated_time: "수정일",
|
|
126
126
|
author: "작성자",
|
|
127
127
|
authors: "작성자"
|
|
128
128
|
},
|
|
129
129
|
nl: {
|
|
130
130
|
created_time: "Gecreëerd",
|
|
131
|
-
|
|
131
|
+
updated_time: "Laatst geüpdatet",
|
|
132
132
|
author: "Auteur",
|
|
133
133
|
authors: "Auteurs"
|
|
134
134
|
},
|
|
135
135
|
pt: {
|
|
136
136
|
created_time: "Criado em",
|
|
137
|
-
|
|
137
|
+
updated_time: "Última atualização",
|
|
138
138
|
author: "Autor",
|
|
139
139
|
authors: "Autores"
|
|
140
140
|
},
|
|
141
141
|
ru: {
|
|
142
142
|
created_time: "Дата создания",
|
|
143
|
-
|
|
143
|
+
updated_time: "Дата изменения",
|
|
144
144
|
author: "Автор",
|
|
145
145
|
authors: "Авторы"
|
|
146
146
|
},
|
|
147
147
|
zh: {
|
|
148
148
|
created_time: "创建时间",
|
|
149
|
-
|
|
149
|
+
updated_time: "最后更新",
|
|
150
150
|
author: "作者",
|
|
151
151
|
authors: "作者"
|
|
152
152
|
},
|
|
153
153
|
zh_TW: {
|
|
154
154
|
created_time: "建立時間",
|
|
155
|
-
|
|
155
|
+
updated_time: "修改時間",
|
|
156
156
|
author: "作者",
|
|
157
157
|
authors: "作者"
|
|
158
158
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
margin: 0;
|
|
7
7
|
padding: 16px;
|
|
8
8
|
border: 1px solid rgba(142, 142, 142, 0.15);
|
|
9
|
-
border-radius:
|
|
9
|
+
border-radius: 8px;
|
|
10
10
|
font-family: system-ui, sans-serif;
|
|
11
11
|
}
|
|
12
12
|
.recently-updated-item {
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
align-items: center;
|
|
15
15
|
}
|
|
16
16
|
.recently-updated-item span {
|
|
17
|
-
font-size: 0.
|
|
17
|
+
font-size: 0.84em;
|
|
18
18
|
color: rgba(142, 142, 142, 0.5);
|
|
19
|
-
margin-right:
|
|
19
|
+
margin-right: 4px;
|
|
20
20
|
flex-shrink: 0;
|
|
21
|
-
width:
|
|
21
|
+
width: 90px;
|
|
22
22
|
}
|
|
23
23
|
.recently-updated-item a {
|
|
24
24
|
overflow: hidden;
|
|
@@ -25,6 +25,23 @@ def is_excluded(path, exclude_list):
|
|
|
25
25
|
return True
|
|
26
26
|
return False
|
|
27
27
|
|
|
28
|
+
def get_file_creation_time(file_path):
|
|
29
|
+
try:
|
|
30
|
+
stat = os.stat(file_path)
|
|
31
|
+
system = platform.system().lower()
|
|
32
|
+
if system.startswith('win'): # Windows
|
|
33
|
+
return datetime.fromtimestamp(stat.st_ctime)
|
|
34
|
+
elif system == 'darwin': # macOS
|
|
35
|
+
try:
|
|
36
|
+
return datetime.fromtimestamp(stat.st_birthtime)
|
|
37
|
+
except AttributeError:
|
|
38
|
+
return datetime.fromtimestamp(stat.st_ctime)
|
|
39
|
+
else: # Linux, 没有创建时间,使用修改时间
|
|
40
|
+
return datetime.fromtimestamp(stat.st_mtime)
|
|
41
|
+
except (OSError, ValueError) as e:
|
|
42
|
+
logger.error(f"Failed to get file creation time for {file_path}: {e}")
|
|
43
|
+
return datetime.now()
|
|
44
|
+
|
|
28
45
|
def get_git_first_commit_time(file_path):
|
|
29
46
|
try:
|
|
30
47
|
# git log --reverse --format="%aI" -- {file_path} | head -n 1
|
|
@@ -37,7 +54,7 @@ def get_git_first_commit_time(file_path):
|
|
|
37
54
|
logger.info(f"Error getting git first commit time for {file_path}: {e}")
|
|
38
55
|
return None
|
|
39
56
|
|
|
40
|
-
def
|
|
57
|
+
def load_git_metadata(docs_dir_path: Path):
|
|
41
58
|
dates_cache = {}
|
|
42
59
|
try:
|
|
43
60
|
git_root = Path(subprocess.check_output(
|
|
@@ -82,27 +99,9 @@ def load_git_cache(docs_dir_path: Path):
|
|
|
82
99
|
logger.info(f"Error getting git info in {docs_dir_path}: {e}")
|
|
83
100
|
return dates_cache
|
|
84
101
|
|
|
85
|
-
def
|
|
86
|
-
try:
|
|
87
|
-
stat = os.stat(file_path)
|
|
88
|
-
system = platform.system().lower()
|
|
89
|
-
if system.startswith('win'): # Windows
|
|
90
|
-
return datetime.fromtimestamp(stat.st_ctime)
|
|
91
|
-
elif system == 'darwin': # macOS
|
|
92
|
-
try:
|
|
93
|
-
return datetime.fromtimestamp(stat.st_birthtime)
|
|
94
|
-
except AttributeError:
|
|
95
|
-
return datetime.fromtimestamp(stat.st_ctime)
|
|
96
|
-
else: # Linux, 没有创建时间,使用修改时间
|
|
97
|
-
return datetime.fromtimestamp(stat.st_mtime)
|
|
98
|
-
except (OSError, ValueError) as e:
|
|
99
|
-
logger.error(f"Failed to get file creation time for {file_path}: {e}")
|
|
100
|
-
return datetime.now()
|
|
101
|
-
|
|
102
|
-
def get_recently_updated_files(docs_dir_path: Path, files: Files, exclude_list: list, limit: int = 10, recent_enable: bool = False):
|
|
102
|
+
def load_git_last_updated_date(docs_dir_path: Path):
|
|
103
103
|
doc_mtime_map = {}
|
|
104
104
|
try:
|
|
105
|
-
# 1. 获取 git 信息,只记录已跟踪的文件最近一次的提交信息
|
|
106
105
|
git_root = Path(subprocess.check_output(
|
|
107
106
|
['git', 'rev-parse', '--show-toplevel'],
|
|
108
107
|
cwd=docs_dir_path, encoding='utf-8'
|
|
@@ -116,6 +115,7 @@ def get_recently_updated_files(docs_dir_path: Path, files: Files, exclude_list:
|
|
|
116
115
|
["git", "ls-files", "*.md"],
|
|
117
116
|
cwd=docs_dir_path, capture_output=True, encoding='utf-8'
|
|
118
117
|
)
|
|
118
|
+
# 只记录已跟踪的文件(还有已删除、重命名、不再跟踪)
|
|
119
119
|
tracked_files = set(result.stdout.splitlines()) if result.stdout else set()
|
|
120
120
|
|
|
121
121
|
ts = None
|
|
@@ -131,11 +131,15 @@ def get_recently_updated_files(docs_dir_path: Path, files: Files, exclude_list:
|
|
|
131
131
|
except Exception as e:
|
|
132
132
|
logger.info(f"Error getting git tracked files in {docs_dir_path}: {e}")
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
return doc_mtime_map
|
|
135
|
+
|
|
136
|
+
def get_recently_updated_files(existing_map: dict, files: Files, exclude_list: list, limit: int = 10, recent_enable: bool = False):
|
|
135
137
|
recently_updated_results = []
|
|
136
138
|
if recent_enable:
|
|
137
139
|
files_meta = []
|
|
138
140
|
for file in files:
|
|
141
|
+
if file.inclusion.is_excluded():
|
|
142
|
+
continue
|
|
139
143
|
if not file.src_path.endswith('.md'):
|
|
140
144
|
continue
|
|
141
145
|
rel_path = getattr(file, 'src_uri', file.src_path)
|
|
@@ -144,23 +148,18 @@ def get_recently_updated_files(docs_dir_path: Path, files: Files, exclude_list:
|
|
|
144
148
|
if is_excluded(rel_path, exclude_list):
|
|
145
149
|
continue
|
|
146
150
|
|
|
147
|
-
#
|
|
148
|
-
|
|
149
|
-
# 过滤没有配置进导航里的文档
|
|
150
|
-
if not file.page.title:
|
|
151
|
-
continue
|
|
152
|
-
title, url = file.page.title, file.page.url
|
|
153
|
-
else:
|
|
154
|
-
title, url = file.name, file.url
|
|
151
|
+
# 优先从现有数据获取 mtime,如果不存在则 fallback 到文件系统 mtime
|
|
152
|
+
mtime = existing_map.get(rel_path, os.path.getmtime(file.abs_src_path))
|
|
155
153
|
|
|
156
|
-
#
|
|
157
|
-
|
|
154
|
+
# 获取文档标题和 URL
|
|
155
|
+
title = file.page.title if file.page and file.page.title else file.name
|
|
156
|
+
url = file.page.url if file.page and file.page.url else file.url
|
|
158
157
|
|
|
159
158
|
# 存储信息
|
|
160
159
|
files_meta.append((mtime, rel_path, title, url))
|
|
161
|
-
|
|
160
|
+
# existing_map[rel_path] = mtime
|
|
162
161
|
|
|
163
|
-
#
|
|
162
|
+
# 构建最近更新列表
|
|
164
163
|
if files_meta:
|
|
165
164
|
# heapq 取 top limit
|
|
166
165
|
top_results = heapq.nlargest(limit, files_meta, key=lambda x: x[0])
|
|
@@ -169,7 +168,7 @@ def get_recently_updated_files(docs_dir_path: Path, files: Files, exclude_list:
|
|
|
169
168
|
for mtime, *rest in top_results
|
|
170
169
|
]
|
|
171
170
|
|
|
172
|
-
return
|
|
171
|
+
return recently_updated_results
|
|
173
172
|
|
|
174
173
|
def read_jsonl_cache(jsonl_file: Path):
|
|
175
174
|
dates_cache = {}
|
{mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5/mkdocs_document_dates.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mkdocs-document-dates
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.5
|
|
4
4
|
Summary: A new generation MkDocs plugin for displaying exact creation time, last update time, authors, email of documents
|
|
5
5
|
Home-page: https://github.com/jaywhj/mkdocs-document-dates
|
|
6
6
|
Author: Aaron Wang
|
|
@@ -30,16 +30,16 @@ English | [简体中文](README_zh.md)
|
|
|
30
30
|
|
|
31
31
|
<br />
|
|
32
32
|
|
|
33
|
-
A new generation MkDocs plugin for displaying exact **creation
|
|
33
|
+
A new generation MkDocs plugin for displaying exact **creation date, last updated date, authors, email** of documents
|
|
34
34
|
|
|
35
35
|

|
|
36
36
|
|
|
37
37
|
## Features
|
|
38
38
|
|
|
39
|
-
- [x] Always displays **exact** meta information of the document and works in any environment (no
|
|
40
|
-
- [x] Support list display of recently updated documents (in descending order of update
|
|
41
|
-
- [x] Support for manually specifying
|
|
42
|
-
- [x] Support for multiple
|
|
39
|
+
- [x] Always displays **exact** meta information of the document and works in any environment (no-Git, Git environments, Docker, all CI/CD build systems, etc.)
|
|
40
|
+
- [x] Support list display of recently updated documents (in descending order of update date)
|
|
41
|
+
- [x] Support for manually specifying date and author in `Front Matter`
|
|
42
|
+
- [x] Support for multiple date formats (date, datetime, timeago)
|
|
43
43
|
- [x] Support for multiple author modes (avatar, text, hidden)
|
|
44
44
|
- [x] Support for manually configuring author's name, link, avatar, email, etc.
|
|
45
45
|
- [x] Flexible display position (top or bottom)
|
|
@@ -51,7 +51,7 @@ A new generation MkDocs plugin for displaying exact **creation time, last update
|
|
|
51
51
|
|
|
52
52
|
| Build Speed Comparison: | 100 md: | 1000 md: | Time Complexity: |
|
|
53
53
|
| --------------------------- | :-----: | :------: | :----------: |
|
|
54
|
-
| git-revision-date-localized |
|
|
54
|
+
| git-revision-date-localized<br />git-authors | > 3 s | > 30 s | O(n) |
|
|
55
55
|
| document-dates | < 0.1 s | < 0.15 s | O(1) |
|
|
56
56
|
|
|
57
57
|
## Installation
|
|
@@ -74,28 +74,30 @@ Or, full configuration:
|
|
|
74
74
|
```yaml
|
|
75
75
|
plugins:
|
|
76
76
|
- document-dates:
|
|
77
|
-
position: top # Display position: top(after title) bottom(end of document)
|
|
77
|
+
position: top # Display position: top(after title) bottom(end of document), default: top
|
|
78
78
|
type: date # Date type: date datetime timeago, default: date
|
|
79
79
|
exclude: # List of excluded files
|
|
80
80
|
- temp.md # Example: exclude the specified file
|
|
81
81
|
- blog/* # Example: exclude all files in blog folder, including subfolders
|
|
82
82
|
date_format: '%Y-%m-%d' # Date format strings (e.g., %Y-%m-%d, %b %d, %Y)
|
|
83
83
|
time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
|
|
84
|
-
|
|
84
|
+
show_created: true # Show creation date: true false, default: true
|
|
85
|
+
show_updated: true # Show last updated date: true false, default: true
|
|
86
|
+
show_author: true # Show author: true(avatar) text(text) false(hidden), default: true
|
|
85
87
|
```
|
|
86
88
|
|
|
87
89
|
## Customization Settings
|
|
88
90
|
|
|
89
91
|
In addition to the above basic configuration, the plug-in also provides a wealth of customization options to meet a variety of individual needs:
|
|
90
92
|
|
|
91
|
-
- [Specify Datetime](https://jaywhj.netlify.app/document-dates-en#Specify-Datetime):
|
|
92
|
-
- [Specify Author](https://jaywhj.netlify.app/document-dates-en#Specify-Author):
|
|
93
|
-
- [Specify Avatar](https://jaywhj.netlify.app/document-dates-en#Specify-Avatar): You can manually specify the avatar for each author
|
|
94
|
-
- [Set Plugin Style](https://jaywhj.netlify.app/document-dates-en#Set-Plugin-Style):
|
|
93
|
+
- [Specify Datetime](https://jaywhj.netlify.app/document-dates-en#Specify-Datetime): Introduces the mechanism for obtaining document dates and methods for personalized customization, you can manually specify the creation date and last updated date for each document
|
|
94
|
+
- [Specify Author](https://jaywhj.netlify.app/document-dates-en#Specify-Author): Introduces the mechanism for obtaining document authors and methods for personalized customization, you can manually specify the author information for each document, such as name, link, avatar, email, etc.
|
|
95
|
+
- [Specify Avatar](https://jaywhj.netlify.app/document-dates-en#Specify-Avatar): You can manually specify the avatar for each author, support local file path and URL path
|
|
96
|
+
- [Set Plugin Style](https://jaywhj.netlify.app/document-dates-en#Set-Plugin-Style): You can quickly set the plugin styles through preset entrances, such as icons, themes, colors, fonts, animations, dividing line and so on
|
|
95
97
|
- [Add Localization Language](https://jaywhj.netlify.app/document-dates-en#Add-Localization-Language): More localization languages for `timeago` and `tooltip`
|
|
96
98
|
- [Use Template Variables](https://jaywhj.netlify.app/document-dates-en#Use-Template-Variables): Can be used to optimize `sitemap.xml` for site SEO, can be used to re-customize plug-ins, etc.
|
|
97
|
-
- [Add Recently Updated Module](https://jaywhj.netlify.app/document-dates-en#Add-Recently-Updated-Module): Enable list of recently updated documents (in descending order of update
|
|
98
|
-
- [Other Tips](https://jaywhj.netlify.app/document-dates-en#Other-Tips):
|
|
99
|
+
- [Add Recently Updated Module](https://jaywhj.netlify.app/document-dates-en#Add-Recently-Updated-Module): Enable list of recently updated documents (in descending order of update date), this is ideal for sites with a large number of documents, so that readers can quickly see what's new
|
|
100
|
+
- [Other Tips](https://jaywhj.netlify.app/document-dates-en#Other-Tips): Introducing the Do's of using plugin in Docker
|
|
99
101
|
- [Development Stories](https://jaywhj.netlify.app/document-dates-en#Development-Stories): Describes the origin of the plug-in, the difficulties and solutions encountered in development, and the principles and directions of product design
|
|
100
102
|
|
|
101
103
|
See the documentation for details: https://jaywhj.netlify.app/document-dates-en
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/cache_manager.py
RENAMED
|
File without changes
|
{mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/hooks/pre-commit
RENAMED
|
File without changes
|
{mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/hooks_installer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates/static/core/utils.js
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mkdocs_document_dates-3.4.9 → mkdocs_document_dates-3.5}/mkdocs_document_dates.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|