DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:nspages

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:nspages [2021-10-17 18:42] – Update version (2021-10-09). Fix compatibility with latest version of php gturriplugin:nspages [2024-03-07 19:33] (current) – Tested OK with Kaos dregad
Line 6: Line 6:
 email      : guillaume.turri@gmail.com email      : guillaume.turri@gmail.com
 type       : Syntax type       : Syntax
-lastupdate : 2021-10-17 +lastupdate : 2024-01-04 
-compatible : 2017-02-19, 2016-06-26a, 2009-12-25, Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, ponder stibbons, Hrun, DetritusGreeboHogfather+compatible : IgorJack JackrumKaos+
 depends    :  depends    : 
 conflicts  conflicts 
Line 19: Line 19:
 ---- ----
  
-:!: **I'm looking for a co-maintainer!** +//**If your Dokuwiki instance is older than the release "Igor - 2022-07-31" you should use the version available [[https://github.com/gturri/nspages/zipball/last_before_igor|here]] (and NOT update it afterward)because subsequent versions of the plugin won't be compatible)**//
- +
-//If you're a user of this plugin, don't worry: I'm still taking care of it, I will make sure it keeps working with future versions of DokuWiki. But I have much less time than before to dedicate to it, and as a consequence feature requests tend to pile up.// +
- +
-//If you're interested in co-maintaining this pluginjust send me an email (address available in the commit log).// +
- +
------+
  
 This plugin nicely displays a table of content of the pages -and optionally the subnamespaces- of a given (sub)namespace. This plugin nicely displays a table of content of the pages -and optionally the subnamespaces- of a given (sub)namespace.
Line 79: Line 73:
 |  <code>-exclude</code>  |won't include the current page | |  <code>-exclude</code>  |won't include the current page |
 |  <code>-h1</code>  |will display the first h1 title found. If a page doesn't contain such a title, the name of the page  is used instead | |  <code>-h1</code>  |will display the first h1 title found. If a page doesn't contain such a title, the name of the page  is used instead |
-|  <code>-textPages="some text"</code>  |//some text// will be displayed instead of the default text, to introduce the pages list |+|  <code>-textPages="some text"</code>  |//some text// will be displayed instead of the default text, to introduce the pages list. i.e. changes the "Pages in this namespace" text. Set to ''%%=""%%'' to remove. |
 |  <code>-textNS="some text"</code>  |//some text// will be displayed instead of the default text, to introduce the namespaces list | |  <code>-textNS="some text"</code>  |//some text// will be displayed instead of the default text, to introduce the namespaces list |
 |  <code>-title</code>  | alias of ''-h1'' | |  <code>-title</code>  | alias of ''-h1'' |
