diff options
Diffstat (limited to 'vendor/league/html-to-markdown/src/Converter/ListItemConverter.php')
-rw-r--r-- | vendor/league/html-to-markdown/src/Converter/ListItemConverter.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php b/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php index dafec077c..f737b4e19 100644 --- a/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php +++ b/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php @@ -2,11 +2,26 @@ namespace League\HTMLToMarkdown\Converter; +use League\HTMLToMarkdown\Configuration; +use League\HTMLToMarkdown\ConfigurationAwareInterface; use League\HTMLToMarkdown\ElementInterface; -class ListItemConverter implements ConverterInterface +class ListItemConverter implements ConverterInterface, ConfigurationAwareInterface { /** + * @var Configuration + */ + protected $config; + + /** + * @param Configuration $config + */ + public function setConfig(Configuration $config) + { + $this->config = $config; + } + + /** * @param ElementInterface $element * * @return string @@ -29,10 +44,15 @@ class ListItemConverter implements ConverterInterface } if ($list_type === 'ul') { - return $prefix . '- ' . $value . "\n"; + $list_item_style = $this->config->getOption('list_item_style', '-'); + return $prefix . $list_item_style . ' ' . $value . "\n"; } - $number = $element->getSiblingPosition(); + if ($list_type === 'ol' && $start = $element->getParent()->getAttribute('start')) { + $number = $start + $element->getSiblingPosition() - 1; + } else { + $number = $element->getSiblingPosition(); + } return $prefix . $number . '. ' . $value . "\n"; } |