Closed rachmadaniHaryono closed 2 years ago
Thank you for the pull request!
Actually, git-timestamp
is set for every page:
so it shouldn't raise a key error. Can you provide a demo project to reproduce this error?
unfortunately i can't reproduce first error
similar step i can get
> poetry new p1
Created package p1 in p1
> cd p1
> poetry add mkdocs-blogging-plugin
Creating virtualenv p1-TJeFODVO-py3.10 in /home/r3r/.cache/pypoetry/virtualenvs
Using version ^1.2.0 for mkdocs-blogging-plugin
Updating dependencies
Resolving dependencies... (29.2s)
Writing lock file
Package operations: 28 installs, 0 updates, 0 removals
• Installing six (1.16.0)
• Installing markupsafe (2.0.1)
• Installing pyparsing (3.0.6)
• Installing python-dateutil (2.8.2)
• Installing pyyaml (6.0)
• Installing smmap (5.0.0)
• Installing zipp (3.7.0)
• Installing click (8.0.3)
• Installing ghp-import (2.0.2)
• Installing gitdb (4.0.9)
• Installing importlib-metadata (4.10.0)
• Installing jinja2 (3.0.3)
• Installing markdown (3.3.6)
• Installing mergedeep (1.3.4)
• Installing packaging (21.3)
• Installing pytz (2021.3)
• Installing pyyaml-env-tag (0.1)
• Installing watchdog (2.1.6)
• Installing attrs (21.4.0)
• Installing babel (2.9.1)
• Installing gitpython (3.1.24)
• Installing mkdocs (1.2.3)
• Installing more-itertools (8.12.0)
• Installing wcwidth (0.2.5)
• Installing py (1.11.0)
• Installing pluggy (0.13.1)
• Installing mkdocs-blogging-plugin (1.2.0)
• Installing pytest (5.4.3)
> poetry run mkdocs new .
> # edit mkdocs.yml
> mkdir docs/blog/2022/01/
mkdocs.yml
site_name: My Docs
plugins:
- blogging:
dirs: # The directories to be included
- blog
features:
tags: {}
actual package installed on project where this error occur
> poetry show
argcomplete 1.12.3 Bash tab completion for argparse
babel 2.9.1 Internationalization utilities
bracex 2.2.1 Bash style brace expander.
cfgv 3.3.1 Validate configuration and produce human readable error messages.
click 8.0.3 Composable command line interface toolkit
colorama 0.4.4 Cross-platform colored terminal text.
commitizen 2.20.3 Python commitizen client tool
decli 0.5.2 Minimal, easy-to-use, declarative cli tool
distlib 0.3.4 Distribution utilities
filelock 3.4.2 A platform independent file lock.
ghp-import 2.0.2 Copy your docs directly to the gh-pages branch.
gitdb 4.0.9 Git Object Database
gitpython 3.1.24 GitPython is a python library used to interact with Git reposi...
identify 2.4.1 File identification library for Python
importlib-metadata 4.10.0 Read metadata from Python packages
jinja2 3.0.3 A very fast and expressive template engine.
markdown 3.3.6 Python implementation of Markdown.
markupsafe 2.0.1 Safely add untrusted strings to HTML/XML markup.
mergedeep 1.3.4 A deep merge function for 🐍.
mkdocs 1.2.3 Project documentation with Markdown.
mkdocs-awesome-pages-plugin 2.6.1 An MkDocs plugin that simplifies configuring page titles and t...
mkdocs-blogging-plugin 1.2.1rc2 https://github.com/rachmadaniHaryono/mkdocs-blogging-plugin/archive/refs/heads/develop.zip Mkdocs plugin that generates a blog index page sorted by creat...
mkdocs-material 8.1.3 A Material Design theme for MkDocs
mkdocs-material-extensions 1.0.3 Extension pack for Python Markdown.
nodeenv 1.6.0 Node.js virtual environment builder
packaging 21.3 Core utilities for Python packages
platformdirs 2.4.1 A small Python module for determining appropriate platform-spe...
pre-commit 2.16.0 A framework for managing and maintaining multi-language pre-co...
prompt-toolkit 3.0.24 Library for building powerful interactive command lines in Python
pygments 2.11.0 Pygments is a syntax highlighting package written in Python.
pymdown-extensions 9.1 Extension pack for Python Markdown.
pyparsing 3.0.6 Python parsing module
python-dateutil 2.8.2 Extensions to the standard Python datetime module
pytz 2021.3 World timezone definitions, modern and historical
pyyaml 6.0 YAML parser and emitter for Python
pyyaml-env-tag 0.1 A custom YAML tag for referencing environment variables in YAM...
questionary 1.10.0 Python library to build pretty command line user prompts ⭐️
six 1.16.0 Python 2 and 3 compatibility utilities
smmap 5.0.0 A pure Python implementation of a sliding window memory map ma...
termcolor 1.1.0 ANSII Color formatting for output in terminal.
toml 0.10.2 Python Library for Tom's Obvious, Minimal Language
tomlkit 0.8.0 Style preserving TOML library
typing-extensions 4.0.1 Backported and Experimental Type Hints for Python 3.6+
virtualenv 20.12.0 Virtual Python Environment builder
watchdog 2.1.6 Filesystem events monitoring
wcmatch 8.3 Wildcard/glob file name matcher.
wcwidth 0.2.5 Measures the displayed width of unicode strings in a terminal
zipp 3.7.0 Backport of pathlib-compatible object wrapper for zip files
Can you upload a complete directory containing mkdocs.yml
and all your markdown files? I cannot get useful information from only the environment.
> poetry run mkdocs serve
INFO - Building documentation...
INFO - Cleaning site directory
ERROR - Error building page 'index.md': 'git-timestamp'
Traceback (most recent call last):
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/mkdocs/__main__.py", line 177, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, **kwargs)
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 54, in serve
config = builder()
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 49, in builder
build(config, live_server=live_server, dirty=dirty)
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/mkdocs/commands/build.py", line 314, in build
_build_page(file.page, config, doc_files, nav, env, dirty)
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/mkdocs/commands/build.py", line 220, in _build_page
output = config['plugins'].run_event(
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/mkdocs/plugins.py", line 102, in run_event
result = method(item, **kwargs)
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/mkdocs_blogging_plugin/plugin.py", line 249, in on_post_page
sorted_entries = {tag: self.sorted_pages(
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/mkdocs_blogging_plugin/plugin.py", line 249, in <dictcomp>
sorted_entries = {tag: self.sorted_pages(
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/mkdocs_blogging_plugin/plugin.py", line 279, in sorted_pages
return sorted(pages,
File "/home/r3r/.cache/pypoetry/virtualenvs/p2-P7z4mDpE-py3.10/lib/python3.10/site-packages/mkdocs_blogging_plugin/plugin.py", line 280, in <lambda>
key=lambda page: page.meta["git-timestamp"],
The issue is: there is a flaw in the original judgement for whether a page is within the blog directory specified in the configuration.
This issue is fixed in https://github.com/liang2kl/mkdocs-blogging-plugin/commit/a0d41aca66a5997b95e688ef6af00fa7b69f9573. I will release a patch soon.
You can check v1.2.1 for the fixes. As each page involved in the sorting has a valid timestamp, there is no longer a need for other sorting methods. Thank you for the pull request!
Proposed changes
when i write drafted text and run
mkdocs serve
mkdocs will raise error that page.meta don't have 'git-timestamp'first it happened here https://github.com/liang2kl/mkdocs-blogging-plugin/blob/47bff7e969b6f8b7f6e1b8e3e24bff819c8cad09/mkdocs_blogging_plugin/plugin.py#L221
(sorry forget the traceback for this one)
after af8b50acb02483dc244425537bce260aa140a5a8 there is also error on other place for example
so i write function to replace lambda where page is sorted by git-timestamp
Types of changes
What types of changes does your code introduce? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
unrelated but there is also this warning when running pytest
i will create another pr for this later
this pr is based from this template https://github.com/appium/appium/blob/master/.github/PULL_REQUEST_TEMPLATE.md