Skip to content

Commit 1307104

Browse files
committed
syntax error fix/reformatting
1 parent a2e1c6f commit 1307104

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

ext/gravatar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def run(self):
3838

3939
data = {}
4040
if klass is not None:
41-
data['classes'] = klass
41+
data["classes"] = klass
4242

4343
image = nodes.image(alt=alt, classes=klass, uri=url)
4444
return [image]

ext/notion.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""A directive to generate an iframe with a Notion page."""
22

3+
import urllib.parse
4+
35
from docutils import nodes
46
from docutils.parsers.rst import Directive
57
from sphinx.application import Sphinx
@@ -24,20 +26,24 @@ def run(self):
2426
raise self.error("Notion directive only accepts a single URL")
2527
url = self.content[0]
2628
# Basic validation that it's a Notion URL
27-
if not url.startswith(("https://notion.site", "https://www.notion.so")) and "notion" not in url:
29+
if (
30+
not url.startswith(
31+
("https://notion.site", "https://www.notion.so")
32+
)
33+
and "notion" not in url
34+
):
2835
raise self.error("URL does not appear to be a valid Notion URL")
2936

3037
para = nodes.raw(
31-
para = nodes.raw(
32-
- "", TEMPLATE.format(url=url), format="html"
33-
+ "", TEMPLATE.format(url=urllib.parse.quote(url, safe=":/?&=+")), format="html"
34-
)
38+
"",
39+
TEMPLATE.format(url=urllib.parse.quote(url, safe=":/?&=+")),
40+
format="html",
3541
)
3642
return [para]
3743

3844

3945
def setup(app: Sphinx):
40-
app.add_directive("notion",Notion)
46+
app.add_directive("notion", Notion)
4147

4248
return {
4349
"version": "0.1",

0 commit comments

Comments
 (0)