User Tools

Site Tools


DokuWiki

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
DokuWiki [2017/05/26 01:41]
peternlewis
DokuWiki [2017/05/26 01:58] (current)
peternlewis
Line 5: Line 5:
 * [[https://​www.dokuwiki.org/​pagename#​hacking_the_core_for_mixed_case_names|Hacking the Core for mixed case names]] * [[https://​www.dokuwiki.org/​pagename#​hacking_the_core_for_mixed_case_names|Hacking the Core for mixed case names]]
 * [[https://​forum.dokuwiki.org/​thread/​5417|Good hacks here]] * [[https://​forum.dokuwiki.org/​thread/​5417|Good hacks here]]
 +    * Mixed case page names
 +    * Case insensitive page name searches
 +    * Remove underscores from page titles
  
 ==== Installed Plugins ==== ==== Installed Plugins ====
Line 24: Line 27:
    * Replace `noNS($pageId)` with `preg_replace("/​_/","​ ",​noNS($pageId))`    * Replace `noNS($pageId)` with `preg_replace("/​_/","​ ",​noNS($pageId))`
  
 +==== Diffs ====
 +
 +<code diff>
 +diff --git a/​inc/​fulltext.php b/​inc/​fulltext.php
 +index a727a8b..3d5236a 100644
 +--- a/​inc/​fulltext.php
 ++++ b/​inc/​fulltext.php
 +@@ -248,7 +248,7 @@ function _ft_pageLookup(&​$data){
 +     ​$pages = array();
 +     if ($id !== ''​ && $cleaned !== ''​) {
 +         ​foreach ($page_idx as $p_id) {
 +-            if ((strpos($in_ns ? $p_id : noNSorNS($p_id),​ $cleaned) !== false)) {
 ++            if ((stripos($in_ns ? $p_id : noNSorNS($p_id),​ $cleaned) !== false)) {
 +                 if (!isset($pages[$p_id]))
 +                     ​$pages[$p_id] = p_get_first_heading($p_id,​ METADATA_DONT_RENDER);​
 +             }
 +@@ -263,7 +263,7 @@ function _ft_pageLookup(&​$data){
 + 
 +     if (isset($ns)) {
 +         ​foreach (array_keys($pages) as $p_id) {
 +-            if (strpos($p_id,​ $ns) !== 0) {
 ++            if (stripos($p_id,​ $ns) !== 0) {
 +                 ​unset($pages[$p_id]);​
 +             }
 +         }
 +diff --git a/​inc/​template.php b/​inc/​template.php
 +index 3c0f1f4..9f7c0f7 100644
 +--- a/​inc/​template.php
 ++++ b/​inc/​template.php
 +@@ -1048,6 +1048,16 @@ function tpl_pageinfo($ret = false) {
 +     ​return false;
 + }
 + 
 ++function hacks_nicetitle($id) {
 ++    $result = preg_replace("/​_/","​ ",​$id);​
 ++    if ($result) {
 ++        return($result);​
 ++    }
 ++    else {
 ++        return($id);​
 ++    }
 ++ }
 ++
 + /**
 +  * Prints or returns the name of the given page (current one if none given).
 +  *
 +@@ -1068,7 +1078,7 @@ function tpl_pagetitle($id = null, $ret = false) {
 +         $id = $ID;
 +     }
 + 
 +-    $name = $id;
 ++    $name = hacks_nicetitle( $id );
 +     ​if(useHeading('​navigation'​)) {
 +         ​$first_heading = p_get_first_heading($id);​
 +         ​if($first_heading) $name = $first_heading;​
 +diff --git a/​lib/​plugins/​nspages/​fileHelper/​pagePreparer.php b/​lib/​plugins/​nspages/​fileHelper/​pagePreparer.php
 +index 6607b20..8f7eb5e 100644
 +--- a/​lib/​plugins/​nspages/​fileHelper/​pagePreparer.php
 ++++ b/​lib/​plugins/​nspages/​fileHelper/​pagePreparer.php
 +@@ -37,11 +37,11 @@ class pagePreparer extends filePreparer {
 + 
 +     ​private function buildNameToDisplay($title,​ $pageId){
 +         ​if($this->​useIdAndTitle && $title !== null ){
 +-          return noNS($pageId) . " - " . $title;
 ++          return preg_replace("/​_/","​ ",​noNS($pageId)) . " - " . $title;
 +         }
 + 
 +         ​if(!$this->​useTitle || $title === null) {
 +-            return noNS($pageId);​
 ++            return preg_replace("/​_/","​ ",​noNS($pageId));​
 +         }
 +         ​return $title;
 +     }
 +diff --git a/​lib/​plugins/​nspages/​syntax.php b/​lib/​plugins/​nspages/​syntax.php
 +index 329b4dc..95c4dfc 100644
 +--- a/​lib/​plugins/​nspages/​syntax.php
 ++++ b/​lib/​plugins/​nspages/​syntax.php
 +@@ -50,7 +50,7 @@ class syntax_plugin_nspages extends DokuWiki_Syntax_Plugin {
 +         ​optionParser::​checkOption($match,​ "​simpleLineBreak",​ $return['​lineBreak'​],​ true);
 +         ​optionParser::​checkOption($match,​ "​title",​ $return['​title'​],​ true);
 +         ​optionParser::​checkOption($match,​ "​idAndTitle",​ $return['​idAndTitle'​],​ true);
 +-        optionParser::​checkOption($match,​ "​h1",​ $return['​title'​],​ true);
 ++        optionParser::​checkOption($match,​ "​h1",​ $return['​h1'​],​ true);
 +         ​optionParser::​checkOption($match,​ "​simpleLine",​ $return['​simpleLine'​],​ true);
 +         ​optionParser::​checkOption($match,​ "​sort(By)?​Id",​ $return['​sortid'​],​ true);
 +         ​optionParser::​checkOption($match,​ "​reverse",​ $return['​reverse'​],​ true);
 +</​code>​
DokuWiki.txt ยท Last modified: 2017/05/26 01:58 by peternlewis