mkdocs-document-dates 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl
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/plugin.py +13 -2
- {mkdocs_document_dates-0.1.0.dist-info → mkdocs_document_dates-0.2.0.dist-info}/METADATA +3 -3
- mkdocs_document_dates-0.2.0.dist-info/RECORD +8 -0
- mkdocs_document_dates-0.1.0.dist-info/RECORD +0 -8
- {mkdocs_document_dates-0.1.0.dist-info → mkdocs_document_dates-0.2.0.dist-info}/LICENSE +0 -0
- {mkdocs_document_dates-0.1.0.dist-info → mkdocs_document_dates-0.2.0.dist-info}/WHEEL +0 -0
- {mkdocs_document_dates-0.1.0.dist-info → mkdocs_document_dates-0.2.0.dist-info}/entry_points.txt +0 -0
- {mkdocs_document_dates-0.1.0.dist-info → mkdocs_document_dates-0.2.0.dist-info}/top_level.txt +0 -0
mkdocs_document_dates/plugin.py
CHANGED
@@ -103,9 +103,20 @@ class DocumentDatesPlugin(BasePlugin):
|
|
103
103
|
# 检查 frontmatter 中的日期
|
104
104
|
meta = getattr(page, 'meta', {})
|
105
105
|
if 'created_date' in meta:
|
106
|
-
|
106
|
+
try:
|
107
|
+
date_str = str(meta['created_date']).strip("'\"") # 移除可能存在的引号
|
108
|
+
created = datetime.fromisoformat(date_str)
|
109
|
+
except (ValueError, TypeError):
|
110
|
+
# 如果解析失败,保持原有的文件系统日期
|
111
|
+
pass
|
112
|
+
|
107
113
|
if 'modified_date' in meta:
|
108
|
-
|
114
|
+
try:
|
115
|
+
date_str = str(meta['modified_date']).strip("'\"") # 移除可能存在的引号
|
116
|
+
modified = datetime.fromisoformat(date_str)
|
117
|
+
except (ValueError, TypeError):
|
118
|
+
# 如果解析失败,保持原有的文件系统日期
|
119
|
+
pass
|
109
120
|
|
110
121
|
# 格式化并插入日期信息
|
111
122
|
date_info = self.format_date_info(created, modified)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: mkdocs-document-dates
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
4
4
|
Summary: 一个用于显示文档创建日期和最后修改日期的 MkDocs 插件
|
5
5
|
Home-page: https://github.com/jaywhj/mkdocs-document-dates
|
6
6
|
Author: Aaron Wang
|
@@ -78,8 +78,8 @@ plugins:
|
|
78
78
|
|
79
79
|
```yaml
|
80
80
|
---
|
81
|
-
created_date:
|
82
|
-
modified_date:
|
81
|
+
created_date: 2023-01-01
|
82
|
+
modified_date: 2023-12-31
|
83
83
|
---
|
84
84
|
|
85
85
|
# 文档标题
|
@@ -0,0 +1,8 @@
|
|
1
|
+
mkdocs_document_dates/__init__.py,sha256=yom7psmObebsZY0AwCN1PjlGUwPkny2r6NyzoO0cudg,58
|
2
|
+
mkdocs_document_dates/plugin.py,sha256=OkXv5SjJPnoRwg6ZwtqlLzCDx_PfxdKKYEuWXy4LiQg,5405
|
3
|
+
mkdocs_document_dates-0.2.0.dist-info/LICENSE,sha256=1YKfCs5WKSk-bON8a68WZE5to1B2klCrHBYiuaVCThM,514
|
4
|
+
mkdocs_document_dates-0.2.0.dist-info/METADATA,sha256=jqBlnzgJTNg4PdTz436RqSWH4ig6NC2XPRoiiUAFeR8,3189
|
5
|
+
mkdocs_document_dates-0.2.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
6
|
+
mkdocs_document_dates-0.2.0.dist-info/entry_points.txt,sha256=gI-OFLGjDG6-oLEfyevl3Gwwj2GcqVFQeX3bvL1IF8o,83
|
7
|
+
mkdocs_document_dates-0.2.0.dist-info/top_level.txt,sha256=yWkKQdNuAJJVqUQ9uLa5xD4x_Gux4IfOUpy8Ryagdwc,22
|
8
|
+
mkdocs_document_dates-0.2.0.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
mkdocs_document_dates/__init__.py,sha256=yom7psmObebsZY0AwCN1PjlGUwPkny2r6NyzoO0cudg,58
|
2
|
-
mkdocs_document_dates/plugin.py,sha256=x5oFH2K54Wlr5DJUSKG6gl85tZ9HHrgjbnaksGuqkzc,4900
|
3
|
-
mkdocs_document_dates-0.1.0.dist-info/LICENSE,sha256=1YKfCs5WKSk-bON8a68WZE5to1B2klCrHBYiuaVCThM,514
|
4
|
-
mkdocs_document_dates-0.1.0.dist-info/METADATA,sha256=q-Eft96oExZ_ARZLhaNGy5uS_mR9Tsfk0yCTcosG1Jw,3193
|
5
|
-
mkdocs_document_dates-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
6
|
-
mkdocs_document_dates-0.1.0.dist-info/entry_points.txt,sha256=gI-OFLGjDG6-oLEfyevl3Gwwj2GcqVFQeX3bvL1IF8o,83
|
7
|
-
mkdocs_document_dates-0.1.0.dist-info/top_level.txt,sha256=yWkKQdNuAJJVqUQ9uLa5xD4x_Gux4IfOUpy8Ryagdwc,22
|
8
|
-
mkdocs_document_dates-0.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{mkdocs_document_dates-0.1.0.dist-info → mkdocs_document_dates-0.2.0.dist-info}/entry_points.txt
RENAMED
File without changes
|
{mkdocs_document_dates-0.1.0.dist-info → mkdocs_document_dates-0.2.0.dist-info}/top_level.txt
RENAMED
File without changes
|