picata 0.0.4__tar.gz → 0.0.6__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {picata-0.0.4 → picata-0.0.6}/PKG-INFO +1 -1
- {picata-0.0.4 → picata-0.0.6}/entrypoint.tsx +4 -3
- {picata-0.0.4 → picata-0.0.6}/picata/apps.py +1 -1
- {picata-0.0.4 → picata-0.0.6}/picata/models.py +4 -1
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/base.html +3 -1
- picata-0.0.6/picata/templatetags/kill_orphans.py +62 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templatetags/stringify.py +5 -2
- {picata-0.0.4 → picata-0.0.6}/pyproject.toml +1 -1
- {picata-0.0.4 → picata-0.0.6}/styles.sass +4 -2
- {picata-0.0.4 → picata-0.0.6}/.gitignore +0 -0
- {picata-0.0.4 → picata-0.0.6}/LICENSE.md +0 -0
- {picata-0.0.4 → picata-0.0.6}/README.md +0 -0
- {picata-0.0.4 → picata-0.0.6}/components/HelloWorld.tsx +0 -0
- {picata-0.0.4 → picata-0.0.6}/manage.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/__init__.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/blocks.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/helpers/__init__.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/helpers/wagtail.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/log_utils.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/middleware.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/migrations/0001_initial.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/migrations/__init__.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/settings/__init__.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/settings/base.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/settings/dev.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/settings/mypy.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/settings/prod.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/settings/test.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/ada-profile.jpg +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/ada-social-bear.jpg +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/favicon.ico +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/fonts/Bitter-Light.ttf +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/fonts/Bitter-LightItalic.ttf +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/fonts/FiraCode-Light.ttf +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/fonts/FiraCode-SemiBold.ttf +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/fonts/Sacramento-Regular.ttf +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/fonts/ZillaSlab-Bold.ttf +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/fonts/ZillaSlab-BoldItalic.ttf +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/fonts/ZillaSlab-Light.ttf +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/fonts/ZillaSlab-LightItalic.ttf +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/fonts/ZillaSlabHighlight-Bold.ttf +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/static/picata/icons.svg +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/3_column.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/404.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/500.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/_post_list.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/article.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/basic_page.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/blocks/icon_link_item.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/blocks/icon_link_list.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/blocks/icon_link_list_stream.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/dl_view.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/home_page.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/post_listing.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/previews/3col.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/previews/dl.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/previews/split.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/previews/theme_gallery.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/search_results.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/split_view.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templates/picata/tags/site_menu.html +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templatetags/__init__.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templatetags/absolute_static.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/templatetags/menu_tags.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/transformers.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/typing/__init__.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/typing/wagtail.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/urls.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/validators.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/views.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/wagtail_hooks.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/picata/wsgi.py +0 -0
- {picata-0.0.4 → picata-0.0.6}/pygments.sass +0 -0
@@ -167,12 +167,13 @@ function renderPageContents(): void {
|
|
167
167
|
const listStack: HTMLUListElement[] = [tocList];
|
168
168
|
let currentLevel = 1;
|
169
169
|
|
170
|
-
// Find all anchor-linked headings
|
170
|
+
// Find all anchor-linked headings inside articles
|
171
171
|
const headings = document.querySelectorAll<HTMLElement>(
|
172
|
-
"h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]",
|
172
|
+
"article h1[id], article h2[id], article h3[id], article h4[id], article h5[id], article h6[id]",
|
173
173
|
);
|
174
|
+
|
174
175
|
headings.forEach((heading) => {
|
175
|
-
const headingLevel = parseInt(heading.tagName.substring(1));
|
176
|
+
const headingLevel = parseInt(heading.tagName.substring(1));
|
176
177
|
|
177
178
|
// Adjust the stack to match the heading level
|
178
179
|
while (headingLevel > currentLevel) {
|
@@ -28,6 +28,6 @@ class Config(AppConfig):
|
|
28
28
|
|
29
29
|
## Add anchored pillcrows to headings in designated pages
|
30
30
|
anchor_inserter = AnchorInserter(
|
31
|
-
root="
|
31
|
+
root=".//article", targets=".//h1 | .//h2 | .//h3 | .//h4 | .//h5 | .//h6"
|
32
32
|
)
|
33
33
|
HTMLProcessingMiddleware.add_transformer(anchor_inserter)
|
@@ -62,7 +62,10 @@ class BasePage(Page):
|
|
62
62
|
@property
|
63
63
|
def preview_data(self) -> dict[str, Any]:
|
64
64
|
"""Return a dictionary of data used in previewing this page type."""
|
65
|
-
return {
|
65
|
+
return {
|
66
|
+
"title": self.seo_title or self.title,
|
67
|
+
"summary": f"<p>{self.search_description}</p>",
|
68
|
+
}
|
66
69
|
|
67
70
|
def get_publication_data(self, request: HttpRequest | None = None) -> dict[str, str]:
|
68
71
|
"""Helper method to calculate and format relevant dates for previews."""
|
@@ -14,6 +14,8 @@
|
|
14
14
|
@font-face { font-family: 'Zilla Slab Highlight'; src: url("{% static 'fonts/ZillaSlabHighlight-Bold.ttf' %}") format("truetype"); font-weight: 700; font-style: normal; }
|
15
15
|
@font-face { font-family: 'Bitter'; src: url("{% static 'fonts/Bitter-Light.ttf' %}") format("truetype"); font-weight: 300; font-style: normal; }
|
16
16
|
@font-face { font-family: 'Bitter'; src: url("{% static 'fonts/Bitter-LightItalic.ttf' %}") format("truetype"); font-weight: 300; font-style: italic; }
|
17
|
+
@font-face { font-family: 'Bitter'; src: url("{% static 'fonts/Bitter-Bold.ttf' %}") format("truetype"); font-weight: 700; font-style: normal; }
|
18
|
+
@font-face { font-family: 'Bitter'; src: url("{% static 'fonts/Bitter-BoldItalic.ttf' %}") format("truetype"); font-weight: 700; font-style: italic; }}
|
17
19
|
@font-face { font-family: 'Fira Code'; src: url("{% static 'fonts/FiraCode-Light.ttf' %}") format("truetype"); font-weight: 300; font-style: normal; }
|
18
20
|
@font-face { font-family: 'Fira Code'; src: url("{% static 'fonts/FiraCode-SemiBold.ttf' %}") format("truetype"); font-weight: 600; font-style: normal; }
|
19
21
|
</style>
|
@@ -121,7 +123,7 @@
|
|
121
123
|
{% block content %}{% endblock %}
|
122
124
|
</main>
|
123
125
|
|
124
|
-
<footer>
|
126
|
+
<footer class="footer">
|
125
127
|
<div>
|
126
128
|
<p>© 2024 Ada Wright</p>
|
127
129
|
</div>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"""Filter to wrap the last two words of text in a span which prevents word-wrapping."""
|
2
|
+
|
3
|
+
from html.parser import HTMLParser
|
4
|
+
|
5
|
+
from django import template
|
6
|
+
from django.utils.html import escape
|
7
|
+
from django.utils.safestring import mark_safe
|
8
|
+
|
9
|
+
register = template.Library()
|
10
|
+
|
11
|
+
|
12
|
+
class KillOrphansParser(HTMLParser):
|
13
|
+
"""Parser that wraps the last two words of visible text in a span tag."""
|
14
|
+
|
15
|
+
result: list[str]
|
16
|
+
text_chunks: list[str]
|
17
|
+
|
18
|
+
def __init__(self) -> None:
|
19
|
+
"""Initialize the parser and result containers."""
|
20
|
+
super().__init__()
|
21
|
+
self.result = []
|
22
|
+
self.text_chunks = []
|
23
|
+
|
24
|
+
def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
|
25
|
+
"""Handle start tags and store them."""
|
26
|
+
start_tag_text = self.get_starttag_text()
|
27
|
+
if start_tag_text is not None:
|
28
|
+
self.result.append(start_tag_text)
|
29
|
+
|
30
|
+
def handle_endtag(self, tag: str) -> None:
|
31
|
+
"""Handle end tags and store them."""
|
32
|
+
self.result.append(f"</{tag}>")
|
33
|
+
|
34
|
+
def handle_data(self, data: str) -> None:
|
35
|
+
"""Handle text data and store it."""
|
36
|
+
self.text_chunks.append(data)
|
37
|
+
self.result.append(data)
|
38
|
+
|
39
|
+
def get_wrapped_html(self) -> str:
|
40
|
+
"""Return HTML with the last two words wrapped in a span."""
|
41
|
+
full_text = "".join(self.text_chunks)
|
42
|
+
words = full_text.split()
|
43
|
+
|
44
|
+
if len(words) < 2: # noqa: PLR2004
|
45
|
+
return "".join(self.result)
|
46
|
+
|
47
|
+
wrapped_words = (
|
48
|
+
" ".join(words[:-2])
|
49
|
+
+ f' <span class="whitespace-nowrap">{escape(" ".join(words[-2:]))}</span>'
|
50
|
+
)
|
51
|
+
|
52
|
+
return mark_safe( # noqa: S308
|
53
|
+
"".join(wrapped_words if chunk in full_text else chunk for chunk in self.result)
|
54
|
+
)
|
55
|
+
|
56
|
+
|
57
|
+
@register.filter
|
58
|
+
def killorphans(value: str) -> str:
|
59
|
+
"""Wrap the last two words of visible text in a span tag."""
|
60
|
+
parser = KillOrphansParser()
|
61
|
+
parser.feed(value)
|
62
|
+
return parser.get_wrapped_html()
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"""
|
1
|
+
"""Filter to transform Python types into human-readable strings."""
|
2
2
|
|
3
3
|
from django import template
|
4
4
|
|
@@ -8,7 +8,10 @@ register = template.Library()
|
|
8
8
|
@register.filter
|
9
9
|
def stringify(value: list, quote_style: str | None = None) -> str:
|
10
10
|
"""Convert a list of strings into a human-readable string with optional quoting."""
|
11
|
-
if not
|
11
|
+
if not value:
|
12
|
+
return ""
|
13
|
+
|
14
|
+
if not (isinstance(value, list | set | tuple)):
|
12
15
|
raise TypeError("The 'stringify' filter currently only supports lists.")
|
13
16
|
|
14
17
|
quote = "'" if quote_style == "single" else '"' if quote_style == "double" else ""
|
@@ -9,6 +9,7 @@
|
|
9
9
|
@layer base
|
10
10
|
body
|
11
11
|
@apply text-base font-serif font-light
|
12
|
+
|
12
13
|
h1, h2, h3, h4, h5, h6
|
13
14
|
@apply font-heading font-normal
|
14
15
|
&:not(:first-child)
|
@@ -26,7 +27,9 @@
|
|
26
27
|
h6
|
27
28
|
@apply text-sm leading-relaxed
|
28
29
|
strong, b
|
29
|
-
@apply font-
|
30
|
+
@apply font-bold
|
31
|
+
em, i
|
32
|
+
@apply italic
|
30
33
|
code, pre
|
31
34
|
@apply font-mono font-light
|
32
35
|
&.strong
|
@@ -34,7 +37,6 @@
|
|
34
37
|
.highlight
|
35
38
|
@apply font-highlight font-bold
|
36
39
|
|
37
|
-
|
38
40
|
// Main page layout
|
39
41
|
html
|
40
42
|
scroll-behavior: smooth
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|