mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 16:33:00 +00:00
Implement short image links. Fixes #24.
This commit is contained in:
parent
93f91b40c7
commit
a075f8aa0a
3 changed files with 17 additions and 3 deletions
|
@ -4645,6 +4645,7 @@ class PeppermintParsedown extends ParsedownExtra
|
|||
|
||||
protected function inlineExtendedImage($fragment)
|
||||
{
|
||||
global $pageindex;
|
||||
///^!\[(.*)\]\(([^ |)]+)\s*(?:\|([^|)]*)(?:\|([^)]*))?)?\)/
|
||||
if(preg_match('/^!\[(.*)\]\(([^ |)]+)\s*(?:\|([^|)]*))?(?:\|([^|)]*))?(?:\|([^)]*))?\)/', $fragment["text"], $matches))
|
||||
{
|
||||
|
@ -4701,6 +4702,12 @@ class PeppermintParsedown extends ParsedownExtra
|
|||
if($param3 !== false && strtolower(trim($param3)) == "caption")
|
||||
$imageCaption = true;
|
||||
|
||||
if(isset($pageindex->$imageUrl) and $pageindex->$imageUrl->uploadedfile)
|
||||
{
|
||||
// We have a short url! Expand it.
|
||||
$imageUrl = "index.php?action=preview&size=" . max($imageSize["x"], $imageSize["y"]) ."&page=" . rawurlencode($imageUrl);
|
||||
}
|
||||
|
||||
$style = "";
|
||||
if($imageSize !== false)
|
||||
$style .= " max-width: " . $imageSize["x"] . "px; max-height: " . $imageSize["y"] . "px;";
|
||||
|
@ -4771,7 +4778,7 @@ class PeppermintParsedown extends ParsedownExtra
|
|||
$result["element"],
|
||||
[
|
||||
"name" => "figcaption",
|
||||
"text" => htmlentities($altText)
|
||||
"text" => $altText
|
||||
],
|
||||
],
|
||||
"attributes" => [
|
||||
|
|
|
@ -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 some weight to your installation, and also *requires* write access to the disk on first load.",
|
||||
"id": "parser-parsedown",
|
||||
"lastupdate": 1464550150,
|
||||
"lastupdate": 1464601879,
|
||||
"optional": false
|
||||
}
|
||||
]
|
|
@ -331,6 +331,7 @@ class PeppermintParsedown extends ParsedownExtra
|
|||
|
||||
protected function inlineExtendedImage($fragment)
|
||||
{
|
||||
global $pageindex;
|
||||
///^!\[(.*)\]\(([^ |)]+)\s*(?:\|([^|)]*)(?:\|([^)]*))?)?\)/
|
||||
if(preg_match('/^!\[(.*)\]\(([^ |)]+)\s*(?:\|([^|)]*))?(?:\|([^|)]*))?(?:\|([^)]*))?\)/', $fragment["text"], $matches))
|
||||
{
|
||||
|
@ -387,6 +388,12 @@ class PeppermintParsedown extends ParsedownExtra
|
|||
if($param3 !== false && strtolower(trim($param3)) == "caption")
|
||||
$imageCaption = true;
|
||||
|
||||
if(isset($pageindex->$imageUrl) and $pageindex->$imageUrl->uploadedfile)
|
||||
{
|
||||
// We have a short url! Expand it.
|
||||
$imageUrl = "index.php?action=preview&size=" . max($imageSize["x"], $imageSize["y"]) ."&page=" . rawurlencode($imageUrl);
|
||||
}
|
||||
|
||||
$style = "";
|
||||
if($imageSize !== false)
|
||||
$style .= " max-width: " . $imageSize["x"] . "px; max-height: " . $imageSize["y"] . "px;";
|
||||
|
@ -457,7 +464,7 @@ class PeppermintParsedown extends ParsedownExtra
|
|||
$result["element"],
|
||||
[
|
||||
"name" => "figcaption",
|
||||
"text" => htmlentities($altText)
|
||||
"text" => $altText
|
||||
],
|
||||
],
|
||||
"attributes" => [
|
||||
|
|
Loading…
Reference in a new issue