From 677e1340aaab4a3172aa1468405b0cadbfa52e3d Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 6 Jun 2017 21:33:11 +0100 Subject: [PATCH] Fight the build system to make open search work. I win! I should really consider upgrading it though. --- build/index.php | 14 +++++++++----- core.php | 2 +- module_index.json | 4 ++-- modules/feature-search.php | 6 +++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/build/index.php b/build/index.php index 1a63069..73ea4e9 100644 --- a/build/index.php +++ b/build/index.php @@ -230,6 +230,7 @@ input[type=search] { width: 14rem; padding: 0.3rem 0.4rem; font-size: 1rem; colo input[type=search]::-webkit-input-placeholder { color : rgba(255, 255, 255, 0.75); } input[type=button], input[type=submit] { cursor: pointer; } +.sidebar + .main-container nav.bottom { position: relative; } .sidebar { position: relative; z-index: 100; margin-top: 0.6rem; padding: 1rem 3rem 2rem 0.4rem; background: #9e7eb4; box-shadow: inset -0.6rem 0 0.8rem -0.5rem rgba(50, 50, 50, 0.5); } .sidebar a { color: #ffa74d; } @@ -1409,7 +1410,7 @@ class page_renderer $result .= self::getJS(); if(module_exists("feature-search")) - $result .= "\t\t\n"; + $result .= "\t\t\n"; if(!empty($settings->enable_math_rendering)) { @@ -2067,7 +2068,10 @@ function render_sidebar($pageindex, $root_pagename = "") // The current page is the same as the root page, skip it if($pagename == $root_pagename) continue; - + + // If the page already appears on the sidebar, skip it + if(preg_match("/>$pagename<\a>/m", $result) === 1) + continue; // If the part of the current pagename that comes after the root // pagename has a slash in it, skip it as it is a sub-sub page. @@ -3235,8 +3239,8 @@ register_module([ else header("content-type: text/plain"); - exit(utf8_encode(" + exit('' . // hack The build system strips it otherwise O.o I should really fix that. +"\n Search $settings->sitename Search $settings->sitename, which is powered by Pepperminty Wiki. $settings->sitename Wiki @@ -3247,7 +3251,7 @@ register_module([ UTF-8 -")); +"); }); add_action("suggest-pages", function() { diff --git a/core.php b/core.php index 185714c..352f99e 100644 --- a/core.php +++ b/core.php @@ -1064,7 +1064,7 @@ class page_renderer $result .= self::getJS(); if(module_exists("feature-search")) - $result .= "\t\t\n"; + $result .= "\t\t\n"; if(!empty($settings->enable_math_rendering)) { diff --git a/module_index.json b/module_index.json index d951116..44bfaf3 100755 --- a/module_index.json +++ b/module_index.json @@ -41,7 +41,7 @@ "author": "Starbeamrainbowlabs", "description": "Adds a sidebar to the left hand side of every page. Add '$settings->sidebar_show = true;' to your configuration, or append '&sidebar=yes' to the url to enable. Adding to the url sets a cookie to remember your setting.", "id": "extra-sidebar", - "lastupdate": 1450704211, + "lastupdate": 1496779827, "optional": false }, { @@ -95,7 +95,7 @@ "author": "Starbeamrainbowlabs", "description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.", "id": "feature-search", - "lastupdate": 1490304455, + "lastupdate": 1496781067, "optional": false }, { diff --git a/modules/feature-search.php b/modules/feature-search.php index 2232611..84c37a8 100755 --- a/modules/feature-search.php +++ b/modules/feature-search.php @@ -256,8 +256,8 @@ register_module([ else header("content-type: text/plain"); - exit(utf8_encode(" - + exit('' . // hack The build system strips it otherwise O.o I should really fix that. +"\n Search $settings->sitename Search $settings->sitename, which is powered by Pepperminty Wiki. $settings->sitename Wiki @@ -268,7 +268,7 @@ register_module([ UTF-8 -")); +"); }); add_action("suggest-pages", function() {