mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit d574a358729b90f8b0257fcb3c51b37716b8bcc7
parent ec27937ade419ab02aa7e40a22e0289f337014cc
Author: markseu <mark2011@mayberg.se>
Date:   Tue, 12 Sep 2023 11:23:35 +0200

Updated extensions, better support for footnotes

Diffstat:
Msystem/extensions/core.php | 4+++-
Msystem/extensions/markdown.php | 22+++++++++++++++++++++-
Msystem/extensions/update-current.ini | 8++++----
3 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/system/extensions/core.php b/system/extensions/core.php @@ -2,7 +2,7 @@ // Core extension, https://github.com/annaesvensson/yellow-core class YellowCore { - const VERSION = "0.8.116"; + const VERSION = "0.8.117"; const RELEASE = "0.8.22"; public $content; // content files public $media; // media files @@ -1565,6 +1565,8 @@ class YellowLookup { } elseif (!preg_match("#^($pageBase|$mediaBase)#", $location)) { $location = $pageBase.$location; } + } else { + $location = $pageBase.$pageLocation.$location; } $location = str_replace("/./", "/", $location); $location = str_replace(":", $this->yellow->toolbox->getLocationArgumentsSeparator(), $location); diff --git a/system/extensions/markdown.php b/system/extensions/markdown.php @@ -2,7 +2,7 @@ // Markdown extension, https://github.com/annaesvensson/yellow-markdown class YellowMarkdown { - const VERSION = "0.8.24"; + const VERSION = "0.8.25"; public $yellow; // access to API // Handle initialisation @@ -3848,6 +3848,7 @@ class YellowMarkdownParser extends MarkdownExtraParser { }; $this->span_gamut += array("doStrikethrough" => 55); $this->block_gamut += array("doNoticeBlocks" => 65); + $this->document_gamut += array("doFootnotesLinks" => 55); $this->escape_chars .= "~"; parent::__construct(); } @@ -4026,6 +4027,25 @@ class YellowMarkdownParser extends MarkdownExtraParser { return "\n".$this->hashBlock($output)."\n\n"; } + // Handle footnotes links, normalise ids and links + public function doFootnotesLinks($text) { + if (!is_null($this->footnotes_assembled)) { + $callbackId = function ($matches) { + $id = str_replace(":", "-", $matches[2]); + return "<$matches[1] id=\"$id\" $matches[3]>"; + }; + $text = preg_replace_callback("/<(li|sup) id=\"(fn:\d+)\"(.*?)>/", $callbackId, $text); + $text = preg_replace_callback("/<(li|sup) id=\"(fnref\d*:\d+)\"(.*?)>/", $callbackId, $text); + $callbackHref = function ($matches) { + $href = $this->page->base.$this->page->location.str_replace(":", "-", $matches[2]); + return "<$matches[1] href=\"$href\" $matches[3]>"; + }; + $text = preg_replace_callback("/<(a) href=\"(#fn:\d+)\"(.*?)>/", $callbackHref, $text); + $text = preg_replace_callback("/<(a) href=\"(#fnref\d*:\d+)\"(.*?)>/", $callbackHref, $text); + } + return $text; + } + // Return unique id attribute public function getIdAttribute($text) { $attr = ""; diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini @@ -1,11 +1,11 @@ # Datenstrom Yellow update settings Extension: Core -Version: 0.8.116 +Version: 0.8.117 Description: Core functionality of your website. DocumentationUrl: https://github.com/annaesvensson/yellow-core DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/core.zip -Published: 2023-08-30 21:11:09 +Published: 2023-09-12 11:16:13 Developer: Anna Svensson Tag: feature system/extensions/core.php: core.php, create, update @@ -76,11 +76,11 @@ media/downloads/yellow.pdf: yellow.pdf, create ./robots.txt: robots.txt, create Extension: Markdown -Version: 0.8.24 +Version: 0.8.25 Description: Text formatting for humans. DocumentationUrl: https://github.com/annaesvensson/yellow-markdown DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/main/downloads/markdown.zip -Published: 2022-11-10 14:17:27 +Published: 2023-09-12 11:14:17 Developer: Anna Svensson Tag: feature system/extensions/markdown.php: markdown.php, create, update