|
|
@ -1678,9 +1678,9 @@ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { |
|
|
### Extra Attribute Parser ###
|
|
|
### Extra Attribute Parser ###
|
|
|
|
|
|
|
|
|
# Expression to use to catch attributes (includes the braces)
|
|
|
# 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
|
|
|
# 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) { |
|
|
protected function doExtraAttributes($tag_name, $attr) { |
|
|
#
|
|
|
#
|
|
|
@ -1692,17 +1692,21 @@ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { |
|
|
if (empty($attr)) return ""; |
|
|
if (empty($attr)) return ""; |
|
|
|
|
|
|
|
|
# Split on components
|
|
|
# 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]; |
|
|
$elements = $matches[0]; |
|
|
|
|
|
|
|
|
# handle classes and ids (only first id taken into account)
|
|
|
# handle classes and ids (only first id taken into account)
|
|
|
$classes = array(); |
|
|
$classes = array(); |
|
|
|
|
|
$attributes = array(); |
|
|
$id = false; |
|
|
$id = false; |
|
|
foreach ($elements as $element) { |
|
|
foreach ($elements as $element) { |
|
|
if ($element{0} == '.') { |
|
|
if ($element{0} == '.') { |
|
|
$classes[] = substr($element, 1); |
|
|
$classes[] = substr($element, 1); |
|
|
} else if ($element{0} == '#') { |
|
|
} else if ($element{0} == '#') { |
|
|
if ($id === false) $id = substr($element, 1); |
|
|
if ($id === false) $id = substr($element, 1); |
|
|
|
|
|
} else if (strpos($element, '=') > 0) { |
|
|
|
|
|
$parts = explode('=', $element, 2); |
|
|
|
|
|
$attributes[] = $parts[0] . '="' . $parts[1] . '"'; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1714,6 +1718,9 @@ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { |
|
|
if (!empty($classes)) { |
|
|
if (!empty($classes)) { |
|
|
$attr_str .= ' class="'.implode(" ", $classes).'"'; |
|
|
$attr_str .= ' class="'.implode(" ", $classes).'"'; |
|
|
} |
|
|
} |
|
|
|
|
|
if (!$this->no_markup && !empty($attributes)) { |
|
|
|
|
|
$attr_str .= ' '.implode(" ", $attributes); |
|
|
|
|
|
} |
|
|
return $attr_str; |
|
|
return $attr_str; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|