sorting is now sane
[ikiwiki.git] / doc / plugins / contrib / trail.mdwn
1 [[!tag patch]]
2 [[!template id=gitbranch branch=smcv/trail3 author="[[smcv]]"]]
3
4 Available from [[smcv]]'s git repository, in the `trail3` branch. This
5 plugin aims to solve [[todo/wikitrails]] in a simpler way; it can also be
6 used for [[navigation through blog posts|todo/Pagination_next_prev_links]].
7
8 If you don't want to use a branch of ikiwiki, manual installation requires
9 these files (use the "raw" link in gitweb to download):
10
11 * [trail.pm](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/IkiWiki/Plugin/trail.pm)
12   in an `IkiWiki/Plugin` subdirectory of your configured `plugindir`
13 * [page.tmpl](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/templates/page.tmpl)
14   and
15   [trails.tmpl](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/templates/trails.tmpl)
16   in your configured `templatedir`, or a `templates` subdirectory of your wiki repository
17 * the trail-related bits from the end of the
18   [stylesheet](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/doc/style.css)
19   (put them in your local.css)
20 * the trail-related bits at the end of the
21   [actiontabs](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/themes/actiontabs/style.css)
22   or [blueview/goldtype](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/themes/blueview/style.css)
23   stylesheets, if you use one of those themes (again, put them in your local.css)
24
25 The branch also includes [[todo/test_coverage]] machinery.
26
27 Demo:
28
29 * [in use on entries in my blog](http://smcv.pseudorandom.co.uk/)
30 * [a demo trail based on links](http://demo.hosted.pseudorandom.co.uk/trail/)
31 * [a demo hybrid trail/inline](http://demo.hosted.pseudorandom.co.uk/trail2/)
32
33 The page `e` is in both demo trails, to demonstrate how a page in more than
34 one trail looks.
35
36 The `smcv/trail2` branch is an older version of `trail3` which used typed links
37 as its data structure, resulting in timing-related limitations (it couldn't
38 select pages for the trail by using pagespecs, because pagespecs can't be
39 evaluated correctly until the scan stage has finished).
40
41 Updated, November 2011:
42
43 * reinstated `inline` integration ([[report]] integration would probably be
44   pretty easy too, if this gets merged)
45 * switched from typed links back to a custom data structure to avoid
46   chicken/egg problems with ordering
47 * create typed links too, as a side-effect, but not when using an inline
48 * regression test with nearly full coverage
49 * CSS for the default anti-theme and all built-in themes (it looks nicest
50   in the default anti-theme and in actiontabs - the demo uses actiontabs)
51
52 Known bugs:
53
54 * the blueview and goldtype CSS nearly work, but the alignment is a bit off
55
56 ----
57
58 [[!template id=plugin name=trail author="[[Simon_McVittie|smcv]]"]]
59 [[!tag type/chrome]]
60
61 This plugin provides the [[ikiwiki/directive/trailoptions]],
62 [[ikiwiki/directive/traillink]], [[ikiwiki/directive/trailitem]],
63 [[ikiwiki/directive/trailitems]]
64 and [[ikiwiki/directive/trailinline]] [[directives|ikiwiki/directive]].
65
66 It's sometimes useful to have "trails" of pages in a wiki where each
67 page links to the next and/or previous page. For instance, you could use
68 this for a guided tour, sequence of chapters, or sequence of blog posts.
69
70 In this plugin, a trail is represented by a page, and the pages in the
71 trail are indicated by specially marked links within that page, or by
72 including groups of pages with a [[ikiwiki/directive]].
73
74 If using the default `page.tmpl`, each page automatically displays the
75 trails that it's a member of (if any), with links to the trail and to
76 the next and previous members. HTML `<link>` tags with the `prev`,
77 `next` and `up` relations are also generated.
78
79 The [[ikiwiki/directive/trailoptions]] directive sets options for the
80 entire trail.
81
82 Pages can be included in a trail in various ways:
83
84 * The [[ikiwiki/directive/trailinline]] directive sets up an [[inline]],
85   and at the same time adds the matching pages (from `pages` or `pagenames`)
86   to the trail. One use is to navigate through all posts in a blog:
87
88         \[[!trailinline pages="page(./posts/*) and !*/Discussion" archive=yes
89           feedshow=10 quick=yes]]
90
91   This directive only works if the [[!iki plugins/inline desc=inline]]
92   plugin is also enabled.
93
94 * The [[ikiwiki/directive/trailitems]] directive has optional `pages` and
95   `pagenames` options which behave the same as in [[inline]], but don't
96   produce any output in the page, so you can have trails that don't list
97   all their pages.
98
99 * The [[ikiwiki/directive/traillink]] directive makes a visible link
100   and also adds the linked page to the trail. This will typically be
101   used in a bullet list, but could also be in paragraph text:
102
103         * [[!traillink Introduction]]
104         * [[!traillink "Chapter 1"]]
105         * [[!traillink Chapter_2]]
106         * [[!traillink Appendix_A]]
107
108   or
109
110         To use this software you must \[[!traillink install]] it,
111         \[[!traillink configuration text="configure it"]],
112         and finally \[[!traillink running|run_it]].
113
114   This also counts as a [[ikiwiki/WikiLink]] for things like the `link()`
115   [[ikiwiki/PageSpec]] item.
116
117 * The [[ikiwiki/directive/trailitem]] directive adds a page to the trail
118   like `traillink`, but produces an invisible link, rather like `\[[!tag]]`:
119
120         To use this software you must \[[!traillink install]] it,
121         \[[!trailitem installing_from_packages]]
122         \[[!trailitem installing_from_source]]
123         \[[!traillink configuration text="configure it"]],
124         and finally \[[!traillink running|run_it]].
125         \[[!trailitem troubleshooting]]
126
127   Like `\[[!tag]]`, this still counts as a [[ikiwiki/WikiLink]] even though
128   there's no visible link.
129
130 You can mix several of these directives in one page. The resulting
131 trail will contain all of the pages matched by any of the directives,
132 in the same order that the directives appear (unless you use the `sort` or
133 `reverse` options on `\[[!trailoptions]]`).