1
0
mirror of https://github.com/funkypenguin/geek-cookbook/ synced 2025-12-13 01:36:23 +00:00

Use mkdocs snippets to template common content blocks (#135)

This commit is contained in:
David Young
2021-01-06 22:19:43 +13:00
committed by GitHub
parent f20f29967d
commit e0196723cb
103 changed files with 337 additions and 897 deletions

View File

@@ -87,26 +87,27 @@ class Filters:
return content
def footer(self, content, context):
"""Appends a footer to the end of every manuscript file"""
if not hasattr(self, "footer_content"):
self.footer_path = os.path.join(
os.path.dirname(__file__), "recipe-footer.md")
footer_file = open(self.footer_path)
self.footer_content = footer_file.read()
self.footer_search = self.footer_content.split("\n")[
0].replace("#", "")
footer_file.close()
if "index.md" in context['file_name']:
log(LOG.DEBUG, "footer",
f"ignoring {context['file_name']} as it contains index.md")
return content
# disabled for now because we're using snippets
# def footer(self, content, context):
# """Appends a footer to the end of every manuscript file"""
# if not hasattr(self, "footer_content"):
# self.footer_path = os.path.join(
# os.path.dirname(__file__), "recipe-footer.md")
# footer_file = open(self.footer_path)
# self.footer_content = footer_file.read()
# self.footer_search = self.footer_content.split("\n")[
# 0].replace("#", "")
# footer_file.close()
# if "index.md" in context['file_name']:
# log(LOG.DEBUG, "footer",
# f"ignoring {context['file_name']} as it contains index.md")
# return content
if self.footer_search in content:
log(LOG.WARN, "footer",
f"Footer is hard-coded in {context['file_name']}")
return content
return content + "\n" + self.footer_content
# if self.footer_search in content:
# log(LOG.WARN, "footer",
# f"Footer is hard-coded in {context['file_name']}")
# return content
# return content + "\n" + self.footer_content
def flattern(obj):

View File

@@ -1,4 +1,8 @@
## Tip your waiter (sponsor me) 👏
///Footnotes Go Here///
Updated
## Tip your waiter (sponsor) 👏
Did you receive excellent service? Want to make your waiter happy? (_..and support development of current and future recipes!_) Sponsor me on [Github][github_sponsor] / [Patreon][patreon], or see the [support](/support/) page for more (_free or paid)_ ways to say thank you! 👏