This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
DokuWiki [2017/05/26 00:26] peternlewis |
DokuWiki [2019/07/15 03:53] (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 16: | Line 19: | ||
* [[https://www.dokuwiki.org/plugin:pageredirect|Page Redirect]] | * [[https://www.dokuwiki.org/plugin:pageredirect|Page Redirect]] | ||
* [[https://www.dokuwiki.org/plugin:toctweak|TOC Tweaking assortment]] | * [[https://www.dokuwiki.org/plugin:toctweak|TOC Tweaking assortment]] | ||
+ | |||
+ | ==== Fix pageredirect ==== | ||
+ | |||
+ | Edit pageredirect css (`plugins/pageredirect/style.css`) to remove clear:both, drop the width to 70%, and remove the margin-left: auto to clear any table of contents without forcing the redirect message to the bottom of the TOC. | ||
There are other plugins that don't affect styling of pages. | There are other plugins that don't affect styling of pages. | ||
+ | |||
+ | ==== Custom CSS ==== | ||
+ | |||
+ | Add conf/userstyle.css: | ||
+ | |||
+ | ```css | ||
+ | div.dokuwiki span.tooltip_default:hover .tip { | ||
+ | |||
+ | background-color: #f0f0f0; | ||
+ | border: 1px solid #444; | ||
+ | |||
+ | } | ||
+ | |||
+ | .dokuwiki .page ul li, .dokuwiki .aside ul li { | ||
+ | list-style-type: disc; | ||
+ | color: #444; | ||
+ | } | ||
+ | ``` | ||
+ | |||
+ | ==== Fix nspages ==== | ||
+ | |||
+ | * pagePreparer.php | ||
+ | * 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> |