Bugfix: Include the rest of a word in internal links.

This commit is contained in:
Starbeamrainbowlabs 2017-02-25 10:57:10 +00:00
parent 1f92578030
commit b693953a5c
4 changed files with 8 additions and 7 deletions

View File

@ -19,6 +19,7 @@
- Added the `user_page_prefix` setting to allow customisation of where user pages should be located. Default value: `Users`
- [Module API] Added `get_user_pagename()` and `extract_user_from_userpage()` to allo programatic detection etc.
- Added a `user-list` action that, well, outputs a list of users. Includes links to their respective user pages (though redlinks aren't implemented here yet).
- Internal links like `[[Page name]]s` will now link to the correct page in include the rest of the word. Note that this functionality _can't_ be mixed with displayy text, like this: `[[Page name|Display text]]s` - the rest of the word will be silently ignored in the link!
### Changed
- Overhauled internal history logic - history logic is now done in core.
@ -34,7 +35,7 @@
- Recent changes made on different days are now displayed separately, as they should be (#112)
- Always display footer message at the bottom of the page.
- Trim the image url before short image url detection (#108)
- Fxed huge issue with `contentonly` display mode.
- Fixed huge issue with `contentonly` display mode.
- Improved the search engine indexing algorithm. It now shouldn't choke on certain special characters (`[]{}|`) and will treat them as word boundaries.
- Fixed tag links at the bottom of pages for tags with a single quote (`'`) in them.
- Correct error message when attempting to move a page

View File

@ -5967,9 +5967,9 @@ class PeppermintParsedown extends ParsedownExtra
{
global $pageindex, $env;
if(preg_match('/^\[\[([^\]]*)\]\]/', $fragment["text"], $matches))
if(preg_match('/^\[\[([^\]]*)\]\]([^\s!?",.()\[\]{}*=+\/]*)/u', $fragment["text"], $matches))
{
$display = $linkPage = trim($matches[1]);
$display = $linkPage = trim($matches[1]) . trim($matches[2]);
if(strpos($matches[1], "|") !== false || strpos($matches[1], "¦") !== false)
{
// We have a bar character

View File

@ -239,7 +239,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 some weight to your installation, and also *requires* write access to the disk on first load.",
"id": "parser-parsedown",
"lastupdate": 1483388764,
"lastupdate": 1488019684,
"optional": false
}
]

View File

@ -1,7 +1,7 @@
<?php
register_module([
"name" => "Parsedown",
"version" => "0.9.7",
"version" => "0.9.8",
"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, and also *requires* write access to the disk on first load.",
"id" => "parser-parsedown",
@ -315,9 +315,9 @@ class PeppermintParsedown extends ParsedownExtra
{
global $pageindex, $env;
if(preg_match('/^\[\[([^\]]*)\]\]/', $fragment["text"], $matches))
if(preg_match('/^\[\[([^\]]*)\]\]([^\s!?",.()\[\]{}*=+\/]*)/u', $fragment["text"], $matches))
{
$display = $linkPage = trim($matches[1]);
$display = $linkPage = trim($matches[1]) . trim($matches[2]);
if(strpos($matches[1], "|") !== false || strpos($matches[1], "¦") !== false)
{
// We have a bar character