mkdocs-document-dates 3.6.0__tar.gz → 3.6.1__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.
Files changed (42) hide show
  1. {mkdocs_document_dates-3.6.0/mkdocs_document_dates.egg-info → mkdocs_document_dates-3.6.1}/PKG-INFO +3 -5
  2. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/README.md +2 -4
  3. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/plugin.py +8 -4
  4. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/core/core.css +2 -1
  5. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/core/core.js +5 -12
  6. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/core/utils.js +12 -0
  7. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/templates/recently_updated_group.html +28 -6
  8. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/utils.py +15 -6
  9. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1/mkdocs_document_dates.egg-info}/PKG-INFO +3 -5
  10. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/setup.py +1 -1
  11. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/LICENSE +0 -0
  12. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/MANIFEST.in +0 -0
  13. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/__init__.py +0 -0
  14. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/cache_manager.py +0 -0
  15. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/hooks/pre-commit +0 -0
  16. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/hooks_installer.py +0 -0
  17. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/config/user.config.css +0 -0
  18. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/config/user.config.js +0 -0
  19. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/core/default.config.js +0 -0
  20. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/core/md5.min.js +0 -0
  21. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/core/timeago.full.min.js +0 -0
  22. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/core/timeago.min.js +0 -0
  23. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/fonts/material-icons.css +0 -0
  24. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/fonts/materialicons.woff2 +0 -0
  25. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/templates/recently_updated_detail.html +0 -0
  26. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/templates/recently_updated_grid.html +0 -0
  27. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/templates/recently_updated_list.html +0 -0
  28. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/tippy/backdrop.css +0 -0
  29. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/tippy/light.css +0 -0
  30. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/tippy/material.css +0 -0
  31. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/tippy/popper.min.js +0 -0
  32. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/tippy/scale.css +0 -0
  33. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/tippy/shift-away.css +0 -0
  34. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/tippy/tippy.css +0 -0
  35. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates/static/tippy/tippy.umd.min.js +0 -0
  36. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
  37. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
  38. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
  39. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates.egg-info/requires.txt +0 -0
  40. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
  41. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/pyproject.toml +0 -0
  42. {mkdocs_document_dates-3.6.0 → mkdocs_document_dates-3.6.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-document-dates
3
- Version: 3.6.0
3
+ Version: 3.6.1
4
4
  Summary: A new generation MkDocs plugin for displaying exact creation date, last updated date, authors, email of documents
5
5
  Home-page: https://github.com/jaywhj/mkdocs-document-dates
6
6
  Author: Aaron Wang
@@ -67,7 +67,7 @@ plugins:
67
67
  - document-dates
68
68
  ```
69
69
 
70
- Or, full configuration:
70
+ Or, common configuration:
71
71
 
72
72
  ```yaml
73
73
  plugins:
@@ -77,8 +77,6 @@ plugins:
77
77
  exclude: # List of excluded files
78
78
  - temp.md # Example: exclude the specified file
79
79
  - blog/* # Example: exclude all files in blog folder, including subfolders
80
- date_format: '%Y-%m-%d' # Date format strings (e.g., %Y-%m-%d, %b %d, %Y)
81
- time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
82
80
  ```
83
81
 
84
82
  ## Customization Settings
@@ -97,7 +95,7 @@ In addition to the above basic configuration, the plug-in also provides a wealth
97
95
 
98
96
  See the documentation for details: https://jaywhj.netlify.app/document-dates-en
99
97
 
100
- <br />
98
+ ![recently-updated](recently-updated-en.gif)
101
99
 
102
100
  ## Other Projects
103
101
 
@@ -41,7 +41,7 @@ plugins:
41
41
  - document-dates
42
42
  ```
43
43
 
44
- Or, full configuration:
44
+ Or, common configuration:
45
45
 
46
46
  ```yaml
47
47
  plugins:
@@ -51,8 +51,6 @@ plugins:
51
51
  exclude: # List of excluded files
52
52
  - temp.md # Example: exclude the specified file
53
53
  - blog/* # Example: exclude all files in blog folder, including subfolders
54
- date_format: '%Y-%m-%d' # Date format strings (e.g., %Y-%m-%d, %b %d, %Y)
55
- time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
56
54
  ```
57
55
 
58
56
  ## Customization Settings
@@ -71,7 +69,7 @@ In addition to the above basic configuration, the plug-in also provides a wealth
71
69
 
72
70
  See the documentation for details: https://jaywhj.netlify.app/document-dates-en
73
71
 
74
- <br />
72
+ ![recently-updated](recently-updated-en.gif)
75
73
 
76
74
  ## Other Projects
77
75
 
@@ -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, load_git_metadata, load_git_last_updated_date, read_jsonl_cache,is_excluded, get_recently_updated_files
13
+ from .utils import get_file_creation_time, load_git_metadata, load_git_last_updated_date, read_jsonl_cache, compile_exclude_patterns, 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
@@ -48,6 +48,7 @@ class DocumentDatesPlugin(BasePlugin):
48
48
  self.authors_yml = {}
49
49
  self.recent_docs_html = None
50
50
  self.recent_enable = False
51
+ self._exclude_patterns = []
51
52
 
52
53
  def on_config(self, config):
53
54
  docs_dir_path = Path(config['docs_dir'])
@@ -138,6 +139,8 @@ class DocumentDatesPlugin(BasePlugin):
138
139
  'assets/document_dates/core/core.js'
139
140
  ])
140
141
 
142
+ self._exclude_patterns = compile_exclude_patterns(self.config['exclude'])
143
+
141
144
  return config
142
145
 
143
146
  def on_page_markdown(self, markdown, page: Page, config, files):
@@ -164,7 +167,7 @@ class DocumentDatesPlugin(BasePlugin):
164
167
  page.meta['document_dates_authors'] = authors
165
168
 
166
169
  # 检查是否需要排除
167
- if is_excluded(rel_path, self.config['exclude']):
170
+ if is_excluded(rel_path, self._exclude_patterns):
168
171
  return markdown
169
172
 
170
173
  # 生成日期和作者信息 HTML
@@ -187,7 +190,8 @@ class DocumentDatesPlugin(BasePlugin):
187
190
  limit = recently_updated_config.get('limit', 10)
188
191
 
189
192
  # 获取最近更新的文档数据
190
- recently_updated_docs = get_recently_updated_files(self.last_updated_dates, files, exclude_list, limit, self.recent_enable)
193
+ recent_exclude_patterns = compile_exclude_patterns(exclude_list)
194
+ recently_updated_docs = get_recently_updated_files(self.last_updated_dates, files, recent_exclude_patterns, limit, self.recent_enable)
191
195
 
192
196
  # 将数据注入到 config['extra'] 中供全局访问
193
197
  if 'extra' not in config:
@@ -477,4 +481,4 @@ class DocumentDatesPlugin(BasePlugin):
477
481
 
478
482
  pos = next_newline + 1
479
483
 
480
- return '', length
484
+ return '', length
@@ -68,6 +68,7 @@
68
68
  display: flex;
69
69
  align-items: center;
70
70
  flex-shrink: 0;
71
+ margin-right: 1.4rem;
71
72
  }
72
73
  .dd-item {
73
74
  display: inline-flex;
@@ -142,8 +143,8 @@
142
143
  display: block;
143
144
 
144
145
  /* Fix bug in Safari: rounded corners may blink to show square corners */
145
- will-change: transform;
146
146
  transform: translateZ(0);
147
+ will-change: transform;
147
148
  }
