Skip to content

Commit 8432a24

Browse files
committed
fix: Escape XKCD title and alt text
Otherwise the SVG can be become invalid... ``` "Applying renormalization to bullies successfully transformed Pete & Pete's Endless Mike into Finite Mike." ``` needs to be escaped to ``` Pete & Pete's Endless Mike into Finite Mike. ```
1 parent fcf16ed commit 8432a24

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/custom_processing/templates/main.svg.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
<!-- XKCD Info -->
1111
<text x="105" y="80" font-family="Arial" font-size="10" font-weight="bold" fill="#333" text-anchor="middle">Latest XKCD:</text>
12-
<text x="105" y="95" font-family="Arial" font-size="10" fill="#333" text-anchor="middle">{{ xkcd.title }}</text>
12+
<text x="105" y="95" font-family="Arial" font-size="10" fill="#333" text-anchor="middle">{{ xkcd.title|e }}</text>
1313
<text x="105" y="110" font-family="Arial" font-size="6" fill="#666" text-anchor="middle">Fetched at: {{ xkcd.fetched_at }}</text>
1414

1515
<!-- XKCD Image -->
1616
<image x="20" y="120" width="170" height="120" xlink:href="{{ xkcd.image_data }}"/>
1717

1818
<!-- Centered Alt Text (Pre-wrapped in Python) -->
1919
{% for line in xkcd.alt_text_lines %}
20-
<text x="105" y="{{ 260 + loop.index0 * 8 }}" font-family="Arial" font-size="5" fill="#666" text-anchor="middle">{{ line }}</text>
20+
<text x="105" y="{{ 260 + loop.index0 * 8 }}" font-family="Arial" font-size="5" fill="#666" text-anchor="middle">{{ line|e }}</text>
2121
{% endfor %}
2222
</svg>

0 commit comments

Comments
 (0)