diff --git a/custom/__init__.py b/custom/__init__.py index 9c6b9c6..8451307 100644 --- a/custom/__init__.py +++ b/custom/__init__.py @@ -1,8 +1,8 @@ from mkdocs.plugins import BasePlugin import re -class MyCustom(BasePlugin): +class MyCustom(BasePlugin): def on_nav(self, nav, config, files): self.nav = nav @@ -11,13 +11,17 @@ def on_nav(self, nav, config, files): page.read_source(config) def recent_pages(): - #import ipdb; ipdb.set_trace() - return [page for page in self.nav.pages if page.parent \ - and re.match(r'\d{4}', page.parent.title) \ - and 'image' in page.meta] + # import ipdb; ipdb.set_trace() + return [ + page + for page in self.nav.pages + if page.parent + and re.match(r"\d{4}", page.parent.title) + and "image" in page.meta + ] - setattr(nav, 'recent_pages', recent_pages) + setattr(nav, "recent_pages", recent_pages) return nav def on_page_context(self, context, page, config, nav): - return context \ No newline at end of file + return context diff --git a/custom/__pycache__/__init__.cpython-310.pyc b/custom/__pycache__/__init__.cpython-310.pyc index 5bf40a6..f4208e9 100644 Binary files a/custom/__pycache__/__init__.cpython-310.pyc and b/custom/__pycache__/__init__.cpython-310.pyc differ diff --git a/docs/index.md b/docs/index.md index c4fe094..6baf90f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,24 +2,38 @@ title: Latest Posts timetoread: False --- + +
+ {% for page in navigation.recent_pages() %}
- -
- -
{{page.title}}
-
-
+
-{% endfor %} \ No newline at end of file +{% endfor %} +
\ No newline at end of file diff --git a/setup.py b/setup.py index dfa25b7..78dc95a 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,16 @@ from distutils.core import setup setup( - name='mkdocs-custom', - version='0.0.1', - author='Scott Pierce', - author_email='ddrscott@gmail.com', - packages=['custom'], - description='Local custom plugin', - install_requires=['mkdocs', 'jinja2'], - + name="mkdocs-custom", + version="0.0.1", + author="Scott Pierce", + author_email="ddrscott@gmail.com", + packages=["custom"], + description="Local custom plugin", + install_requires=["mkdocs", "jinja2"], entry_points={ - 'mkdocs.plugins': [ - 'custom = custom:MyCustom', + "mkdocs.plugins": [ + "custom = custom:MyCustom", ] - } -) \ No newline at end of file + }, +)