User Tools

Site Tools


DokuWiki

**This is an old revision of the document!**

DokuWiki

This is just to document any hacks or otherwise required for the site.

Installed Plugins

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.

Fix nspages

  • pagePreparer.php
    • Replace noNS($pageId) with preg_replace("/_/"," ",noNS($pageId))

Diffs

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);
DokuWiki.1562661208.txt.gz · Last modified: 2019/07/09 04:33 by peternlewis