Updated extensions, better support for footnotes

This commit is contained in:
markseu 2023-09-12 11:23:35 +02:00
parent ec27937ade
commit d574a35872
3 changed files with 28 additions and 6 deletions

View file

@ -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);

View file

@ -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 = "";

View file

@ -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