]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/wikitrails/discussion.mdwn
revisiting with implementation experience
[ikiwiki.git] / doc / todo / wikitrails / discussion.mdwn
1 This sounds like a more general version of what I want for
2 one-photo-per-page galleries, where each page has previous|up|next links
3 (like this plugin) and the index page has a list or grid of thumbnails
4 (\[[!inline]] with a specially modified template perhaps). I'll watch this
5 with interest! --[[smcv]]
6
7 ----
8
9 This is a nice idea, I do have my gripes about the imeplementation.
10
11 Assuming that the index's list is in mdwn format is not ideal. I guess the
12 other way to do it would be to make the index be a directive, something
13 like: \[[!trail pages="foo bar baz"]]. Assuming that a flat trail structure
14 is enough, otherwise you'd have to get more fancy.
15
16 The trailinclude seems a bit redundant with inline, and wanting to inline
17 together all pages in a trail for printing or whatever seems like an
18 unusual use case anyway?
19
20 The !trail directive could be simplified to just \[[!trail my_indexpage]].
21 But I wonder if needing to add this directive to every page is the best
22 approach. Alternate approach would be to make the trail index cause 
23 breadcrums to be automatically inserted at the top of every page on the
24 trail. (You'd have to use a directive to define the index for that to work.)
25
26 --[[Joey]]
27
28 ----
29
30 Revisiting this, after effectively reimplementing a small version of it
31 in [[plugins/contrib/album]]: it occurs to me that might be a more
32 "ikiwiki-like" way we could get this functionality.
33
34 In the index page, you either want an [[ikiwiki/directive/inline]], or
35 a list of links. In the former case, maybe we could extend inline like
36 this:
37
38     \[[!inline ... blah blah ... trail=yes]]
39
40 to make it remember the pages it inlined, in order, in the pagestate;
41 in the latter case, we could replace the wikilinks with a directive,
42 an operation something like this in diff notation:
43
44     - [[one]] - the unit
45     - [[two]] - the base of binary
46     - [[three|3]] - is a crowd
47     + \[[!trailitem one]] - the unit
48     + \[[!trailitem two]] - the base of binary
49     + \[[!trailitem three|3]] - is a crowd
50
51 and have that directive remember the pages in order.
52
53 In both cases, a scan() hook could clear the list before starting to
54 scan, then the inline or trailitem preprocessor directive could run in
55 the scan stage as well as the render stage (in the case of inline,
56 there'd be a very early return if trail=yes was not given, and
57 an early return after collecting and sorting the pages if not
58 actually rendering).
59
60 This would mean that the contents of the trail, and a list of
61 trails in which each page can be found, would already be in
62 the pagestate by the time any page was rendered, so we'd be able
63 to use them for output, either in a pagetemplate() hook or
64 a \[[!trail]] preprocessor directive.
65
66 This way, my album plugin could be turned inside out: instead
67 of precomputing the pages to be inlined, then using
68 [[pagenames|todo/inline plugin: specifying ordered page names]]
69 to get them into the inline, it could just do the inline, then
70 incorporate the output of \[[!trail]] into the template rendered
71 for \[[!albumimage]] on each viewer page. (Also, the viewers
72 wouldn't necessarily need to reference the album, only the other
73 way round.)
74
75 Using a pagetemplate() hook to stuff the next/previous links
76 into page.tmpl would actually be a bit unfortunate for \[[!album]],
77 because that plugin definitely wants to style the next/previous
78 links as a thumbnail, which means there'd have to be a way to
79 affect the style - perhaps by arranging for album's pagetemplate
80 hook to run *after* trail's, or perhaps by having trail's
81 pagetemplate hook disable itself for pages that contain
82 a \[[!trail]] directive.
83
84 Does this sound viable? Should I think about implementing it?
85 --[[smcv]]