Skip to content

Commit 08008ff

Browse files
Adding talk brainstorming section (#84)
* Adding talk brainstorming section * fixing XML/XHTML closing tag * Update ext/notion.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update ext/notion.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * syntax error fix/reformatting --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 4f93d75 commit 08008ff

File tree

6 files changed

+67
-3
lines changed

6 files changed

+67
-3
lines changed

conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@
215215
"embed",
216216
"gravatar",
217217
"sketchviz",
218+
"notion",
218219
]
219220

220221
myst_enable_extensions = [
@@ -433,4 +434,4 @@
433434
"image": "_static/logo/logo.png",
434435
}
435436
# Ensures og:image meta tag generation which is not always generated by sphinxext.opengraph
436-
ogp_image = "_static/logo/logo.png"
437+
ogp_image = "_static/logo/logo.png"

events.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ list-style: circle
99
excerpts:
1010
---
1111
```
12+
13+
```{toctree}
14+
:caption: Secciones
15+
:hidden: true
16+
17+
talk-brainstorming.md
18+
```

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: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""A directive to generate an iframe with a Notion page."""
2+
3+
import urllib.parse
4+
5+
from docutils import nodes
6+
from docutils.parsers.rst import Directive
7+
from sphinx.application import Sphinx
8+
from sphinx.util import logging
9+
10+
logger = logging.getLogger(__name__)
11+
12+
TEMPLATE: str = """
13+
<iframe src="{url}" width="100%" height="1200" frameborder="0" allowfullscreen>
14+
</iframe>
15+
"""
16+
17+
18+
class Notion(Directive):
19+
has_content = True
20+
final_argument_whitespace = False
21+
22+
def run(self):
23+
if not self.content:
24+
raise self.error("Notion directive requires a URL")
25+
if len(self.content) > 1:
26+
raise self.error("Notion directive only accepts a single URL")
27+
url = self.content[0]
28+
# Basic validation that it's a Notion URL
29+
if (
30+
not url.startswith(
31+
("https://notion.site", "https://www.notion.so")
32+
)
33+
and "notion" not in url
34+
):
35+
raise self.error("URL does not appear to be a valid Notion URL")
36+
37+
para = nodes.raw(
38+
"",
39+
TEMPLATE.format(url=urllib.parse.quote(url, safe=":/?&=+")),
40+
format="html",
41+
)
42+
return [para]
43+
44+
45+
def setup(app: Sphinx):
46+
app.add_directive("notion", Notion)
47+
48+
return {
49+
"version": "0.1",
50+
"parallel_read_safe": True,
51+
"parallel_write_safe": True,
52+
}

index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Revisa nuestras normas de como integrarte en la comunidad de Python Perú.
7979
```
8080

8181
```{toctree}
82-
:caption: Secciónes
82+
:caption: Secciones
8383
:hidden: true
8484
8585
about.md

talk-brainstorming.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Brainstorming de Charlas
2+
3+
```{notion} https://forested-roadrunner-0a7.notion.site/ebd/1e114afe2a67809c9ff0eb9429b1d3c7?v=1e114afe2a6780d88e41000c2debb2b5
4+
```

0 commit comments

Comments
 (0)