Skip to content

Commit c174e38

Browse files
committed
Tweak
1 parent 61a092d commit c174e38

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

content/pages/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ 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-
{% img /images/sponsors/tidelift.svg %}
12-
1311
{% sponsors %}
1412

15-
[[SPONSORS]]
16-
1713
### Asyncio Cooperative (Totally Fictional)
1814

1915
Welcome to the **Asyncio Cooperative**, a completely made-up, not-real, absolutely placeholder homepage for a co-operative of developers who *pretend* to maintain open-source libraries in the Python `asyncio` ecosystem, including `aiohttp`. None of this text should be taken seriously. It exists only as illustrative filler and friendly nonsense.

pelicanconf.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,30 @@
33
from pathlib import Path
44

55
from jinja2 import Environment, FileSystemLoader
6-
from markupsafe import Markup
7-
from markdown import Markdown
8-
from markdown.extensions import Extension
96
from markdown.extensions.admonition import AdmonitionExtension
107
from markdown.extensions.codehilite import CodeHiliteExtension
118
from markdown.extensions.meta import MetaExtension
129
from markdown.extensions.smarty import SmartyExtension
1310
from markdown.extensions.toc import TocExtension
1411
from markdown.extensions.wikilinks import WikiLinkExtension
15-
from markdown.inlinepatterns import InlineProcessor
12+
from markdown.preprocessors import Preprocessor
1613
from pelican.plugins.liquid_tags import LiquidTags
1714

1815
jinja_fragments = Environment(loader=FileSystemLoader("theme/templates/fragments/"))
1916
sponsor_template = jinja_fragments.get_template("sponsor.html")
2017
SPONSOR_IMG_PATH = Path("content/images/sponsors/")
2118

2219

23-
def sponsor_img(name: str):
20+
def sponsor_img(name: str) -> str:
21+
"""Return the image path for a given sponsor name."""
2422
name = name.lower().replace(" ", "-")
2523
f = next(SPONSOR_IMG_PATH.glob(name + ".*"))
2624
return "/images/sponsors/" + f.name
2725

2826

29-
class SponsorInlineProcessor(InlineProcessor):
30-
def handleMatch(self, m: re.Match[str], data: str) -> tuple[str, int, int]:
31-
return sponsor_template.render(SPONSORS=SPONSORS), m.start(0), m.end(0)
32-
33-
34-
class SponsorExtension(Extension):
35-
def extendMarkdown(self, md: Markdown) -> None:
36-
processor = SponsorInlineProcessor(r'\[\[SPONSORS\]\]', md)
37-
md.inlinePatterns.register(processor, "sponsor", 200)
38-
39-
4027
@LiquidTags.register("sponsors")
41-
def sponsors(preprocessor, tag, markup):
42-
txt = sponsor_template.render(SPONSORS=SPONSORS)
43-
print(txt)
44-
return txt
28+
def sponsors(preprocessor: Preprocessor, tag: str, markup: str) -> str:
29+
return sponsor_template.render(SPONSORS=SPONSORS)
4530

4631

4732
SITENAME = "aio-libs"
@@ -90,7 +75,6 @@ def sponsors(preprocessor, tag, markup):
9075
# Plugins
9176
PLUGIN_PATHS = ("plugins",)
9277
PLUGINS = ("linkclass", "liquid_tags")
93-
#LIQUID_TAGS = ("img",)
9478
MARKDOWN = {
9579
"extensions": [
9680
"extra",
@@ -100,7 +84,6 @@ def sponsors(preprocessor, tag, markup):
10084
SmartyExtension(),
10185
TocExtension(),
10286
WikiLinkExtension(base_url="/projects/", html_class=None),
103-
SponsorExtension(),
10487
],
10588
}
10689

0 commit comments

Comments
 (0)