mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-21 16:13:00 +00:00
If it's a list of strings, then it should be sorted correctly.
This commit is contained in:
parent
29c62c4bbf
commit
157c6dabdd
9 changed files with 42 additions and 25 deletions
|
@ -19,7 +19,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
|||
- Added aria label to user preferences button
|
||||
- Hide site logo from screen readers
|
||||
- Lists of pages that have a specific tag will now be sorted alphabetically (unicode characters should be handled correctly too)
|
||||
- Support Unicode characters when sorting the list of all tags
|
||||
- Support Unicode characters when sorting. If it's a list of something, then it's now sorted correctly (e.g. includes pages, tags, etc).
|
||||
|
||||
### Changed
|
||||
- Made `build.sh` build script more robust, especially when generating the documentation.
|
||||
|
|
|
@ -521,7 +521,10 @@ class page_renderer
|
|||
public static function generate_all_pages_datalist() {
|
||||
global $settings, $pageindex;
|
||||
$arrayPageIndex = get_object_vars($pageindex);
|
||||
ksort($arrayPageIndex);
|
||||
$sorter = new Collator("");
|
||||
uksort($arrayPageIndex, function($a, $b) use($sorter) : int {
|
||||
return $sorter->compare($a, $b);
|
||||
});
|
||||
$result = "<datalist id='allpages'>\n";
|
||||
|
||||
// If dynamic page sugggestions are enabled, then we should send a loading message instead.
|
||||
|
|
|
@ -52,10 +52,10 @@
|
|||
{
|
||||
"id": "extra-sidebar",
|
||||
"name": "Sidebar",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"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.",
|
||||
"lastupdate": 1505768813,
|
||||
"lastupdate": 1567528758,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
|
@ -132,30 +132,30 @@
|
|||
{
|
||||
"id": "feature-search",
|
||||
"name": "Search",
|
||||
"version": "0.10",
|
||||
"version": "0.10.1",
|
||||
"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.",
|
||||
"lastupdate": 1567107944,
|
||||
"lastupdate": 1567528763,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
{
|
||||
"id": "feature-stats",
|
||||
"name": "Statistics",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "An extensible statistics calculation system. Comes with a range of built-in statistics, but can be extended by other modules too.",
|
||||
"lastupdate": 1567107944,
|
||||
"lastupdate": 1567528768,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
{
|
||||
"id": "feature-theme-gallery",
|
||||
"name": "Theme Gallery",
|
||||
"version": "0.1",
|
||||
"version": "0.3",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "Adds a theme gallery page and optional automatic theme updates. Contacts a remote server, where IP addresses are stored in automatic server logs for security and attack mitigation purposes.",
|
||||
"lastupdate": 1567369192,
|
||||
"lastupdate": 1567528753,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
|
@ -254,10 +254,10 @@
|
|||
{
|
||||
"id": "page-list",
|
||||
"name": "Page list",
|
||||
"version": "0.11.2",
|
||||
"version": "0.11.3",
|
||||
"author": "Starbeamrainbowlabs",
|
||||
"description": "Adds a page that lists all the pages in the index along with their metadata.",
|
||||
"lastupdate": 1567513003,
|
||||
"lastupdate": 1567530955,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
|
@ -337,7 +337,7 @@
|
|||
"version": "0.10",
|
||||
"author": "Emanuil Rusev & Starbeamrainbowlabs",
|
||||
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation.",
|
||||
"lastupdate": 1567168168,
|
||||
"lastupdate": 1567530862,
|
||||
"optional": false,
|
||||
"extra_data": {
|
||||
"Parsedown.php": "https:\/\/raw.githubusercontent.com\/erusev\/parsedown\/fe7a50eceb4a3c867cc9fa9c0aa906b1067d1955\/Parsedown.php",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
register_module([
|
||||
"name" => "Sidebar",
|
||||
"version" => "0.3.1",
|
||||
"version" => "0.3.2",
|
||||
"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",
|
||||
|
@ -51,7 +51,11 @@ register_module([
|
|||
|
||||
// Sort the pageindex
|
||||
$sorted_pageindex = get_object_vars($pageindex);
|
||||
ksort($sorted_pageindex, SORT_NATURAL);
|
||||
|
||||
$sorter = new Collator("");
|
||||
uksort($sorted_pageindex, function($a, $b) use($sorter) : int {
|
||||
return $sorter->compare($a, $b);
|
||||
});
|
||||
|
||||
$sidebar_contents = "";
|
||||
$sidebar_contents .= render_sidebar($sorted_pageindex);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
register_module([
|
||||
"name" => "Search",
|
||||
"version" => "0.10",
|
||||
"version" => "0.10.1",
|
||||
"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",
|
||||
|
@ -891,12 +891,17 @@ class search
|
|||
}
|
||||
|
||||
/**
|
||||
* Sorts an index alphabetically. Will also sort an inverted index.
|
||||
* Sorts an index alphabetically.
|
||||
* This allows us to do a binary search instead of a regular
|
||||
* sequential search.
|
||||
* @param array $index The index to sort.
|
||||
*/
|
||||
public static function index_sort(&$index) { ksort($index, SORT_NATURAL); }
|
||||
public static function index_sort(&$index) {
|
||||
$sorter = new Collator("");
|
||||
uksort($index, function($a, $b) use($sorter) : int {
|
||||
return $sorter->compare($a, $b);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two *regular* indexes to find the differences between them.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
register_module([
|
||||
"name" => "Statistics",
|
||||
"version" => "0.2.1",
|
||||
"version" => "0.2.2",
|
||||
"author" => "Starbeamrainbowlabs",
|
||||
"description" => "An extensible statistics calculation system. Comes with a range of built-in statistics, but can be extended by other modules too.",
|
||||
"id" => "feature-stats",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
register_module([
|
||||
"name" => "Theme Gallery",
|
||||
"version" => "0.1",
|
||||
"version" => "0.3",
|
||||
"author" => "Starbeamrainbowlabs",
|
||||
"description" => "Adds a theme gallery page and optional automatic theme updates. Contacts a remote server, where IP addresses are stored in automatic server logs for security and attack mitigation purposes.",
|
||||
"id" => "feature-theme-gallery",
|
||||
|
@ -46,8 +46,9 @@ register_module([
|
|||
}
|
||||
}
|
||||
|
||||
usort($themes_available, function($a, $b) {
|
||||
return strcmp($a->name, $b->name);
|
||||
$sorter = new Collator("");
|
||||
usort($themes_available, function($a, $b) use ($sorter) : int {
|
||||
return $sorter->compare($a->name, $b->name);
|
||||
});
|
||||
|
||||
$content = "<h1>Theme Gallery</h1>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
register_module([
|
||||
"name" => "Page list",
|
||||
"version" => "0.11.2",
|
||||
"version" => "0.11.3",
|
||||
"author" => "Starbeamrainbowlabs",
|
||||
"description" => "Adds a page that lists all the pages in the index along with their metadata.",
|
||||
"id" => "page-list",
|
||||
|
@ -32,7 +32,10 @@ register_module([
|
|||
$format = $_GET["format"] ?? "html";
|
||||
|
||||
$sorted_pageindex = get_object_vars($pageindex);
|
||||
ksort($sorted_pageindex, SORT_NATURAL);
|
||||
$sorter = new Collator("");
|
||||
uksort($sorted_pageindex, function($a, $b) use($sorter) : int {
|
||||
return $sorter->compare($a, $b);
|
||||
});
|
||||
|
||||
switch($format) {
|
||||
case "html":
|
||||
|
|
|
@ -132,7 +132,8 @@ register_module([
|
|||
$orphaned_pages[] = $pagename;
|
||||
}
|
||||
|
||||
sort($orphaned_pages);
|
||||
$sorter = new Collator("");
|
||||
$sorter->sort($orphaned_pages);
|
||||
|
||||
$result->value = $orphaned_pages;
|
||||
$result->completed = true;
|
||||
|
|
Loading…
Reference in a new issue