mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Fix numerated lists in mail summary content (#5828)
* Fix numerated lists in mail summary content * Fix numerated lists in mail summary content * Test for numerated list in preview/short rich text * Test for numerated list in preview/short rich text
This commit is contained in:
parent
965d3b87a4
commit
df64d6de4f
@ -5,6 +5,7 @@ HumHub Changelog
|
|||||||
----------------------
|
----------------------
|
||||||
- Fix #5822: Fix content width in mobile view
|
- Fix #5822: Fix content width in mobile view
|
||||||
- Fix #5825: Fix format date to mysql on date stream filter
|
- Fix #5825: Fix format date to mysql on date stream filter
|
||||||
|
- Fix #5814: Fix numerated lists in mail summary content
|
||||||
- Fix #5830: Fix cron job of search index rebuilding
|
- Fix #5830: Fix cron job of search index rebuilding
|
||||||
|
|
||||||
1.12.0 (July 27, 2022)
|
1.12.0 (July 27, 2022)
|
||||||
|
@ -522,6 +522,17 @@ class RichTextShortTextConverterTest extends HumHubDbTestCase
|
|||||||
"This is a list 1. First Element 2. Second Element");
|
"This is a list 1. First Element 2. Second Element");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testConvertOrderedListWithCustomNumbers()
|
||||||
|
{
|
||||||
|
$this->assertConversionResult(
|
||||||
|
"This is a list\n\n21. November - First line\n22. November - Second line\n23. November - Third line",
|
||||||
|
'This is a list 21. November - First line 22. November - Second line 23. November - Third line');
|
||||||
|
|
||||||
|
$this->assertConversionResult(
|
||||||
|
"This is a list\n\n29. November - First line\n24. November - Second line\n15. November - Third line",
|
||||||
|
'This is a list 29. November - First line 24. November - Second line 15. November - Third line');
|
||||||
|
}
|
||||||
|
|
||||||
public function testConvertOrderedSubList()
|
public function testConvertOrderedSubList()
|
||||||
{
|
{
|
||||||
$this->assertConversionResult(
|
$this->assertConversionResult(
|
||||||
|
@ -539,4 +539,24 @@ REGEXP;
|
|||||||
{
|
{
|
||||||
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $text);
|
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
protected function consumeOl($lines, $current)
|
||||||
|
{
|
||||||
|
$result = parent::consumeOl($lines, $current);
|
||||||
|
|
||||||
|
if (is_array($lines) && count($lines) > 0 && !empty($result[0]['items'])) {
|
||||||
|
$result[0]['origNums'] = [];
|
||||||
|
$i = array_keys($result[0]['items'])[0];
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
if (preg_match('/^(\d+)\./', $line, $num)) {
|
||||||
|
$result[0]['origNums'][$i++] = $num[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
@ -178,7 +178,7 @@ class RichTextToMarkdownConverter extends BaseRichTextConverter
|
|||||||
unset( $line );
|
unset( $line );
|
||||||
|
|
||||||
$output .= $level !== 0 ? "\n".str_repeat(' ', $level * 3) : '';
|
$output .= $level !== 0 ? "\n".str_repeat(' ', $level * 3) : '';
|
||||||
$output .= $block['list'] === 'ol' ? ++$count.'. ' : '- ';
|
$output .= $block['list'] === 'ol' ? (isset($block['origNums'][$item]) ? $block['origNums'][$item] : ++$count).'. ' : '- ';
|
||||||
$output .= $this->renderAbsy($itemLines). ($level === 0 ? "\n" : '');
|
$output .= $this->renderAbsy($itemLines). ($level === 0 ? "\n" : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user