148
149
  .avatar-wrapper:hover {
149
150
  transform: scale(1.08);
@@ -163,16 +163,9 @@ function applyTimeagoToTimes(timeNodes, rawLocale) {
163
163
 
164
164
  // 处理数据加载
165
165
  function processDataLoading() {
166
- // 获取 locale,优先级:用户主动选择 > 服务端显式配置 > 用户浏览器语言 > 站点HTML语言 > 默认英语
167
- const rawLocale =
168
- ddUtils.getSavedLanguage() ||
169
- // ddpEl.getAttribute('locale') ||
170
- navigator.language ||
171
- navigator.userLanguage ||
172
- document.documentElement.lang ||
173
- 'en';
174
-
175
166
  document.querySelectorAll('.document-dates-plugin').forEach(ddpEl => {
167
+ const rawLocale = ddUtils.getCurrentLocale(ddpEl);
168
+
176
169
  // 处理 time 元素(使用 timeago 时)
177
170
  applyTimeagoToTimes(ddpEl.querySelectorAll('time'), rawLocale);
178
171
 
@@ -192,6 +185,7 @@ function processDataLoading() {
192
185
  });
193
186
 
194
187
  // 处理其他 timeago 时间
188
+ const rawLocale = ddUtils.getCurrentLocale();
195
189
  applyTimeagoToTimes(document.querySelectorAll('time.dd-timeago'), rawLocale);
196
190
  }
197
191
 
@@ -386,13 +380,13 @@ function initLayoutSwitcher() {
386
380
  grid.classList.toggle('is-list', savedLayout === 'list');
387
381
  grid.classList.toggle('is-detail', savedLayout === 'detail');
388
382
 
383
+
389
384
  // 查找或创建切换器容器
390
385
  let switcher = grid.previousElementSibling;
391
386
  if (!switcher || !switcher.classList.contains('article-layout-switcher')) {
392
387
  // 如果模板中没写,可以动态注入,但建议写在模板里以保证 UI 一致性
393
388
  return;
394
389
  }
395
-
396
390
  const listBtn = switcher.querySelector('.layout-list-btn');
397
391
  const detailBtn = switcher.querySelector('.layout-detail-btn');
398
392
  const gridBtn = switcher.querySelector('.layout-grid-btn');
@@ -402,9 +396,9 @@ function initLayoutSwitcher() {
402
396
  if (detailBtn) detailBtn.classList.toggle('is-active', layout === 'detail');
403
397
  if (gridBtn) gridBtn.classList.toggle('is-active', layout === 'grid');
404
398
  };
405
-
406
399
  updateActiveBtn(savedLayout);
407
400
 
401
+
408
402
  const setLayout = (layout) => {
409
403
  grid.classList.remove('is-list', 'is-detail');
410
404
  if (layout !== 'grid') {
@@ -413,7 +407,6 @@ function initLayoutSwitcher() {
413
407
  localStorage.setItem('dd_recent_docs_layout', layout);
414
408
  updateActiveBtn(layout);
415
409
  };
416
-
417
410
  if (listBtn) {
418
411
  listBtn.onclick = () => {
419
412
  setLayout('list');
@@ -44,6 +44,18 @@ window.ddUtils = {
44
44
  }
45
45
  },
46
46
 
47
+ // 获取当前语言环境,优先级:用户选择 > 元素配置 > 浏览器语言 > 页面语言 > 默认 'en'
48
+ getCurrentLocale(el) {
49
+ return (
50
+ this.getSavedLanguage() ||
51
+ (el ? el.getAttribute('locale') : null) ||
52
+ navigator.language ||
53
+ navigator.userLanguage ||
54
+ document.documentElement.lang ||
55
+ 'en'
56
+ );
57
+ },
58
+
47
59
  // 清除保存的语言设置
48
60
  clearLanguage() {
49
61
  try {
@@ -2,7 +2,7 @@
2
2
  .article-layout-switcher {
3
3
  display: flex;
4
4
  justify-content: flex-end;
5
- margin-bottom: 12px;
5
+ /* margin-bottom: 20px; */
6
6
  }
7
7
  .article-layout-switcher button + button {
8
8
  margin-left: 8px;
@@ -68,8 +68,7 @@
68
68
  }
69
69
  .article-grid.is-list .card-title {
70
70
  font-weight: 400;
71
- color: #0077cc;
72
- /* color: var(--md-typeset-color, #1c1c1c); */
71
+ color: var(--md-typeset-a-color, #0077cc);
73
72
 
74
73
  white-space: nowrap;
75
74
  overflow: hidden;
@@ -110,6 +109,9 @@
110
109
  white-space: nowrap;
111
110
  margin-right: 10px;
112
111
  }
112
+ .card-header:hover {
113
+ text-decoration: none !important;
114
+ }
113
115
  .card-header:hover .card-title {
114
116
  color: var(--md-accent-fg-color, blue);
115
117
  text-decoration: underline;
@@ -146,6 +148,16 @@
146
148
  justify-content: center;
147
149
  overflow: hidden;
148
150
  margin-left: 10px;
151
+ transition: filter 0.3s ease;
152
+
153
+ /* Safari 圆角闪烁修复 */
154
+ transform: translateZ(0); /* 建立独立合成层 */
155
+ will-change: transform; /* 提前告诉浏览器 */
156
+ -webkit-mask-image: -webkit-radial-gradient(white, black); /* 强制圆角裁剪走 mask 管线 */
157
+ isolation: isolate;
158
+ }
159
+ .card-cover:hover {
160
+ filter: brightness(0.8);
149
161
  }
150
162
  .card-cover a {
151
163
  display: block;
@@ -157,13 +169,23 @@
157
169
  height: 100%;
158
170
  object-fit: cover;
159
171
  margin: 0 !important;
172
+
173
+ /* 避免 layer 升降级 */
174
+ transform: scale(1.1) translateZ(0);
175
+ transition: transform 0.4s ease-out;
176
+ /* 防 Safari 重绘抖动 */
177
+ backface-visibility: hidden;
178
+ will-change: transform;
179
+ }
180
+ .card-cover:hover img {
181
+ transform: scale(1.1) translateX(4px) translateZ(0);
160
182
  }
161
183
  </style>
162
184
 
163
185
  <div class="article-layout-switcher">
164
- <button class="layout-list-btn" title="List View"><span class="material-icons">view_list</span></button>
165
- <button class="layout-detail-btn" title="Detail View"><span class="material-icons">view_day</span></button>
166
- <button class="layout-grid-btn" title="Grid View"><span class="material-icons">view_module</span></button>
186
+ <button class="layout-list-btn"><span class="material-icons">view_list</span></button>
187
+ <button class="layout-detail-btn"><span class="material-icons">view_day</span></button>
188
+ <button class="layout-grid-btn"><span class="material-icons">view_module</span></button>
167
189
  </div>
168
190
 
169
191
  <div class="article-grid">
@@ -4,6 +4,7 @@ import json
4
4
  import heapq
5
5
  import logging
6
6
  import subprocess
7
+ import fnmatch
7
8
  import re
8
9
  from pathlib import Path
9
10
  from datetime import datetime
@@ -14,15 +15,22 @@ logger = logging.getLogger("mkdocs.plugins.document_dates")
14
15
  logger.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, CRITICAL
15
16
 
16
17
 
17
- def is_excluded(path, exclude_list):
18
+ def compile_exclude_patterns(exclude_list):
18
19
  if not exclude_list:
20
+ return []
21
+ return [re.compile(fnmatch.translate(pattern)) for pattern in exclude_list]
22
+
23
+ def is_excluded(path, patterns):
24
+ if not patterns:
19
25
  return False
20
- for pattern in exclude_list:
21
- if pattern.endswith('*'):
22
- if path.startswith(pattern.partition('*')[0]):
26
+ first = patterns[0]
27
+ if isinstance(first, re.Pattern):
28
+ for regex in patterns:
29
+ if regex.match(path):
23
30
  return True
24
- else:
25
- if path == pattern:
31
+ else:
32
+ for pattern in patterns:
33
+ if fnmatch.fnmatch(path, pattern):
26
34
  return True
27
35
  return False
28
36
 
@@ -133,6 +141,7 @@ def load_git_last_updated_date(docs_dir_path: Path):
133
141
 
134
142
  return doc_mtime_map
135
143
 
144
+ # 建议在 on_page_markdown 之后的全局事件中调用,因为需要读取 page.meta 中的信息
136
145
  def get_recently_updated_files(existing_dates: dict, files: Files, exclude_list: list, limit: int = 10, recent_enable: bool = False):
137
146
  recently_updated_results = []
138
147
  if recent_enable:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-document-dates
3
- Version: 3.6.0
3
+ Version: 3.6.1
4
4
  Summary: A new generation MkDocs plugin for displaying exact creation date, last updated date, authors, email of documents
5
5
  Home-page: https://github.com/jaywhj/mkdocs-document-dates
6
6
  Author: Aaron Wang
@@ -67,7 +67,7 @@ plugins:
67
67
  - document-dates
68
68
  ```
69
69
 
70
- Or, full configuration:
70
+ Or, common configuration:
71
71
 
72
72
  ```yaml
73
73
  plugins:
@@ -77,8 +77,6 @@ plugins:
77
77
  exclude: # List of excluded files
78
78
  - temp.md # Example: exclude the specified file
79
79
  - blog/* # Example: exclude all files in blog folder, including subfolders
80
- date_format: '%Y-%m-%d' # Date format strings (e.g., %Y-%m-%d, %b %d, %Y)
81
- time_format: '%H:%M:%S' # Time format strings (valid only if type=datetime)
82
80
  ```
83
81
 
84
82
  ## Customization Settings
@@ -97,7 +95,7 @@ In addition to the above basic configuration, the plug-in also provides a wealth
97
95
 
98
96
  See the documentation for details: https://jaywhj.netlify.app/document-dates-en
99
97
 
100
- <br />
98
+ ![recently-updated](recently-updated-en.gif)
101
99
 
102
100
  ## Other Projects
103
101
 
@@ -23,7 +23,7 @@ class CustomInstallCommand(install):
23
23
  install.run(self)
24
24
 
25
25
 
26
- VERSION = '3.6.0'
26
+ VERSION = '3.6.1'
27
27
 
28
28
  setup(
29
29
  name="mkdocs-document-dates",