]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/pedigree_plugin.mdwn
Merge branch 'master' of git://git.ikiwiki.info
[ikiwiki.git] / doc / todo / pedigree_plugin.mdwn
1 After realizing (thanks to
2 [[Allow_TITLE_to_include_part_of_the_path_in_addition_to_the_basename]])
3 that I needed some kind of "parentlinks on steroids", I wrote a new
4 plugin, called pedigree.
5
6 This plugin provides a bunch of loops that one can use in his/her
7 `HTML::Template`'s to iterate over all or a subset of a page's
8 parents. Inside these loops, half a dozen variables are made
9 available, in addition to `PAGE` and `URL` that are already provided
10 by parentlinks.
11
12 Amongst many possibilities, one can e.g. simply use this plugin to
13 give every parent link a different `class=` attribute, depending
14 either on its depth in the path leading to the current page, or on its
15 distance to it.
16
17 The code and documentation (including simple and complex usage
18 examples) are in the 'pedigree' Git branch in this repo:
19
20         git://repo.or.cz/ikiwiki/intrigeri.git
21
22 Seems there is also a [gitweb](http://repo.or.cz/w/ikiwiki/intrigeri.git).
23
24 > Ok, I'll take a look. BTW, could you allow user joey on repo.or.cz
25 > push access to the main ikiwiki repo you set up there? --[[Joey]]
26
27 >> I did not. The main ikiwiki repo on repo.or.cz seems to have been
28 >> been setup by johannes.schindelin@gmx.de ; mine is what they call
29 >> a "fork" (but it's not, obviously).
30
31 Any opinions on the idea/design/implementation?
32
33 > Seems that there should be a more generic way to do `PEDIGREE_BUT_ROOT`
34 > and `PEDIGREE_BUT_TWO_OLDEST` (also `is_second_ancestor`,
35 > `is_grand_mother` etc). One way would be to include in `PEDIGREE`
36 > a set of values like `depth_1`, `depth_2`, etc. The one corresponding
37 > to the `absdepth` would be true. This would allow a template like this:
38
39         <TMPL_LOOP NAME="PEDIGREE">
40           <TMPL_IF NAME="depth_1">
41             </TMPL_ELSE>
42             <TMPL_IF NAME="depth_2">
43             </TMPL_ELSE>
44               <TMPL_VAR PAGE> /* only showing pages 2 levels deep */
45             </TMPL_IF>
46           </TMPL_IF>
47         </TMPL_LOOP>
48
49 > The only missing information would be `reldepth`, but in the above
50 > example the author of that template knows that it's `absdepth - 1`
51 > (Things would be a lot nicer if `HTML::Template` had equality tests!)
52
53 > Since this would make it more generic and also fix your one documented
54 > bug, I can see no reason not to do it. ;-) --[[Joey]]
55
56 >> Thanks for your comments. I'll answer soon. (Grrr, I really
57 >> need to find a way to edit this wiki offline, every minute
58 >> online costs bucks to me, my old modem gently weeps,
59 >> and I hate webbrowsers.) -- intrigeri
60
61 (I'll try never to rebase this branch, but writing this plugin has
62 been a pretext for me to start learning Git, so...)
63
64 To finish with, it seems no plugin bundled with ikiwiki uses the current
65 parentlinks implementation, so one could event think of moving it from the
66 core to this plugin (which should then be enabled by default, since the
67 default templates do use parentlinks ;).
68
69 > I think that moving parentlinks out to a plugin is a good idea.
70 > However, if it's done, I think the plugin should be named parentlinks,
71 > and should continue to use the same template variables as are used now,
72 > to avoid needing to change custom templates. Pedigree is a quite nice
73 > name, but renaming it to parentlinks seems to be the way to go to me.
74 > --[[Joey]]
75
76 >> Agreed. -- intrigeri