1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-26 05:32:59 +00:00

Implement redlinks and fix another issue with the parser

This commit is contained in:
Starbeamrainbowlabs 2016-04-08 09:28:59 +01:00
parent 61efbda905
commit cdf56ca515
5 changed files with 26 additions and 5 deletions

View file

@ -21,6 +21,7 @@
- Fixed an issue with the recent changes page and redirects causing a large number of warnings - Fixed an issue with the recent changes page and redirects causing a large number of warnings
- Fixed a number of issues with the image syntax - Fixed a number of issues with the image syntax
- Image urls may now contain ampersands ('&') - Image urls may now contain ampersands ('&')
- Several warnings that were cropping up here and there due to bugs have been squashed
- Fixed a number of issues with the image preview generator - Fixed a number of issues with the image preview generator
- Requests for a previews of pages that don't have an associated file won't break anymore. An error image will now be returned instead. - Requests for a previews of pages that don't have an associated file won't break anymore. An error image will now be returned instead.
- A number of things that were not compatible with PHP 7 have been updated to ensure compatibility. - A number of things that were not compatible with PHP 7 have been updated to ensure compatibility.

View file

@ -330,6 +330,9 @@ h1 { text-align: center; }
.logo.small { max-width: 2rem; max-height: 2rem; } .logo.small { max-width: 2rem; max-height: 2rem; }
main:not(.printable) { padding: 2rem; background: #faf8fb; box-shadow: 0 0.1rem 1rem 0.3rem rgba(50, 50, 50, 0.5); } main:not(.printable) { padding: 2rem; background: #faf8fb; box-shadow: 0 0.1rem 1rem 0.3rem rgba(50, 50, 50, 0.5); }
a.redlink:link { color: rgb(230, 7, 7); }
a.redlink:visited { color: rgb(130, 15, 15); #8b1a1a }
.search-result { position: relative; } .search-result { position: relative; }
.search-result::before { content: attr(data-result-number); position: relative; top: 3.2rem; color: rgba(33, 33, 33, 0.3); font-size: 2rem; } .search-result::before { content: attr(data-result-number); position: relative; top: 3.2rem; color: rgba(33, 33, 33, 0.3); font-size: 2rem; }
.search-result::after { content: \"Rank: \" attr(data-rank); position: absolute; top: 3.8rem; right: 0.7rem; color: rgba(50, 50, 50, 0.3); } .search-result::after { content: \"Rank: \" attr(data-rank); position: absolute; top: 3.8rem; right: 0.7rem; color: rgba(50, 50, 50, 0.3); }
@ -4330,7 +4333,9 @@ class PeppermintParsedown extends ParsedownExtra
protected function inlineInternalLink($fragment) protected function inlineInternalLink($fragment)
{ {
if(preg_match('/^\[\[(.*)\]\]/', $fragment["text"], $matches)) global $pageindex;
if(preg_match('/^\[\[([^\]]*)\]\]/', $fragment["text"], $matches))
{ {
$display = $linkPage = $matches[1]; $display = $linkPage = $matches[1];
if(strpos($matches[1], "|")) if(strpos($matches[1], "|"))
@ -4347,7 +4352,7 @@ class PeppermintParsedown extends ParsedownExtra
$this->internalLinkBase $this->internalLinkBase
); );
return [ $result = [
"extent" => strlen($matches[0]), "extent" => strlen($matches[0]),
"element" => [ "element" => [
"name" => "a", "name" => "a",
@ -4357,6 +4362,11 @@ class PeppermintParsedown extends ParsedownExtra
] ]
] ]
]; ];
if(empty($pageindex->$linkPage))
$result["element"]["attributes"]["class"] = "redlink";
return $result;
} }
return; return;
} }

View file

@ -194,7 +194,7 @@
"author": "Emanuil Rusev & Starbeamrainbowlabs", "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 a some weight to your installation, and also *requires* write access to the disk on first load.", "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 a some weight to your installation, and also *requires* write access to the disk on first load.",
"id": "parser-parsedown", "id": "parser-parsedown",
"lastupdate": 1460102415, "lastupdate": 1460104064,
"optional": false "optional": false
} }
] ]

View file

@ -212,7 +212,9 @@ class PeppermintParsedown extends ParsedownExtra
protected function inlineInternalLink($fragment) protected function inlineInternalLink($fragment)
{ {
if(preg_match('/^\[\[(.*)\]\]/', $fragment["text"], $matches)) global $pageindex;
if(preg_match('/^\[\[([^\]]*)\]\]/', $fragment["text"], $matches))
{ {
$display = $linkPage = $matches[1]; $display = $linkPage = $matches[1];
if(strpos($matches[1], "|")) if(strpos($matches[1], "|"))
@ -229,7 +231,7 @@ class PeppermintParsedown extends ParsedownExtra
$this->internalLinkBase $this->internalLinkBase
); );
return [ $result = [
"extent" => strlen($matches[0]), "extent" => strlen($matches[0]),
"element" => [ "element" => [
"name" => "a", "name" => "a",
@ -239,6 +241,11 @@ class PeppermintParsedown extends ParsedownExtra
] ]
] ]
]; ];
if(empty($pageindex->$linkPage))
$result["element"]["attributes"]["class"] = "redlink";
return $result;
} }
return; return;
} }

View file

@ -327,6 +327,9 @@ h1 { text-align: center; }
.logo.small { max-width: 2rem; max-height: 2rem; } .logo.small { max-width: 2rem; max-height: 2rem; }
main:not(.printable) { padding: 2rem; background: #faf8fb; box-shadow: 0 0.1rem 1rem 0.3rem rgba(50, 50, 50, 0.5); } main:not(.printable) { padding: 2rem; background: #faf8fb; box-shadow: 0 0.1rem 1rem 0.3rem rgba(50, 50, 50, 0.5); }
a.redlink:link { color: rgb(230, 7, 7); }
a.redlink:visited { color: rgb(130, 15, 15); #8b1a1a }
.search-result { position: relative; } .search-result { position: relative; }
.search-result::before { content: attr(data-result-number); position: relative; top: 3.2rem; color: rgba(33, 33, 33, 0.3); font-size: 2rem; } .search-result::before { content: attr(data-result-number); position: relative; top: 3.2rem; color: rgba(33, 33, 33, 0.3); font-size: 2rem; }
.search-result::after { content: \"Rank: \" attr(data-rank); position: absolute; top: 3.8rem; right: 0.7rem; color: rgba(50, 50, 50, 0.3); } .search-result::after { content: \"Rank: \" attr(data-rank); position: absolute; top: 3.8rem; right: 0.7rem; color: rgba(50, 50, 50, 0.3); }