plugin:alphaindex
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:alphaindex [2011-08-06 15:16] – [Bugs] lupo49 | plugin:alphaindex [2020-02-29 18:28] (current) – version upped Aleksandr | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== Alphaindex |
---- plugin ---- | ---- plugin ---- | ||
Line 6: | Line 6: | ||
email : takashi@natural-design.net | email : takashi@natural-design.net | ||
type : syntax | type : syntax | ||
- | lastupdate : 2008-10-28 | + | lastupdate : 2016-02-02 |
compatible : | compatible : | ||
depends | depends | ||
Line 13: | Line 13: | ||
tags : navigation, menu, listing, namespace | tags : navigation, menu, listing, namespace | ||
- | downloadurl: | + | downloadurl: |
- | bugtracker : http:// | + | bugtracker : https:// |
- | sourcerepo : http:// | + | sourcerepo : https:// |
donationurl: | donationurl: | ||
---- | ---- | ||
Line 160: | Line 160: | ||
===== How to install ===== | ===== How to install ===== | ||
+ | Search and install the plugin using the [[plugin: | ||
|:!: There is also a [[http:// | |:!: There is also a [[http:// | ||
- | |||
- | Copy the [[https:// | ||
===== Changelog ===== | ===== Changelog ===== | ||
+ | |||
+ | {{rss> | ||
* **2006-06-14 - //version 1.2//** | * **2006-06-14 - //version 1.2//** | ||
Line 183: | Line 184: | ||
* // | * // | ||
- | * //And what's about a RegEx for '' | + | * //And what's about a RegEx for '' |
===== Bugs / Feature Requests ===== | ===== Bugs / Feature Requests ===== | ||
- | Please report bugs or feature requests at the [[http:// | + | Please report bugs or feature requests at the [[https:// |
- | |||
- | * Some random title indexes are displayed incorrectly, | ||
- | --- // | ||
- | > Corrected in 1.2 version --- // | ||
- | |||
- | * It's need to replace all '' | ||
- | --- // | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ==== Patches ==== | ||
- | | :!: The following patches are included in the alphaindex modded version in the [[.: | ||
- | |||
- | ---- | ||
- | // | ||
- | |||
- | There is a patch which : | ||
- | * Fix odd bug by replacing '' | ||
- | * Fix the '' | ||
- | * Add the '' | ||
- | * Apply the patch for tag/ | ||
- | And... | ||
- | * Fix a bug with '' | ||
- | * Fix the TOC. Just use %%~~NOTOC~~%% to hide it. | ||
- | * Hide editsection buttons, useless. | ||
- | * Should not required anymore %%~~NOCACHE~~%% within the pages. I test it, that seems to work... ;-) | ||
- | * I also did spaces cleaning. | ||
- | I test it on the release 2008-05-05. | ||
- | |||
- | <code diff> | ||
- | diff -Naur alphaindex_orig/ | ||
- | --- alphaindex_orig/ | ||
- | +++ alphaindex/ | ||
- | @@ -1,21 +1,21 @@ | ||
- | <? | ||
- | /** | ||
- | - * Info Alphaindex: Displays the alphabetical index of a specified namespace. | ||
- | + * Info Alphaindex: Displays the alphabetical index of a specified namespace. | ||
- | * | ||
- | - * Version: 1.2 | ||
- | - * last modified: 2006-06-14 12:00:00 | ||
- | + * Version: 1.3 | ||
- | + * last modified: 2008-08-31 | ||
- | * @license | ||
- | - * @author | ||
- | + * @author | ||
- | */ | ||
- | - | ||
- | + | ||
- | /** | ||
- | - * Configuration additionnelle sp?cifique au plugin | ||
- | + * Configuration additionnelle sp?cifique au plugin | ||
- | * | ||
- | * - $conf[' | ||
- | * - $conf[' | ||
- | - * - $conf[' | ||
- | + * - $conf[' | ||
- | * - $conf[' | ||
- | - * - $conf[' | ||
- | + * - $conf[' | ||
- | * - $conf[' | ||
- | * - $conf[' | ||
- | * - $conf[' | ||
- | @@ -27,13 +27,13 @@ | ||
- | | ||
- | | ||
- | | ||
- | - | ||
- | + | ||
- | /** | ||
- | * All DokuWiki plugins to extend the parser/ | ||
- | * need to inherit from this class | ||
- | */ | ||
- | class syntax_plugin_alphaindex extends DokuWiki_Syntax_Plugin { | ||
- | - | ||
- | + | ||
- | /** | ||
- | * return some info | ||
- | */ | ||
- | @@ -41,61 +41,88 @@ | ||
- | | ||
- | ' | ||
- | ' | ||
- | - ' | ||
- | + ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ); | ||
- | } | ||
- | - | ||
- | + | ||
- | | ||
- | | ||
- | - | ||
- | + | ||
- | /** | ||
- | * Where to sort in? | ||
- | */ | ||
- | | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | /** | ||
- | * Connect pattern to lexer | ||
- | */ | ||
- | | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | /** | ||
- | * Handle the match | ||
- | */ | ||
- | | ||
- | + global $ID; | ||
- | + | ||
- | | ||
- | $nons = true; | ||
- | - $match = substr($match, | ||
- | + $match = substr($match, | ||
- | // | ||
- | | ||
- | // | ||
- | | ||
- | // | ||
- | $ns = $ns_opt[0]; | ||
- | + // add @NS@ option | ||
- | + if(empty($ns) || $ns == ' | ||
- | + $pos = strrpos($ID,':' | ||
- | + if($pos!=false){ | ||
- | + $ns = substr($ID, | ||
- | + }else{ | ||
- | + $ns = ' | ||
- | + } | ||
- | + } | ||
- | // | ||
- | if (is_numeric($ns_opt[1])) { | ||
- | | ||
- | } | ||
- | | ||
- | - // namespaces option | ||
- | + // namespaces option | ||
- | $nons = in_array(' | ||
- | // multi-columns option | ||
- | | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | /** | ||
- | * Render output | ||
- | */ | ||
- | | ||
- | + global $ID; | ||
- | | ||
- | - if($mode == ' | ||
- | + | ||
- | + if($mode == ' | ||
- | + // Never cache to get fresh info | ||
- | + $renderer-> | ||
- | + // Remove Section Edit Buttons | ||
- | + $oldmaxecl = $conf[' | ||
- | + $conf[' | ||
- | + // To see the TOC, to not use ~~NOTOC~~ | ||
- | + if ($renderer-> | ||
- | + $oldmaxtoc = $conf[' | ||
- | + $conf[' | ||
- | + } | ||
- | + else { | ||
- | + $oldmaxtoc = -1; | ||
- | + } | ||
- | + | ||
- | | ||
- | if ((!@$n)) { | ||
- | if (isset ($conf[' | ||
- | @@ -106,31 +133,28 @@ | ||
- | } | ||
- | | ||
- | |||
- | - $alpha_data = p_render(' | ||
- | - | ||
- | - // remove toc, section edit buttons and category tags | ||
- | - $patterns = array(' | ||
- | - '#< | ||
- | - ' | ||
- | - $replace | ||
- | - $alpha_data = preg_replace($patterns, | ||
- | + $alpha_data = p_render(' | ||
- | + | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | + | ||
- | + $conf[' | ||
- | + if ( $oldmaxtoc == -1 ) $conf[' | ||
- | | ||
- | } | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | | ||
- | } | ||
- | |||
- | /** | ||
- | - * Return the alphabetical index | ||
- | + * Return the alphabetical index | ||
- | * @author Hubert MOLIERE < | ||
- | * | ||
- | * This function is a hack of Indexmenu _tree_menu($ns) | ||
- | * @author Samuele Tognini < | ||
- | - | ||
- | + * | ||
- | * This function is a simple hack of DokuWiki html_index($ns) | ||
- | * @author Andreas Gohr < | ||
- | */ | ||
- | @@ -138,9 +162,9 @@ | ||
- | | ||
- | | ||
- | |||
- | - $ns = $myns[0]; | ||
- | + $ns = $myns[0]; | ||
- | $opts = $myns[1]; | ||
- | - | ||
- | + | ||
- | // Articles deletion configuration | ||
- | | ||
- | | ||
- | @@ -149,13 +173,13 @@ | ||
- | } else { | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | // Hide pages configuration | ||
- | | ||
- | | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | // template configuration | ||
- | | ||
- | | ||
- | @@ -177,25 +201,25 @@ | ||
- | } else { | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | | ||
- | $ns = dirname(str_replace(':','/', | ||
- | if ($ns == ' | ||
- | } else { | ||
- | $ns = cleanID($ns); | ||
- | } | ||
- | - | ||
- | + | ||
- | | ||
- | $data = array(); | ||
- | | ||
- | - | ||
- | + | ||
- | | ||
- | | ||
- | - | ||
- | + | ||
- | // alphabetical ordering | ||
- | | ||
- | | ||
- | - | ||
- | + | ||
- | $pos = strrpos(utf8_decode($tmpData), | ||
- | | ||
- | | ||
- | @@ -205,7 +229,7 @@ | ||
- | } else { | ||
- | | ||
- | } | ||
- | - $pageName = utf8_str_replace(' | ||
- | + $pageName = str_replace(' | ||
- | } | ||
- | } else { | ||
- | | ||
- | @@ -213,14 +237,21 @@ | ||
- | } else { | ||
- | | ||
- | } | ||
- | - $pageName = utf8_str_replace(' | ||
- | + $pageName = str_replace(' | ||
- | } | ||
- | | ||
- | - | ||
- | - // if the current page is not a page to hide | ||
- | - if(!in_array($pageName, | ||
- | + | ||
- | + // Otherwise, | ||
- | + if($pos != FALSE) { | ||
- | + $pageNameNS = utf8_substr($tmpData, | ||
- | + } else { | ||
- | + $pageNameNS = $tmpData; | ||
- | + } | ||
- | + | ||
- | + // if the current page is not a page to hide | ||
- | + if(!in_array($pageNameNS, | ||
- | // Articles deletion | ||
- | - if($articlesDeletion) { | ||
- | + if($articlesDeletion) { | ||
- | | ||
- | | ||
- | | ||
- | @@ -228,7 +259,14 @@ | ||
- | } | ||
- | } | ||
- | } | ||
- | - // R? | ||
- | + | ||
- | + if(isset($conf[' | ||
- | + $tmp = p_get_metadata($data[$cpt][' | ||
- | + if(isset($tmp[' | ||
- | + $pageName = $tmp[' | ||
- | + } | ||
- | + | ||
- | + // R? | ||
- | | ||
- | | ||
- | | ||
- | @@ -237,7 +275,7 @@ | ||
- | | ||
- | } | ||
- | } | ||
- | - | ||
- | + | ||
- | | ||
- | | ||
- | } else { | ||
- | @@ -248,38 +286,38 @@ | ||
- | } else if (($articleMoving == 1)&& | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | | ||
- | | ||
- | } | ||
- | } | ||
- | - | ||
- | + | ||
- | // array sorting by key | ||
- | | ||
- | - | ||
- | + | ||
- | // Display of results | ||
- | - | ||
- | + | ||
- | // alphabetical index | ||
- | | ||
- | | ||
- | | ||
- | // Sorting of $currentLetter array | ||
- | | ||
- | - | ||
- | - $begin = utf8_str_replace(" | ||
- | + | ||
- | + $begin = str_replace(" | ||
- | | ||
- | | ||
- | - $link = utf8_str_replace(" | ||
- | - $alphaOutput .= utf8_str_replace(" | ||
- | + $link = str_replace(" | ||
- | + $alphaOutput .= str_replace(" | ||
- | | ||
- | } | ||
- | - $end = utf8_str_replace(" | ||
- | + $end = str_replace(" | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | } // | ||
- | |||
- | /** | ||
- | @@ -292,9 +330,9 @@ | ||
- | */ | ||
- | | ||
- | | ||
- | - | ||
- | + | ||
- | $item = array(); | ||
- | - | ||
- | + | ||
- | | ||
- | if ($opts[' | ||
- | if ($opts[' | ||
- | @@ -302,24 +340,24 @@ | ||
- | // | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | $id = pathID($file); | ||
- | - | ||
- | + | ||
- | // | ||
- | | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | // | ||
- | | ||
- | | ||
- | } | ||
- | - | ||
- | + | ||
- | //Set all pages at first level | ||
- | if ($opts[' | ||
- | - $lvl=1; | ||
- | + $lvl=1; | ||
- | } | ||
- | - | ||
- | + | ||
- | | ||
- | ' | ||
- | ' | ||
- | @@ -327,4 +365,4 @@ | ||
- | | ||
- | } | ||
- | |||
- | -?> | ||
- | \ Pas de fin de ligne ? la fin du fichier. | ||
- | +?> | ||
- | diff -Naur alphaindex_orig/ | ||
- | --- alphaindex_orig/ | ||
- | +++ alphaindex/ | ||
- | @@ -0,0 +1 @@ | ||
- | +20080831 | ||
- | </ | ||
- | |||
- | -- // | ||
- | |||
- | >> Since it seems that this plugin is abandoned by the original author, I've built an alphaindex [[devel: | ||
- | < | ||
- | >> I'll apply any new working patch published here, sent with the darcs mechanism or created by me. | ||
- | >> Next step could be to implement a better cache mechanism according for example to the [[http:// | ||
- | >> It's also possible to install it via [[plugin|plugin manager]] using this [[http:// | ||
- | |||
- | >> | ||
- | < | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | </ | ||
- | If I have a page which header is 'The Rolling Stones', | ||
- | |||
- | I see in the code and I found 2 minimal errors: | ||
- | Line 221 | ||
- | <code php> | ||
- | if($this-> | ||
- | $tmp = p_get_metadata($data[$cpt][' | ||
- | if(isset($tmp[' | ||
- | $pageName = $tmp[' | ||
- | } | ||
- | </ | ||
- | Move the entire block, just before this lines (line 211) | ||
- | <code php> | ||
- | PUT THE ENTIRE BLOCK JUST HERE | ||
- | // Articles deletion | ||
- | if(is_array($articlesDeletionPatterns)) { | ||
- | </ | ||
- | This will correct the letter index, so 'The Rolling Stones' | ||
===== Discussion ===== | ===== Discussion ===== | ||
- | It doesn' | ||
- | >Yes, it is. Better solution is to implement the caching fix into alphaindex code (you should take look at [[devel: | + | [[.:alphaindex:discussion|Placed |
- | >Or use the DokuWiki internal core, this is from indexmenu page: | + | |
- | + | ||
- | >To purge cache either wait for the automatic [[config: | + | |
- | + | ||
- | >You also might try the [[: | + | |
- | + | ||
- | ---- | + | |
- | I've installed it in my site, so that, if the author doesn' | + | |
- | --- // | + | |
- | + | ||
- | ---- | + | |
- | I needed listing of namespaces with index pages only, so I make a new option '' | + | |
- | <code diff> | + | |
- | 73a74 | + | |
- | > | + | |
- | 90c91,93 | + | |
- | < | + | |
- | --- | + | |
- | > // indexes option | + | |
- | > | + | |
- | > | + | |
- | 293a297, | + | |
- | > | + | |
- | > | + | |
- | 307c312, | + | |
- | < | + | |
- | --- | + | |
- | > // show just index files | + | |
- | > if ($opts[' | + | |
- | > $myns = explode(":", | + | |
- | > if (end($myns)!=noNS($id) and noNS($id)!=$conf[' | + | |
- | > } | + | |
- | > | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | Somehow the plugin list lots of red links in my installation, | + | |
- | + | ||
- | ---- | + | |
- | I would like to suggest a feature that prints the namespace beside the page if there are several pages with the same name, e.g. | + | |
- | > Files, (foo/) | + | |
- | > Files (The), (bar/) | + | |
- | > Files, (foobar/) | + | |
- | or with : too, of course | + | |
- | + | ||
- | Edit: maybe even an argument to print each namespace (alphabetically sorted) own its own above the root namespace: | + | |
- | > ====== /Files ====== | + | |
- | > ====== /Wiki ====== | + | |
- | > (Root) | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | > Hello, I use the alphaindex on [[http:// | + | |
- | liedtexte: | + | |
- | + | ||
- | ---- | + | |
- | Is there a way to override global ' | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | I am wondering if there is a way to make this plugin work with the XBR render plugin? What it does is repeat the index twice and omitting any other text in the site. Anyone have ideas? |
plugin/alphaindex.1312636567.txt.gz · Last modified: 2011-08-06 15:16 by lupo49