update league/html-to-markdown via composer

This commit is contained in:
Mario Vavti
2018-01-12 22:32:42 +01:00
parent 50ec3b300b
commit 0f5bc00586
10 changed files with 428 additions and 439 deletions

View File

@@ -4,6 +4,14 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
## [Unreleased][unreleased]
## [4.6.2]
### Fixed
- Fixed issue with emphasized spaces (#146)
## [4.6.1]
### Fixed
- Fixed conversion of `<pre>` tags (#145)
## [4.6.0]
### Added
- Added support for ordered lists starting at numbers other than 1
@@ -199,7 +207,9 @@ not ideally set, so this releases fixes that. Moving forwards this should reduce
### Added
- Initial release
[unreleased]: https://github.com/thephpleague/html-to-markdown/compare/4.6.0...master
[unreleased]: https://github.com/thephpleague/html-to-markdown/compare/4.6.2...master
[4.6.2]: https://github.com/thephpleague/html-to-markdown/compare/4.6.1...4.6.2
[4.6.1]: https://github.com/thephpleague/html-to-markdown/compare/4.6.0...4.6.1
[4.6.0]: https://github.com/thephpleague/html-to-markdown/compare/4.5.0...4.6.0
[4.5.0]: https://github.com/thephpleague/html-to-markdown/compare/4.4.1...4.5.0
[4.4.1]: https://github.com/thephpleague/html-to-markdown/compare/4.4.0...4.4.1

View File

@@ -32,7 +32,7 @@ class EmphasisConverter implements ConverterInterface, ConfigurationAwareInterfa
$value = $element->getValue();
if (!trim($value)) {
return '';
return $value;
}
if ($tag === 'i' || $tag === 'em') {

View File

@@ -33,20 +33,27 @@ class PreformattedConverter implements ConverterInterface
// If the execution reaches this point it means it's just a pre tag, with no code tag nested
// Empty lines are a special case
if ($pre_content === '') {
return "```\n```\n";
}
// Normalizing new lines
$pre_content = preg_replace('/\r\n|\r|\n/', PHP_EOL, $pre_content);
// Checking if the string has multiple lines
$lines = preg_split('/\r\n|\r|\n/', $pre_content);
if (count($lines) > 1) {
// Multiple lines detected, adding three backticks and newlines
$markdown .= '```' . "\n" . $pre_content . "\n" . '```';
} else {
// Is it a single line?
if (strpos($pre_content, PHP_EOL) === false) {
// One line of code, wrapping it on one backtick.
$markdown .= '`' . $pre_content . '`';
return '`' . $pre_content . '`';
}
return $markdown;
// Ensure there's a newline at the end
if (strrpos($pre_content, PHP_EOL) !== strlen($pre_content) - 1) {
$pre_content .= PHP_EOL;
}
// Use three backticks
return "```\n" . $pre_content . "```\n";
}
/**