mikuli.cz

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

commit c0e9f65e5a6b34e28927c2306f450a153d556bee
parent 913a5b637c6219720a76663fccaf4f3a631c4441
Author: markseu <mark2011@mayberg.se>
Date:   Mon, 22 Dec 2014 12:38:42 +0100

Markdown extra update (latest version)

Diffstat:
MREADME.md | 2+-
Msystem/plugins/markdownextra.php | 18+++++++++++-------
2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md @@ -1,4 +1,4 @@ -Yellow 0.4.15 +Yellow 0.4.16 ============= [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/markseu/yellowcms) diff --git a/system/plugins/markdownextra.php b/system/plugins/markdownextra.php @@ -5,7 +5,7 @@ // Markdown extra plugin class YellowMarkdownExtra { - const Version = "0.4.1"; + const Version = "0.4.2"; var $yellow; //access to API // Handle plugin initialisation @@ -1852,9 +1852,9 @@ class MarkdownExtraParser extends MarkdownParser { ### Extra Attribute Parser ### # Expression to use to catch attributes (includes the braces) - protected $id_class_attr_catch_re = '\{((?:[ ]*[#.][-_:a-zA-Z0-9]+){1,})[ ]*\}'; + protected $id_class_attr_catch_re = '\{((?:[ ]*[#.a-z][-_:a-zA-Z0-9=]+){1,})[ ]*\}'; # Expression to use when parsing in a context when no capture is desired - protected $id_class_attr_nocatch_re = '\{(?:[ ]*[#.][-_:a-zA-Z0-9]+){1,}[ ]*\}'; + protected $id_class_attr_nocatch_re = '\{(?:[ ]*[#.a-z][-_:a-zA-Z0-9=]+){1,}[ ]*\}'; protected function doExtraAttributes($tag_name, $attr) { # @@ -1866,17 +1866,21 @@ class MarkdownExtraParser extends MarkdownParser { if (empty($attr)) return ""; # Split on components - preg_match_all('/[#.][-_:a-zA-Z0-9]+/', $attr, $matches); + preg_match_all('/[#.a-z][-_:a-zA-Z0-9=]+/', $attr, $matches); $elements = $matches[0]; # handle classes and ids (only first id taken into account) $classes = array(); + $attributes = array(); $id = false; foreach ($elements as $element) { if ($element{0} == '.') { $classes[] = substr($element, 1); } else if ($element{0} == '#') { if ($id === false) $id = substr($element, 1); + } else if (strpos($element, '=') > 0) { + $parts = explode('=', $element, 2); + $attributes[] = $parts[0] . '="' . $parts[1] . '"'; } } @@ -1888,6 +1892,9 @@ class MarkdownExtraParser extends MarkdownParser { if (!empty($classes)) { $attr_str .= ' class="'.implode(" ", $classes).'"'; } + if (!$this->no_markup && !empty($attributes)) { + $attr_str .= ' '.implode(" ", $attributes); + } return $attr_str; } @@ -2856,9 +2863,6 @@ class MarkdownExtraParser extends MarkdownParser { # # Form HTML definition lists. # - # Prevent unescaped text, security bugfix for https://github.com/michelf/php-markdown/issues/175 - if ($this->no_markup) return $text; - $less_than_tab = $this->tab_width - 1; # Re-usable pattern to match any entire dl list: