Skip to content

Commit 66380be

Browse files
committed
Tweak
1 parent d81cee0 commit 66380be

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

content/pages/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ We are a co-operative of developers who maintain open-source libraries for the P
88

99
Asyncio would not be possible without our amazing sponsors. Please consider joining them to help fund our work. Our finances are entirely transparent and managed by [Open Collective](https://opencollective.com/aio-libs).
1010

11-
[[SPONSORS]]
11+
{% sponsors %}
1212

1313
### Asyncio Cooperative (Totally Fictional)
1414

pelicanconf.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from pathlib import Path
44

55
from jinja2 import Environment, FileSystemLoader
6-
from markupsafe import Markup
76
from markdown import Markdown
87
from markdown.extensions import Extension
98
from markdown.extensions.admonition import AdmonitionExtension
@@ -13,6 +12,7 @@
1312
from markdown.extensions.toc import TocExtension
1413
from markdown.extensions.wikilinks import WikiLinkExtension
1514
from markdown.inlinepatterns import InlineProcessor
15+
from pelican.plugins.liquid_tags import LiquidTags
1616

1717
jinja_fragments = Environment(loader=FileSystemLoader("theme/templates/fragments/"))
1818
sponsor_template = jinja_fragments.get_template("sponsor.html")
@@ -26,8 +26,8 @@ def sponsor_img(name: str):
2626

2727

2828
class SponsorInlineProcessor(InlineProcessor):
29-
def handleMatch(self, m: re.Match[str], data: str) -> tuple[Markup, int, int]:
30-
return Markup(sponsor_template.render(SPONSORS=SPONSORS), m.start(0), m.end(0))
29+
def handleMatch(self, m: re.Match[str], data: str) -> tuple[str, int, int]:
30+
return sponsor_template.render(SPONSORS=SPONSORS), m.start(0), m.end(0)
3131

3232

3333
class SponsorExtension(Extension):
@@ -36,6 +36,11 @@ def extendMarkdown(self, md: Markdown) -> None:
3636
md.inlinePatterns.register(processor, "sponsor", 200)
3737

3838

39+
@LiquidTags.register("sponsors")
40+
def sponsors(preprocessor, tag, markup):
41+
return sponsor_template.render(SPONSORS=SPONSORS)
42+
43+
3944
SITENAME = "aio-libs"
4045
SITEURL = ""
4146
SUMMARY_MAX_PARAGRAPHS = 1
@@ -81,7 +86,8 @@ def extendMarkdown(self, md: Markdown) -> None:
8186

8287
# Plugins
8388
PLUGIN_PATHS = ("plugins",)
84-
PLUGINS = ("linkclass",)
89+
PLUGINS = ("linkclass", "liquid_tags")
90+
LIQUID_TAGS = ("sponsors",)
8591
MARKDOWN = {
8692
"extensions": [
8793
"extra",

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ Jinja2==3.1.6
22
Markdown==3.10
33
Pelican[markdown]==4.11.0
44
pelican-linkclass==2.1.6
5+
pelican-liquid-tags==1.0.4

0 commit comments

Comments
 (0)