From d08ab2ba465e99d7ad6047babda18853021f233d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 16 Jul 2008 17:43:57 -0400 Subject: move complex examples to a tip --- doc/plugins/parentlinks.mdwn | 123 +-------------------------------------- doc/tips/parentlinks_style.mdwn | 124 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 121 deletions(-) create mode 100644 doc/tips/parentlinks_style.mdwn (limited to 'doc') diff --git a/doc/plugins/parentlinks.mdwn b/doc/plugins/parentlinks.mdwn index ff4139390..ef262a30c 100644 --- a/doc/plugins/parentlinks.mdwn +++ b/doc/plugins/parentlinks.mdwn @@ -1,124 +1,5 @@ [[!template id=plugin name=parentlinks core=1 author="[[intrigeri]]"]] [[!tag type/link]] -This plugin offers a `HTML::Template` loop that iterates over all or -a subset of a page's parents. It also provides a few bonus -possibilities, such as styling the parent links depending on their -place in the path. - -[[!toc ]] - -Content -======= - -This plugin provides one template loop, called `PARENTLINKS`, that -returns the list of parent pages for the current page. Every returned -path element has the following variables set: - -* `URL` (string): url to the current path element -* `PAGE` (string): title of the current path element -* `DEPTH` (positive integer): depth of the path leading to the - current path element, counting from the wiki's root, which has - `DEPTH=0` -* `HEIGHT` (positive integer): distance, expressed in path elements, - from the current page to the current path element; e.g. this is - 1 for the current page's mother, 2 for its grand-mother, etc. -* `DEPTH_n` (boolean): true if, and only if, `DEPTH==n` -* `HEIGHT_n` (boolean): true if, and only if, `HEIGHT==n` - -Usage -===== - -The `DEPTH_n` and `HEIGHT_n` variables allow the template writer to -skip arbitrary elements in the parents list: they are arbitrary -page-range selectors. - -The `DEPTH` and `HEIGHT` variables allow the template writer to apply -general treatment, depending on one of these variables, to *every* -parent: they are counters. - -Basic usage ------------ - -As in the default `page.tmpl`, one can simply display the list of -parent pages: - - - / - - - - -Styling parents depending on their depth ----------------------------------------- - -Say you want the parent links to be styled depending on their depth in -the path going from the wiki root to the current page; just add the -following lines in `page.tmpl`: - - - " class="depth"> - - / - - -Then write the appropriate CSS bits for `a.depth1`, etc. - -Skip some parents, style the others depending on their distance to the current page ------------------------------------------------------------------------------------ - -Say you want to display all the parents links but the wiki homepage, -styled depending on their distance to the current page; just add the -following lines in `page.tmpl`: - - - - - " class="height"> - - / - - -Then write the appropriate CSS bits for `a.height1`, etc. - -Full-blown example ------------------- - -Let's have a look at a more complicated example; combining the boolean -loop variables provided by this plugin (`IS_ROOT` and friends) and -`HTML::Template` flow control structures, you can have custom HTML -and/or CSS generated for some special path components; e.g.: - - -
-
    - - - - - -
  • ">
  • -
    -
    -
    -
-
- - - - -
- "> -
- - -
- "> -
-
-
-
- - - - +This plugin generates the links to a page's parents that typically appear +at the top of a wiki page. diff --git a/doc/tips/parentlinks_style.mdwn b/doc/tips/parentlinks_style.mdwn new file mode 100644 index 000000000..5294e5452 --- /dev/null +++ b/doc/tips/parentlinks_style.mdwn @@ -0,0 +1,124 @@ +Here are some tips for ways to style the links +provided by the [[plugins/parentlinks]] plugin. + +This plugin offers a `HTML::Template` loop that iterates over all or +a subset of a page's parents. It also provides a few bonus +possibilities, such as styling the parent links depending on their +place in the path. + +[[!toc ]] + +Content +======= + +The plugin provides one template loop, called `PARENTLINKS`, that +returns the list of parent pages for the current page. Every returned +path element has the following variables set: + +* `URL` (string): url to the current path element +* `PAGE` (string): title of the current path element +* `DEPTH` (positive integer): depth of the path leading to the + current path element, counting from the wiki's root, which has + `DEPTH=0` +* `HEIGHT` (positive integer): distance, expressed in path elements, + from the current page to the current path element; e.g. this is + 1 for the current page's mother, 2 for its grand-mother, etc. +* `DEPTH_n` (boolean): true if, and only if, `DEPTH==n` +* `HEIGHT_n` (boolean): true if, and only if, `HEIGHT==n` + +Usage +===== + +The `DEPTH_n` and `HEIGHT_n` variables allow the template writer to +skip arbitrary elements in the parents list: they are arbitrary +page-range selectors. + +The `DEPTH` and `HEIGHT` variables allow the template writer to apply +general treatment, depending on one of these variables, to *every* +parent: they are counters. + +Basic usage +----------- + +As in the default `page.tmpl`, one can simply display the list of +parent pages: + + + / + + + + +Styling parents depending on their depth +---------------------------------------- + +Say you want the parent links to be styled depending on their depth in +the path going from the wiki root to the current page; just add the +following lines in `page.tmpl`: + + + " class="depth"> + + / + + +Then write the appropriate CSS bits for `a.depth1`, etc. + +Skip some parents, style the others depending on their distance to the current page +----------------------------------------------------------------------------------- + +Say you want to display all the parents links but the wiki homepage, +styled depending on their distance to the current page; just add the +following lines in `page.tmpl`: + + + + + " class="height"> + + / + + +Then write the appropriate CSS bits for `a.height1`, etc. + +Full-blown example +------------------ + +Let's have a look at a more complicated example; combining the boolean +loop variables provided by the plugin (`IS_ROOT` and friends) and +`HTML::Template` flow control structures, you can have custom HTML +and/or CSS generated for some special path components; e.g.: + + +
+
    + + + + + +
  • ">
  • +
    +
    +
    +
+
+ + + + +
+ "> +
+ + +
+ "> +
+
+
+
+ + + + -- cgit v1.2.3