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