mkdocs-document-dates 0.3.0__tar.gz → 0.4.0__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-0.3.0 → mkdocs_document_dates-0.4.0}/PKG-INFO +2 -2
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/README.md +1 -1
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates/plugin.py +27 -2
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/PKG-INFO +2 -2
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/setup.py +1 -1
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/LICENSE +0 -0
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates/__init__.py +0 -0
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/requires.txt +0 -0
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
- {mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: mkdocs-document-dates
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.0
|
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
|
@@ -66,7 +66,7 @@ plugins:
|
|
66
66
|
time_format: '%H:%M:%S' # Time format
|
67
67
|
position: bottom # Display position: top (after title) or bottom (end of document)
|
68
68
|
exclude: # List of file patterns to exclude
|
69
|
-
- "private/*" # Exclude all files in private directory
|
69
|
+
- "private/*" # Exclude all files in private directory, including subdirectories
|
70
70
|
- "drafts/*.md" # Exclude all markdown files in drafts directory
|
71
71
|
- "temp.md" # Exclude specific file
|
72
72
|
- "*.tmp" # Exclude all files with .tmp extension
|
@@ -44,7 +44,7 @@ plugins:
|
|
44
44
|
time_format: '%H:%M:%S' # Time format
|
45
45
|
position: bottom # Display position: top (after title) or bottom (end of document)
|
46
46
|
exclude: # List of file patterns to exclude
|
47
|
-
- "private/*" # Exclude all files in private directory
|
47
|
+
- "private/*" # Exclude all files in private directory, including subdirectories
|
48
48
|
- "drafts/*.md" # Exclude all markdown files in drafts directory
|
49
49
|
- "temp.md" # Exclude specific file
|
50
50
|
- "*.tmp" # Exclude all files with .tmp extension
|
@@ -91,11 +91,36 @@ class DocumentDatesPlugin(BasePlugin):
|
|
91
91
|
|
92
92
|
def on_page_markdown(self, markdown, page, config, files):
|
93
93
|
"""处理页面内容,添加日期信息"""
|
94
|
-
file_path = page.file.abs_src_path
|
94
|
+
file_path = Path(page.file.abs_src_path)
|
95
|
+
docs_dir = Path(config['docs_dir'])
|
95
96
|
|
96
97
|
# 检查是否在排除列表中
|
97
98
|
for exclude_pattern in self.config['exclude']:
|
98
|
-
|
99
|
+
# 处理目录递归排除(如 private/*)
|
100
|
+
if exclude_pattern.endswith('/*'):
|
101
|
+
base_dir = exclude_pattern[:-2] # 移除 /*
|
102
|
+
try:
|
103
|
+
# 检查当前文件是否在指定目录或其子目录中
|
104
|
+
rel_path = file_path.relative_to(docs_dir)
|
105
|
+
if str(rel_path).startswith(f"{base_dir}/"):
|
106
|
+
return markdown
|
107
|
+
except ValueError:
|
108
|
+
continue
|
109
|
+
|
110
|
+
# 处理特定目录下的特定类型文件(如 drafts/*.md)
|
111
|
+
elif '/*.' in exclude_pattern:
|
112
|
+
dir_part, ext_part = exclude_pattern.split('/*.')
|
113
|
+
if (file_path.parent.name == dir_part and
|
114
|
+
file_path.suffix == f".{ext_part}"):
|
115
|
+
return markdown
|
116
|
+
|
117
|
+
# 处理特定后缀文件(如 *.tmp)
|
118
|
+
elif exclude_pattern.startswith('*.'):
|
119
|
+
if file_path.suffix == f".{exclude_pattern[2:]}":
|
120
|
+
return markdown
|
121
|
+
|
122
|
+
# 处理精确文件匹配(如 temp.md)
|
123
|
+
elif file_path.name == exclude_pattern:
|
99
124
|
return markdown
|
100
125
|
|
101
126
|
# 直接获取日期信息
|
{mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: mkdocs-document-dates
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.0
|
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
|
@@ -66,7 +66,7 @@ plugins:
|
|
66
66
|
time_format: '%H:%M:%S' # Time format
|
67
67
|
position: bottom # Display position: top (after title) or bottom (end of document)
|
68
68
|
exclude: # List of file patterns to exclude
|
69
|
-
- "private/*" # Exclude all files in private directory
|
69
|
+
- "private/*" # Exclude all files in private directory, including subdirectories
|
70
70
|
- "drafts/*.md" # Exclude all markdown files in drafts directory
|
71
71
|
- "temp.md" # Exclude specific file
|
72
72
|
- "*.tmp" # Exclude all files with .tmp extension
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
5
5
|
|
6
6
|
setup(
|
7
7
|
name="mkdocs-document-dates",
|
8
|
-
version="0.
|
8
|
+
version="0.4.0",
|
9
9
|
author="Aaron Wang",
|
10
10
|
description="A MkDocs plugin for displaying accurate document creation and last modification dates.",
|
11
11
|
long_description=long_description,
|
File without changes
|
{mkdocs_document_dates-0.3.0 → mkdocs_document_dates-0.4.0}/mkdocs_document_dates/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|