mixing template vars into directive arguments
authorhttp://jmtd.livejournal.com/ <http://jmtd.livejournal.com/@web>
Mon, 13 Sep 2010 19:37:50 +0000 (19:37 +0000)
committerJoey Hess <joey@kitenet.net>
Mon, 13 Sep 2010 19:37:50 +0000 (19:37 +0000)
doc/bugs/can__39__t_mix_template_vars_inside_directives.mdwn [new file with mode: 0644]

diff --git a/doc/bugs/can__39__t_mix_template_vars_inside_directives.mdwn b/doc/bugs/can__39__t_mix_template_vars_inside_directives.mdwn
new file mode 100644 (file)
index 0000000..0fa85ef
--- /dev/null
@@ -0,0 +1,33 @@
+I often find myself wrapping the same boiler plate around [[ikiwiki/directives/img]] img directives, so I tried to encapsulate it using the following [[ikiwiki/directives/template]]:
+
+
+    <div class="image">
+    [\[!img <TMPL_VAR raw_href>
+    size="<TMPL_VAR raw_size>"
+    
+    <TMPL_IF alt>
+      alt="<TMPL_VAR raw_alt>"
+    <TMPL_ELSE>
+      <TMPL_IF caption>
+        alt="<TMPL_VAR raw_alt>"
+      <TMPL_ELSE>
+        alt="[pic]"
+      </TMPL_IF>
+    </TMPL_IF>
+    
+    ]]
+    <TMPL_IF caption>
+    <p><TMPL_VAR raw_caption></p>
+    </TMPL_IF>
+    </div>
+
+The result, even with htmlscrubber disabled, is mangled, something like
+
+    <div class="image">
+    <span class="createlink"><a href="http://jmtd.net/cgi?
+        page=size&amp;from=log0.000000old_new_test&amp;do=create"
+        rel="nofollow">?</a>size</span>
+    
+    </div>
+
+Any suggestions gladly received. -- [[Jon]]