Skip to content

Commit 5ceb189

Browse files
committed
at least do not silently swallow any formatted text in lists
1 parent 334fd57 commit 5ceb189

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/PhpWord/Shared/Html.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,15 @@ private static function parseListItem($node, $element, &$styles, $data)
326326
if (count($cNodes) > 0) {
327327
$text = '';
328328
foreach ($cNodes as $cNode) {
329-
if ($cNode->nodeName == '#text') {
330-
$text = $cNode->nodeValue;
329+
// at least do not silently swallow any formatted text in lists
330+
$types = array('#text', 'strong', 'em', 'span');
331+
if (in_array($cNode->nodeName, $types)) {
332+
$text .= $cNode->nodeValue;
331333
}
332334

333335
//ideally we should be parsing child nodes for any style, for now just take the text
334336
if ('' == trim($text) && '' != trim($node->textContent)) {
335-
$text = trim($node->textContent);
337+
$text .= trim($node->textContent);
336338
}
337339
}
338340
$element->addListItem($text, $data['listdepth'], $styles['font'], $styles['list'], $styles['paragraph']);

0 commit comments

Comments
 (0)