Skip to content

Commit

Permalink
chore: prep
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Sep 25, 2023
1 parent 947ef4a commit 9692469
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mknodes/pages/pagetemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(
self.footer_block = templateblocks.FooterBlock(parent)
self.libs_block = templateblocks.LibsBlock()
self.styles_block = templateblocks.StylesBlock()
self.site_nav_block = templateblocks.SiteNavBlock()
self.hero_block = templateblocks.HeroBlock()

def __bool__(self):
Expand All @@ -49,6 +50,7 @@ def blocks(self) -> list[templateblocks.Block]:
self.styles_block,
self.outdated_block,
self.hero_block,
self.site_nav_block,
]

def __repr__(self):
Expand Down
12 changes: 9 additions & 3 deletions mknodes/pages/templateblocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
]


SUPER_TEXT = r"{{ super() }}"

class Super:
def __str__(self):
return r"{{ super() }}"
return SUPER_TEXT


class Block(mknode.MkNode):
Expand Down Expand Up @@ -110,6 +112,10 @@ class TabsBlock(HtmlBlock):
block_id = "tabs"


class SiteNavBlock(HtmlBlock):
block_id = "site_nav"


class TitleBlock(Block):
block_id = "htmltitle"

Expand Down Expand Up @@ -143,7 +149,7 @@ def __bool__(self):
def block_content(self, md: markdown.Markdown | None = None):
lines = [i.to_html() for i in self.scripts]
scripts = "\n".join(lines)
return f"{{{{ super() }}}}\n{scripts}" if self.include_super else scripts
return f"{SUPER_TEXT}\n{scripts}" if self.include_super else scripts


class StylesBlock(Block):
Expand All @@ -166,7 +172,7 @@ def __bool__(self):
def block_content(self, md: markdown.Markdown | None = None):
lines = [i.to_html() for i in self.styles]
styles = "\n".join(lines)
return f"{{{{ super() }}}}\n{styles}" if self.include_super else styles
return f"{SUPER_TEXT}\n{styles}" if self.include_super else styles


if __name__ == "__main__":
Expand Down

0 comments on commit 9692469

Please sign in to comment.