mkdocs-document-dates 3.3__tar.gz → 3.3.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 (43) hide show
  1. {mkdocs_document_dates-3.3/mkdocs_document_dates.egg-info → mkdocs_document_dates-3.3.1}/PKG-INFO +1 -1
  2. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/cache_manager.py +5 -1
  3. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/utils.py +12 -0
  4. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1/mkdocs_document_dates.egg-info}/PKG-INFO +1 -1
  5. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/setup.py +1 -1
  6. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/LICENSE +0 -0
  7. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/MANIFEST.in +0 -0
  8. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/README.md +0 -0
  9. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/__init__.py +0 -0
  10. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/hooks/pre-commit +0 -0
  11. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/hooks_installer.py +0 -0
  12. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/plugin.py +0 -0
  13. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/config/user.config.css +0 -0
  14. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/config/user.config.js +0 -0
  15. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/core/core.css +0 -0
  16. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/core/core.js +0 -0
  17. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/core/timeago-load.js +0 -0
  18. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/core/timeago.full.min.js +0 -0
  19. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/core/timeago.min.js +0 -0
  20. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/ar.json +0 -0
  21. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/de.json +0 -0
  22. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/en.json +0 -0
  23. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/es.json +0 -0
  24. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/fr.json +0 -0
  25. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/ja.json +0 -0
  26. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/ko.json +0 -0
  27. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/ru.json +0 -0
  28. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/zh.json +0 -0
  29. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/languages/zh_TW.json +0 -0
  30. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/backdrop.css +0 -0
  31. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/light.css +0 -0
  32. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/material.css +0 -0
  33. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/popper.min.js +0 -0
  34. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/scale.css +0 -0
  35. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/shift-away.css +0 -0
  36. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/tippy.css +0 -0
  37. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates/static/tippy/tippy.umd.min.js +0 -0
  38. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
  39. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
  40. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
  41. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates.egg-info/requires.txt +0 -0
  42. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
  43. {mkdocs_document_dates-3.3 → mkdocs_document_dates-3.3.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-document-dates
3
- Version: 3.3
3
+ Version: 3.3.1
4
4
  Summary: A new generation MkDocs plugin for displaying exact meta-info, such as creation time, last update time, authors, email, etc
5
5
  Home-page: https://github.com/jaywhj/mkdocs-document-dates
6
6
  Author: Aaron Wang
@@ -1,7 +1,7 @@
1
1
  import logging
2
2
  import subprocess
3
3
  from pathlib import Path
4
- from .utils import read_json_cache, read_jsonl_cache, write_jsonl_cache, get_file_creation_time
4
+ from .utils import read_json_cache, read_jsonl_cache, write_jsonl_cache, get_file_creation_time, get_git_first_commit_time
5
5
 
6
6
  logger = logging.getLogger("mkdocs.plugins.document_dates")
7
7
  logger.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, CRITICAL
@@ -94,6 +94,10 @@ def update_cache():
94
94
  project_updated = True
95
95
  elif full_path.exists():
96
96
  created_time = get_file_creation_time(full_path).astimezone()
97
+ if not jsonl_cache_file.exists() and not json_cache_file.exists():
98
+ git_time = get_git_first_commit_time(full_path)
99
+ if git_time:
100
+ created_time = min(created_time, git_time)
97
101
  jsonl_dates_cache[rel_path] = {
98
102
  "created": created_time.isoformat()
99
103
  }
@@ -11,6 +11,18 @@ logger = logging.getLogger("mkdocs.plugins.document_dates")
11
11
  logger.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, CRITICAL
12
12
 
13
13
 
14
+ def get_git_first_commit_time(file_path):
15
+ try:
16
+ # git log --reverse --format="%aI" -- {file_path} | head -n 1
17
+ cmd_list = ['git', 'log', '--reverse', '--format=%aI', '--', file_path]
18
+ process = subprocess.run(cmd_list, capture_output=True, text=True)
19
+ if process.returncode == 0 and process.stdout.strip():
20
+ first_line = process.stdout.partition('\n')[0].strip()
21
+ return datetime.fromisoformat(first_line)
22
+ except Exception as e:
23
+ logger.info(f"Error getting git first commit time for {file_path}: {e}")
24
+ return None
25
+
14
26
  def load_git_cache(docs_dir_path: Path):
15
27
  dates_cache = {}
16
28
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocs-document-dates
3
- Version: 3.3
3
+ Version: 3.3.1
4
4
  Summary: A new generation MkDocs plugin for displaying exact meta-info, such as creation time, last update time, authors, email, etc
5
5
  Home-page: https://github.com/jaywhj/mkdocs-document-dates
6
6
  Author: Aaron Wang
@@ -28,7 +28,7 @@ try:
28
28
  except FileNotFoundError:
29
29
  long_description = "A new generation MkDocs plugin for displaying exact meta-info, such as creation time, last update time, authors, email, etc"
30
30
 
31
- VERSION = '3.3'
31
+ VERSION = '3.3.1'
32
32
 
33
33
  setup(
34
34
  name="mkdocs-document-dates",