fix: honor start="0" on ordered lists
The ordered-list numbering used intval() on the "start" attribute inside a truthiness check, so a valid start="0" was treated as absent and the list restarted numbering at 1. Detect an explicit numeric start attribute with is_numeric() instead, so <ol start=\"0\"> renders as 0. 1. ...
This commit is contained in:
1 parent
e017c9ceda
commit
19b1be8421
3 files changed
+76
-2
No files matched your search
@@ -52,8 +52,8 @@ class ListItemConverter implements ConverterInterface, ConfigurationAwareInterfa
|
||||
return $prefix . $this->listItemStyle . ' ' . $value . "\n";
|
||||
}
|
||||
|
||||
if ($listType === 'ol' && ($parent = $element->getParent()) && ($start = \intval($parent->getAttribute('start')))) {
|
||||
$number = $start + $element->getSiblingPosition() - 1;
|
||||
if ($listType === 'ol' && ($parent = $element->getParent()) && \is_numeric($start = $parent->getAttribute('start'))) {
|
||||
$number = (int) $start + $element->getSiblingPosition() - 1;
|
||||
} else {
|
||||
$number = $element->getSiblingPosition();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user