1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 04:23:01 +00:00

Display an ellipsis at the beginning of a search context if it doesn't start at the beginning of a page

This commit is contained in:
Starbeamrainbowlabs 2018-09-29 13:32:17 +01:00
parent 24775724d1
commit 39098ac0fb
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 9 additions and 2 deletions

View file

@ -33,6 +33,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Improve help text description of image captions displayed alongside images - Improve help text description of image captions displayed alongside images
- Fixed the page history page - it should now display all page revisions in valid HTML - Fixed the page history page - it should now display all page revisions in valid HTML
- Fixed another bug in the search context generator - Fixed another bug in the search context generator
- Display an ellipsis at the beginning of a search context if it doesn't start at the beginning of a page
## Changed ## Changed
- Password hashing has been overhauled! A totally new-and-different system is being used now, so you'll need to rehash all your passwords. - Password hashing has been overhauled! A totally new-and-different system is being used now, so you'll need to rehash all your passwords.

View file

@ -407,7 +407,7 @@ if($settings->sessionprefix == "auto")
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */ /** The version of Pepperminty Wiki currently running. */
$version = "v0.17-dev"; $version = "v0.17-dev";
$commit = "284b4049460887b0b40b2f73e7db9158e5bc1ef0"; $commit = "24775724d14520b8007cf7f4cc0c1d8901980494";
/// Environment /// /// Environment ///
/** Holds information about the current request environment. */ /** Holds information about the current request environment. */
$env = new stdClass(); $env = new stdClass();
@ -4872,6 +4872,9 @@ class search
$result = implode("", $contexts_text); $result = implode("", $contexts_text);
end($contexts); // If there's at least one item in the list and were not at the very end of the page, add an extra ellipsis end($contexts); // If there's at least one item in the list and were not at the very end of the page, add an extra ellipsis
if(isset($contexts[0]) && $contexts[key($contexts)]["to"] < $sourceLength) $result .= ""; if(isset($contexts[0]) && $contexts[key($contexts)]["to"] < $sourceLength) $result .= "";
// Prepend an ellipsis if the context doesn't start at the beginning of a page
if(isset($contexts[0]) && $contexts[0]["from"] > 0) $result = "$result";
return $result; return $result;
} }

View file

@ -104,7 +104,7 @@
"author": "Starbeamrainbowlabs", "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.", "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", "id": "feature-search",
"lastupdate": 1538223927, "lastupdate": 1538224279,
"optional": false "optional": false
}, },
{ {

View file

@ -993,6 +993,9 @@ class search
$result = implode("", $contexts_text); $result = implode("", $contexts_text);
end($contexts); // If there's at least one item in the list and were not at the very end of the page, add an extra ellipsis end($contexts); // If there's at least one item in the list and were not at the very end of the page, add an extra ellipsis
if(isset($contexts[0]) && $contexts[key($contexts)]["to"] < $sourceLength) $result .= ""; if(isset($contexts[0]) && $contexts[key($contexts)]["to"] < $sourceLength) $result .= "";
// Prepend an ellipsis if the context doesn't start at the beginning of a page
if(isset($contexts[0]) && $contexts[0]["from"] > 0) $result = "$result";
return $result; return $result;
} }