diff --git a/Changelog.md b/Changelog.md index 8ccb816..ce04b21 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,6 +21,7 @@ - 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 - 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 - 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. diff --git a/build/index.php b/build/index.php index 9d1eb7c..9a4d96c 100644 --- a/build/index.php +++ b/build/index.php @@ -330,6 +330,9 @@ h1 { text-align: center; } .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); } +a.redlink:link { color: rgb(230, 7, 7); } +a.redlink:visited { color: rgb(130, 15, 15); #8b1a1a } + .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::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) { - if(preg_match('/^\[\[(.*)\]\]/', $fragment["text"], $matches)) + global $pageindex; + + if(preg_match('/^\[\[([^\]]*)\]\]/', $fragment["text"], $matches)) { $display = $linkPage = $matches[1]; if(strpos($matches[1], "|")) @@ -4347,7 +4352,7 @@ class PeppermintParsedown extends ParsedownExtra $this->internalLinkBase ); - return [ + $result = [ "extent" => strlen($matches[0]), "element" => [ "name" => "a", @@ -4357,6 +4362,11 @@ class PeppermintParsedown extends ParsedownExtra ] ] ]; + + if(empty($pageindex->$linkPage)) + $result["element"]["attributes"]["class"] = "redlink"; + + return $result; } return; } diff --git a/module_index.json b/module_index.json index 9a539e4..a257e18 100644 --- a/module_index.json +++ b/module_index.json @@ -194,7 +194,7 @@ "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.", "id": "parser-parsedown", - "lastupdate": 1460102415, + "lastupdate": 1460104064, "optional": false } ] \ No newline at end of file diff --git a/modules/parser-parsedown.php b/modules/parser-parsedown.php index 74fe097..01e486f 100644 --- a/modules/parser-parsedown.php +++ b/modules/parser-parsedown.php @@ -212,7 +212,9 @@ class PeppermintParsedown extends ParsedownExtra protected function inlineInternalLink($fragment) { - if(preg_match('/^\[\[(.*)\]\]/', $fragment["text"], $matches)) + global $pageindex; + + if(preg_match('/^\[\[([^\]]*)\]\]/', $fragment["text"], $matches)) { $display = $linkPage = $matches[1]; if(strpos($matches[1], "|")) @@ -229,7 +231,7 @@ class PeppermintParsedown extends ParsedownExtra $this->internalLinkBase ); - return [ + $result = [ "extent" => strlen($matches[0]), "element" => [ "name" => "a", @@ -239,6 +241,11 @@ class PeppermintParsedown extends ParsedownExtra ] ] ]; + + if(empty($pageindex->$linkPage)) + $result["element"]["attributes"]["class"] = "redlink"; + + return $result; } return; } diff --git a/settings.fragment.php b/settings.fragment.php index debfef0..bf9ec46 100644 --- a/settings.fragment.php +++ b/settings.fragment.php @@ -327,6 +327,9 @@ h1 { text-align: center; } .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); } +a.redlink:link { color: rgb(230, 7, 7); } +a.redlink:visited { color: rgb(130, 15, 15); #8b1a1a } + .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::after { content: \"Rank: \" attr(data-rank); position: absolute; top: 3.8rem; right: 0.7rem; color: rgba(50, 50, 50, 0.3); }