]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/bugs/trailitems_fails_inside_template.mdwn
Add ikistrap plugin for ikistrap theme.
[git.ikiwiki.info.git] / doc / bugs / trailitems_fails_inside_template.mdwn
1 In my wiki I have a template page under `/templates` that looks like this:
3     \[[!inline                                                                       
4           pages="<TMPL_VAR PAGE>/* and !<TMPL_VAR PAGE>/*/*"                    
5           show=0                                                                
6           template=titlepage                                                    
7           feeds=no                                                              
8           sort=title]]                                                          
9                                                                                     
10     \[[!trailitems                                                                   
11               pages="<TMPL_VAR PAGE>/* and !<TMPL_VAR PAGE>/*/*"                
12               sort=title]]
14 I tested this page with many variations and by trial and error reached a conclusion that
15 when using `trailitems` with a path that contains TMPL_VAR, or using the inline directive
16 with `trail=yes` and a `pages` that contains TMPL_VAR, the trail plugin (or something else?)
17 seems to not resolve the TMPL_VAR and ikiwiki fails to compile the wiki, and I get this:
19     syntax error in pagespec "<TMPL_VAR PAGE>/* and !<TMPL_VAR PAGE>/*/*"
21 on the command line.
23 Until I get feedback here I'll try to look at the source and see if I figure it out.
24 My ikiwiki version: 3.20130904
26 Huge thanks in advance!
28 --[[fr33domlover]]
30 > These templates have traditionally had a problem: they need to be
31 > simultaneously a valid page in their own right, and a valid page after
32 > template substitutions.
33 >
34 > In newer ikiwiki versions, the [[ikiwiki/directive/templatebody]]
35 > directive [[solves this|done]] ... but your ikiwiki is nearly a year
36 > and a half old, so you don't have recent bugfixes.
37 >
38 > You might be able to get somewhere by abusing the two intersecting
39 > markup languages, something like this:
40 >
41 >     <TMPL_IF FALSE>
42 >     \[[!if test="included() and !included()" then="""
43 >     </TMPL_IF>
44 >     ... real content here: inline, trailitems etc. ...
45 >     ... just don't use a triple quote mark ...
46 >     <TMPL_IF FALSE>
47 >     """]]
48 >     </TMPL_IF>
49 >
50 > Alternatively, if you have direct commit access and don't need
51 > to be able to perform web-based edits on your template, I think
52 > renaming your template from `foo.mdwn` to `foo.tmpl` would bypass
53 > this while still working as a template. --[[smcv]]