Better location handling (snowflake remix)
This commit is contained in:
parent
6a071c1c5f
commit
cbb2e8ce60
1 changed files with 6 additions and 6 deletions
|
@ -5,7 +5,7 @@
|
|||
// Markdown extra core plugin
|
||||
class YellowMarkdownExtra
|
||||
{
|
||||
const Version = "0.2.6";
|
||||
const Version = "0.2.7";
|
||||
var $yellow; //access to API
|
||||
var $textHtml; //generated text (HTML format)
|
||||
|
||||
|
@ -15,11 +15,11 @@ class YellowMarkdownExtra
|
|||
$this->yellow = $yellow;
|
||||
}
|
||||
|
||||
// Handle text parsing
|
||||
// Handle page parsing
|
||||
function onParse($page, $text)
|
||||
{
|
||||
$markdown = new YellowMarkdownExtraParser($this->yellow);
|
||||
$this->textHtml = $markdown->transform($page, $text);
|
||||
$this->textHtml = $markdown->transformPage($page, $text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,15 +34,15 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
// Transform text
|
||||
function transform($page, $text)
|
||||
// Transform page text
|
||||
function transformPage($page, $text)
|
||||
{
|
||||
$location = $this->yellow->toolbox->getDirectoryLocation($page->getLocation());
|
||||
$text = preg_replace("/@pageRead/i", $page->get("pageRead"), $text);
|
||||
$text = preg_replace("/@pageEdit/i", $page->get("pageEdit"), $text);
|
||||
$text = preg_replace("/@pageError/i", $page->get("pageError"), $text);
|
||||
return preg_replace("/<a(.*?)href=\"(?!javascript:)([^\/\"]+)\"(.*?)>/i",
|
||||
"<a$1href=\"$location$2\"$3>", parent::transform($text));
|
||||
"<a$1href=\"$location$2\"$3>", $this->transform($text));
|
||||
}
|
||||
|
||||
// Handle links
|
||||
|
|
Loading…
Add table
Reference in a new issue