From 029da6d735589f8cb58765664b20cdd352dd609d Mon Sep 17 00:00:00 2001 From: obel1x Date: Sun, 9 Sep 2018 12:26:50 +0200 Subject: [PATCH 1/3] New Version +Feature:liststyle Adds Parameter liststyle=[STYLE] to use together with depth>1. where style can be one of: default - the same as not given relative - will print relative names for pages full - will print fully qualified pagenames --- plugin.info.txt | 2 +- syntax.php | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/plugin.info.txt b/plugin.info.txt index d6488a4..3a931be 100644 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,7 @@ base nslist author Andreas Gohr email dokuwiki@cosmocode.de -date 2016-01-24 +date 2018-09-18 name Namespace Listing desc List all pages in a given namespace url http://www.dokuwiki.org/plugin:nslist diff --git a/syntax.php b/syntax.php index d7d5848..5ff4c6c 100644 --- a/syntax.php +++ b/syntax.php @@ -60,7 +60,8 @@ function handle($match, $state, $pos, Doku_Handler $handler){ 'depth' => 1, 'date' => 1, 'dsort' => 1 - ); + ,'liststyle' => 'default' + ); list($ns,$params) = explode(' ',$match,2); $ns = cleanID($ns); @@ -70,10 +71,12 @@ function handle($match, $state, $pos, Doku_Handler $handler){ if(preg_match('/\b(\d+)\b/i',$params,$m)) $conf['depth'] = $m[1]; if($ns) $conf['ns'] = $ns; + if(preg_match('/liststyle=([a-z\-]+)\&?/i',$params,$m)) $conf['liststyle'] = $m[1]; //parse parameter "liststyle" + $conf['dir'] = str_replace(':','/',$conf['ns']); // prepare data - return $conf; + return $conf; //conf will become data by function render later } /** @@ -107,7 +110,20 @@ function render($format, Doku_Renderer $R, $data) { foreach($result as $item){ $R->listitem_open(1); $R->listcontent_open(); - $R->internallink(':'.$item['id']); + + //Different behaviour as of Liststyle- Param + if($data['liststyle'] == 'default') { + //no special parameter given, use default = empty + $item['id_name'] = ''; + }elseif($data['liststyle'] == 'full') + { + $item['id_name'] = $item['id']; //full name of space + }elseif($data['liststyle'] == 'relative') + { + $item['id_name'] = substr($item['id'],strlen($data['ns'])+1); //strip off given namespace + ':' + }; + + $R->internallink(':'.$item['id'],$item['id_name']); if($data['date']) $R->cdata(' '.dformat($item['mtime'])); $R->listcontent_close(); From e0246bf625474555a9101747b00da497de98339b Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 10 Nov 2018 10:52:38 +0100 Subject: [PATCH 2/3] Create README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..de68116 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# nslist: Plugin for Dokuware +Namespace listing plugin From f637f5abf31275d811bc71c05cb846ded2371742 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 10 Nov 2018 11:01:04 +0100 Subject: [PATCH 3/3] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index de68116..2cee98e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ -# nslist: Plugin for Dokuware +# nslist: Plugin for DokuWiki Namespace listing plugin + +Have a look at [DokuWiki: nslist Plugin](https://www.dokuwiki.org/plugin:nslist?s[]=nslist)