aboutsummaryrefslogtreecommitdiff
path: root/doc/plugins/contrib/trail.mdwn
blob: bfd4d3d0b79df7b60e316c67ce66f9e8ecf4aa64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
[[!tag patch]]
[[!template id=gitbranch branch=smcv/trail3 author="[[smcv]]"]]

Available from [[smcv]]'s git repository, in the `trail3` branch. This
plugin aims to solve [[todo/wikitrails]] in a simpler way; it can also be
used for [[navigation through blog posts|todo/Pagination_next_prev_links]].

If you don't want to use a branch of ikiwiki, manual installation requires
these files (use the "raw" link in gitweb to download):

* [trail.pm](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/IkiWiki/Plugin/trail.pm)
  in an `IkiWiki/Plugin` subdirectory of your configured `plugindir`
* [page.tmpl](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/templates/page.tmpl)
  and
  [trails.tmpl](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/templates/trails.tmpl)
  in your configured `templatedir`, or a `templates` subdirectory of your wiki repository
* the trail-related bits from the end of the
  [stylesheet](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/doc/style.css)
  (put them in your local.css)
* the trail-related bits at the end of the
  [actiontabs](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/themes/actiontabs/style.css)
  or [blueview/goldtype](http://git.pseudorandom.co.uk/smcv/ikiwiki.git/blob/trail3:/themes/blueview/style.css)
  stylesheets, if you use one of those themes (again, put them in your local.css)

The branch also includes [[todo/test_coverage]] machinery.

Demo:

* [in use on entries in my blog](http://smcv.pseudorandom.co.uk/)
* [a demo trail based on links](http://demo.hosted.pseudorandom.co.uk/trail/)
* [a demo hybrid trail/inline](http://demo.hosted.pseudorandom.co.uk/trail2/)

The page `e` is in both demo trails, to demonstrate how a page in more than
one trail looks.

The `smcv/trail2` branch is an older version of `trail3` which used typed links
as its data structure, resulting in timing-related limitations (it couldn't
select pages for the trail by using pagespecs, because pagespecs can't be
evaluated correctly until the scan stage has finished).

Updated, November 2011:

* reinstated `inline` integration ([[report]] integration would probably be
  pretty easy too, if this gets merged)
* switched from typed links back to a custom data structure to avoid
  chicken/egg problems with ordering
* create typed links too, as a side-effect, but not when using an inline
* regression test with nearly full coverage
* CSS for the default anti-theme and all built-in themes (it looks nicest
  in the default anti-theme and in actiontabs - the demo uses actiontabs)

Known bugs:

* the blueview and goldtype CSS nearly work, but the alignment is a bit off

----

[[!template id=plugin name=trail author="[[Simon_McVittie|smcv]]"]]
[[!tag type/chrome]]

This plugin provides the [[ikiwiki/directive/trailoptions]],
[[ikiwiki/directive/traillink]], [[ikiwiki/directive/trailitem]],
[[ikiwiki/directive/trailitems]]
and [[ikiwiki/directive/trailinline]] [[directives|ikiwiki/directive]].

It's sometimes useful to have "trails" of pages in a wiki where each
page links to the next and/or previous page. For instance, you could use
this for a guided tour, sequence of chapters, or sequence of blog posts.

In this plugin, a trail is represented by a page, and the pages in the
trail are indicated by specially marked links within that page, or by
including groups of pages with a [[ikiwiki/directive]].

If using the default `page.tmpl`, each page automatically displays the
trails that it's a member of (if any), with links to the trail and to
the next and previous members. HTML `<link>` tags with the `prev`,
`next` and `up` relations are also generated.

The [[ikiwiki/directive/trailoptions]] directive sets options for the
entire trail.

Pages can be included in a trail in various ways:

* The [[ikiwiki/directive/trailinline]] directive sets up an [[inline]],
  and at the same time adds the matching pages (from `pages` or `pagenames`)
  to the trail. One use is to navigate through all posts in a blog:

        \[[!trailinline pages="page(./posts/*) and !*/Discussion" archive=yes
          feedshow=10 quick=yes]]

  This directive only works if the [[!iki plugins/inline desc=inline]]
  plugin is also enabled.

* The [[ikiwiki/directive/trailitems]] directive has optional `pages` and
  `pagenames` options which behave the same as in [[inline]], but don't
  produce any output in the page, so you can have trails that don't list
  all their pages.

* The [[ikiwiki/directive/traillink]] directive makes a visible link
  and also adds the linked page to the trail. This will typically be
  used in a bullet list, but could also be in paragraph text:

        * [[!traillink Introduction]]
        * [[!traillink "Chapter 1"]]
        * [[!traillink Chapter_2]]
        * [[!traillink Appendix_A]]

  or

        To use this software you must \[[!traillink install]] it,
        \[[!traillink configuration text="configure it"]],
        and finally \[[!traillink running|run_it]].

  This also counts as a [[ikiwiki/WikiLink]] for things like the `link()`
  [[ikiwiki/PageSpec]] item.

* The [[ikiwiki/directive/trailitem]] directive adds a page to the trail
  like `traillink`, but produces an invisible link, rather like `\[[!tag]]`:

        To use this software you must \[[!traillink install]] it,
        \[[!trailitem installing_from_packages]]
        \[[!trailitem installing_from_source]]
        \[[!traillink configuration text="configure it"]],
        and finally \[[!traillink running|run_it]].
        \[[!trailitem troubleshooting]]

  Like `\[[!tag]]`, this still counts as a [[ikiwiki/WikiLink]] even though
  there's no visible link.

You can mix several of these directives in one page. The resulting
trail will contain all of the pages matched by any of the directives,
in the same order that the directives appear (unless you use the `sort` or
`reverse` options on `\[[!trailoptions]]`).