picata 0.0.4__tar.gz → 0.0.5__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. {picata-0.0.4 → picata-0.0.5}/PKG-INFO +1 -1
  2. {picata-0.0.4 → picata-0.0.5}/entrypoint.tsx +4 -3
  3. {picata-0.0.4 → picata-0.0.5}/picata/apps.py +1 -1
  4. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/base.html +3 -1
  5. picata-0.0.5/picata/templatetags/kill_orphans.py +62 -0
  6. {picata-0.0.4 → picata-0.0.5}/picata/templatetags/stringify.py +5 -2
  7. {picata-0.0.4 → picata-0.0.5}/pyproject.toml +1 -1
  8. {picata-0.0.4 → picata-0.0.5}/styles.sass +4 -2
  9. {picata-0.0.4 → picata-0.0.5}/.gitignore +0 -0
  10. {picata-0.0.4 → picata-0.0.5}/LICENSE.md +0 -0
  11. {picata-0.0.4 → picata-0.0.5}/README.md +0 -0
  12. {picata-0.0.4 → picata-0.0.5}/components/HelloWorld.tsx +0 -0
  13. {picata-0.0.4 → picata-0.0.5}/manage.py +0 -0
  14. {picata-0.0.4 → picata-0.0.5}/picata/__init__.py +0 -0
  15. {picata-0.0.4 → picata-0.0.5}/picata/blocks.py +0 -0
  16. {picata-0.0.4 → picata-0.0.5}/picata/helpers/__init__.py +0 -0
  17. {picata-0.0.4 → picata-0.0.5}/picata/helpers/wagtail.py +0 -0
  18. {picata-0.0.4 → picata-0.0.5}/picata/log_utils.py +0 -0
  19. {picata-0.0.4 → picata-0.0.5}/picata/middleware.py +0 -0
  20. {picata-0.0.4 → picata-0.0.5}/picata/migrations/0001_initial.py +0 -0
  21. {picata-0.0.4 → picata-0.0.5}/picata/migrations/__init__.py +0 -0
  22. {picata-0.0.4 → picata-0.0.5}/picata/models.py +0 -0
  23. {picata-0.0.4 → picata-0.0.5}/picata/settings/__init__.py +0 -0
  24. {picata-0.0.4 → picata-0.0.5}/picata/settings/base.py +0 -0
  25. {picata-0.0.4 → picata-0.0.5}/picata/settings/dev.py +0 -0
  26. {picata-0.0.4 → picata-0.0.5}/picata/settings/mypy.py +0 -0
  27. {picata-0.0.4 → picata-0.0.5}/picata/settings/prod.py +0 -0
  28. {picata-0.0.4 → picata-0.0.5}/picata/settings/test.py +0 -0
  29. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/ada-profile.jpg +0 -0
  30. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/ada-social-bear.jpg +0 -0
  31. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/favicon.ico +0 -0
  32. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/fonts/Bitter-Light.ttf +0 -0
  33. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/fonts/Bitter-LightItalic.ttf +0 -0
  34. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/fonts/FiraCode-Light.ttf +0 -0
  35. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/fonts/FiraCode-SemiBold.ttf +0 -0
  36. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/fonts/Sacramento-Regular.ttf +0 -0
  37. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/fonts/ZillaSlab-Bold.ttf +0 -0
  38. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/fonts/ZillaSlab-BoldItalic.ttf +0 -0
  39. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/fonts/ZillaSlab-Light.ttf +0 -0
  40. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/fonts/ZillaSlab-LightItalic.ttf +0 -0
  41. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/fonts/ZillaSlabHighlight-Bold.ttf +0 -0
  42. {picata-0.0.4 → picata-0.0.5}/picata/static/picata/icons.svg +0 -0
  43. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/3_column.html +0 -0
  44. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/404.html +0 -0
  45. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/500.html +0 -0
  46. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/_post_list.html +0 -0
  47. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/article.html +0 -0
  48. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/basic_page.html +0 -0
  49. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/blocks/icon_link_item.html +0 -0
  50. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/blocks/icon_link_list.html +0 -0
  51. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/blocks/icon_link_list_stream.html +0 -0
  52. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/dl_view.html +0 -0
  53. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/home_page.html +0 -0
  54. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/post_listing.html +0 -0
  55. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/previews/3col.html +0 -0
  56. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/previews/dl.html +0 -0
  57. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/previews/split.html +0 -0
  58. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/previews/theme_gallery.html +0 -0
  59. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/search_results.html +0 -0
  60. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/split_view.html +0 -0
  61. {picata-0.0.4 → picata-0.0.5}/picata/templates/picata/tags/site_menu.html +0 -0
  62. {picata-0.0.4 → picata-0.0.5}/picata/templatetags/__init__.py +0 -0
  63. {picata-0.0.4 → picata-0.0.5}/picata/templatetags/absolute_static.py +0 -0
  64. {picata-0.0.4 → picata-0.0.5}/picata/templatetags/menu_tags.py +0 -0
  65. {picata-0.0.4 → picata-0.0.5}/picata/transformers.py +0 -0
  66. {picata-0.0.4 → picata-0.0.5}/picata/typing/__init__.py +0 -0
  67. {picata-0.0.4 → picata-0.0.5}/picata/typing/wagtail.py +0 -0
  68. {picata-0.0.4 → picata-0.0.5}/picata/urls.py +0 -0
  69. {picata-0.0.4 → picata-0.0.5}/picata/validators.py +0 -0
  70. {picata-0.0.4 → picata-0.0.5}/picata/views.py +0 -0
  71. {picata-0.0.4 → picata-0.0.5}/picata/wagtail_hooks.py +0 -0
  72. {picata-0.0.4 → picata-0.0.5}/picata/wsgi.py +0 -0
  73. {picata-0.0.4 → picata-0.0.5}/pygments.sass +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: picata
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Ada's Wagtail-based CMS & blog
5
5
  Project-URL: Documentation, https://github.com/hipikat/picata#readme
6
6
  Project-URL: Issues, https://github.com/hipikat/picata/issues
@@ -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)); // Extract the heading level (e.g., "1" for "H1")
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="//main/article", targets=".//h1 | .//h2 | .//h3 | .//h4 | .//h5 | .//h6"
31
+ root=".//article", targets=".//h1 | .//h2 | .//h3 | .//h4 | .//h5 | .//h6"
32
32
  )
33
33
  HTMLProcessingMiddleware.add_transformer(anchor_inserter)
@@ -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>&copy; 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
- """Template tags to transform Python types into human-readable strings."""
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 isinstance(value, list):
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,7 +9,7 @@ build-backend = "hatchling.build"
9
9
 
10
10
  [project]
11
11
  name = "picata"
12
- version = "0.0.4"
12
+ version = "0.0.5"
13
13
  description = "Ada's Wagtail-based CMS & blog"
14
14
  keywords = ["cms", "blog", "django", "wagtail"]
15
15
  readme = "README.md"
@@ -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-serif font-bold
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