Line 118: Line 112:
 |  <code>-showhidden</code>  |Include pages that are normally excluded from search with the [[config:hidepages|hidepages]] config parameter.  Useful for creating table of contents for hidden namespaces.| |  <code>-showhidden</code>  |Include pages that are normally excluded from search with the [[config:hidepages|hidepages]] config parameter.  Useful for creating table of contents for hidden namespaces.|
 |  <code>-dictionaryOrder="<locale>"</code>  |Sort according to the locale specified (see the [[http://php.net/manual/en/function.strcoll.php|doc]]). Example of usage: <code>-dictionaryOrder="sk_SK"</code>| |  <code>-dictionaryOrder="<locale>"</code>  |Sort according to the locale specified (see the [[http://php.net/manual/en/function.strcoll.php|doc]]). Example of usage: <code>-dictionaryOrder="sk_SK"</code>|
-|  <code>-customTitle="[{date.created}] {title} by {user}"</code>  |Use a custom format to display the title, replacing {xxx} with the associated metadata. See below for more explanations|+|  <code>-customTitle="[{date.created}] {title} by {user}"</code>  |Use a custom format to display the title, replacing {xxx} with the associated metadata. See [[#option_-customtitle|below]] for more explanations|
 |  <code>-includeItemsInTOC</code>  |Also displays the pages in the table of contents generated by Dokuwiki (the one which appears on the top right of each page with the default template)| |  <code>-includeItemsInTOC</code>  |Also displays the pages in the table of contents generated by Dokuwiki (the one which appears on the top right of each page with the default template)|
 |  <code>-sortByMetadata="date.created"</code>  |Sort the pages using the given metadata. (it can be used along with option -reverse)| |  <code>-sortByMetadata="date.created"</code>  |Sort the pages using the given metadata. (it can be used along with option -reverse)|
 +|  <code>-sidebar</code>  |You should use this if you use nspages to display a dynamic list of items in a sidebar. See [[#option_-sidebar|below]] for more information|
  
 ex: ''<nspages path_to_a_namespace -exclude>'' or ''<nspages -subns -nopages>'' will work. ex: ''<nspages path_to_a_namespace -exclude>'' or ''<nspages -subns -nopages>'' will work.
Line 147: Line 142:
   * The list of metadata available by default in Dokuwiki is available in the [[https://www.dokuwiki.org/devel:metadata|documentation]]   * The list of metadata available by default in Dokuwiki is available in the [[https://www.dokuwiki.org/devel:metadata|documentation]]
   * It can be use along with other plugins that adds support for custom metadatas (like the [[https://www.dokuwiki.org/plugin:meta|meta plugin]]). (Don't forget to add those other metadata in the accept-list of nspages)   * It can be use along with other plugins that adds support for custom metadatas (like the [[https://www.dokuwiki.org/plugin:meta|meta plugin]]). (Don't forget to add those other metadata in the accept-list of nspages)
 +
 +===== Option -sidebar =====
 +
 +DokuWiki supports [[faq:sidebar|sidebars]] out of the box.
 +
 +Here is an example of sidebar generated with nspages:
 +
 +{{https://turri.fr/nspages_img/nspages_sidebar.png?nolinking&300&recache}}
 +
 +To get this sidebar I just put
 +  <nspages -simpleList -h1 -sidebar>
 +on the page '':sidebar'' of my instance of DokuWiki.
 +
 +The tricky part is that since I do not specify a namespace then I expect nspages to consider the namespace of the current page. But by default nspages will consider that the current page is '':sidebar'' (because it is where it is defined), whereas want makes sense to me is that the current page is interpreted as the page that I'm currently browsing.
 +
 +That's the point of the ''-sidebar'' option. In practice it:
 +  * tells nspages that the "current page" should be interpreted as the page currently browsed
 +  * does not cache the resolution of the resolution of the namespace (because it may change at every page that I browse)
 +(a consequence is that it makes no sense to both specify a namespace and have the ''-sidebar'' option, so that case will just display an error)
 +
 +**To put it in a nutshell**: it you use nspages to generate a sidebar, then you should add the ''-sidebar'' option
  
 ===== Some (important) points ===== ===== Some (important) points =====
Line 164: Line 180:
  
 ==== To who ==== ==== To who ====
- +Any NGO acting for the environment.
-The preference goes to the [[https://support.worldwildlife.org/site/SPageServer?pagename=main_onetime|World Wildlife Fund]] (WWF) because the are both protecting biodiversity and fighting climate change effectively. +
- +
-If it isn't possible, any association acting for the environment would do the trick.+
  
 ==== How ==== ==== How ====
Line 178: Line 191:
 Making sure you have a positive impact would already be awesome: Making sure you have a positive impact would already be awesome:
   * Volunteer to an NGO near you. Give some of your time   * Volunteer to an NGO near you. Give some of your time
-  * Ride you bike instead of taking your car+  * Reduce your meat and plane consumption 
 +  * Ride your bike instead of taking your car
   * Use a reusable bag and stop using plastic straws   * Use a reusable bag and stop using plastic straws
-  * Reduce your meat and plane consumption 
   * Plant trees   * Plant trees
   * Take only what you need, not what you can   * Take only what you need, not what you can
  
plugin/nspages.1634488963.txt.gz · Last modified: 2021-10-17 18:42 by gturri

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki