Skip to content

Commit bc7defd

Browse files
committed
Merge: Add trails to nitiwiki
Wikilinks, with the directive `trail`, will register the target page as an element of a trail. Each `trail` are chained together and will display navigational link `prev` for the previous page of the trail, `next` for the next page of the trail and `up` to go to the pages that has used the `trail` wikilink. For instance, if the page `doc.md` has the following content: ~~~md To use nitiwiki, first [[trail: install|install it]], then [[trail: simple_wiki|create a first wiki]]. You can also do advanced things like: * [[trail: github|editing pages with github]] * [[trail: templating| adapting the templates]] ~~~ A trail will be made and will consist of the sequence of pages `install`, `simple_wiki`, `github` and `templating`. On each one of these pages, there will be links for the previous, the next page and the `doc.md` pae. If a page includes trail wikilinks and is also the target for trail wikilinks, then the two trails are merged and pages will be visitable in a depth-first order. This nesting of trails can be used to have sections and sub-sections. Demo is up: http://info.uqam.ca/~privat/nitlanguage/manual/ Pull-Request: #1830 Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
2 parents af58279 + 011905e commit bc7defd

File tree

15 files changed

+130
-2
lines changed

15 files changed

+130
-2
lines changed

contrib/nitiwiki/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,29 @@ will appear like this: `Contact me!`.
174174

175175
You can link to an anchor inside a page, using something like `[[WikiLink#foo]]`.
176176

177+
#### Trails of Pages
178+
179+
Wikilinks, with the directive `trail`, will register the target page as an element of a trail.
180+
Each `trail` are chained together and will display navigational link `prev` for the previous page of the trail, `next` for the next page of the trail and `up` to go to the pages that has used the `trail` wikilink.
181+
182+
For instance, if the page `doc.md` has the following content:
183+
184+
~~~md
185+
To use nitiwiki, first [[trail: install|install it]],
186+
then [[trail: simple_wiki|create a first wiki]].
187+
188+
You can also do advanced things like:
189+
190+
* [[trail: github|editing pages with github]]
191+
* [[trail: templating| adapting the templates]]
192+
~~~
193+
194+
A trail will be made and will consist of the sequence of pages `install`, `simple_wiki`, `github` and `templating`.
195+
On each one of these pages, there will be links for the previous page, the next page and the `doc.md` page.
196+
197+
If a page includes trail wikilinks and is also the target for trail wikilinks, then the two trails are merged and pages will be visitable in a depth-first order.
198+
This nesting of trails can be used to have sections and sub-sections.
199+
177200
#### Render the wiki in HTML
178201

179202
Once you have done your changes, use:
@@ -243,7 +266,9 @@ The template file `template.html` represents the overall structure of your wiki
243266
%HEADER%
244267
%TOP_MENU%
245268
<div>
269+
%TRAIL%
246270
%BODY%
271+
%TRAIL%
247272
%FOOTER%
248273
</div>
249274
</body>
@@ -256,6 +281,7 @@ Additionnal macros:
256281
* `TOP_MENU`: Wiki top menu (see [Topmenu template](#Topmenu_template))
257282
* `HEADER`: Wiki header (see [Header template](#Header_template))
258283
* `BODY`: Wiki body content
284+
* `TRAIL`: content of the trail navigational links, if any (see [Trails of Pages](#Trails_of_Pages))
259285

260286
### Header template
261287

contrib/nitiwiki/examples/default/templates/template.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
%HEADER%
99
%TOP_MENU%
1010
<div>
11+
%TRAIL%
1112
%BODY%
13+
%TRAIL%
1214
%FOOTER%
1315
</div>
1416
</body>

contrib/nitiwiki/examples/nitiwiki/assets/css/main.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,17 @@ footer {
2828
.summary li li li { font-size: 12px; font-weight: normal }
2929

3030
.breadcrumb { margin-top: 20px; }
31+
32+
.trail {
33+
list-style-type: none;
34+
color: #838183;
35+
text-align: center;
36+
}
37+
38+
.trail li{
39+
display: inline;
40+
}
41+
42+
.trail li+li:before{
43+
content: " | ";
44+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# a last page
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# a page
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# another page
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
# Example of trail
3+
4+
* [[trail: a_page]]
5+
* [[trail: another_page]]
6+
* [[trail: sub_section]]
7+
* [[trail: a_last_page]]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# bar
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# foo
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# A sub-section
2+
3+
* [[trail: foo]]
4+
* [[trail: bar]]

0 commit comments

Comments
 (0)