Skip to main content

Add a snippet with a Cog SVG template

ID
27493f4
date
2026-04-19 16:46:19+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
f16fc92
message
Add a snippet with a Cog SVG template
changed files
2 files, 18 additions

Changed files

create_snippets.py (8467) → create_snippets.py (8508)

diff --git a/create_snippets.py b/create_snippets.py
index a48dbee..909c1d6 100755
--- a/create_snippets.py
+++ b/create_snippets.py
@@ -241,6 +241,7 @@ SNIPPETS = {
 
     "!rect": '<rect width="500" height="250" fill="yellow"/>',
     "!svg": read("template.svg"),
+    "!cogsvg": read("cog_template.svg"),
 
     "!before": read("before_and_after.html"),
 

expansions/cog_template.svg (0) → expansions/cog_template.svg (512)

diff --git a/expansions/cog_template.svg b/expansions/cog_template.svg
new file mode 100644
index 0000000..2aaee0e
--- /dev/null
+++ b/expansions/cog_template.svg
@@ -0,0 +1,17 @@
+<!--[[[cog
+  import cog
+
+  WIDTH = HEIGHT = 200
+  
+  cog.outl(
+    f'<svg viewBox="0 0 {WIDTH} {HEIGHT}" '
+    f'width="{WIDTH}" '
+    'xmlns="http://www.w3.org/2000/svg" '
+    'xmlns:xlink="http://www.w3.org/1999/xlink">')
+
+  cog.outl(f'<rect width="{WIDTH}" height="{HEIGHT}" fill="yellow"/>')
+]]]-->
+<svg viewBox="0 0 200 200" width="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<rect width="200" height="200" fill="yellow"/>
+<!-- [[[end]]] (sum: 4i1/9ccOfz) -->
+</svg>