fix parsing of link style
This commit is contained in:
parent
84fa44090f
commit
94be56b0ec
|
|
@ -11,7 +11,7 @@ $html = '<h1>Adding element via HTML</h1>';
|
|||
$html .= '<p>Some well-formed HTML snippet needs to be used</p>';
|
||||
$html .= '<p>With for example <strong>some<sup>1</sup> <em>inline</em> formatting</strong><sub>1</sub></p>';
|
||||
|
||||
$html .= '<p>A link to <a href="http://phpword.readthedocs.io/">Read the docs</a></p>';
|
||||
$html .= '<p>A link to <a href="http://phpword.readthedocs.io/" style="text-decoration: underline">Read the docs</a></p>';
|
||||
|
||||
$html .= '<p lang="he-IL" style="text-align: right; direction: rtl">היי, זה פסקה מימין לשמאל</p>';
|
||||
|
||||
|
|
|
|||
|
|
@ -721,7 +721,7 @@ class Html
|
|||
break;
|
||||
}
|
||||
}
|
||||
self::parseInlineStyle($node, $styles['font']);
|
||||
$styles['font'] = self::parseInlineStyle($node, $styles['font']);
|
||||
|
||||
if (strpos($target, '#') === 0) {
|
||||
return $element->addLink(substr($target, 1), $node->textContent, $styles['font'], $styles['paragraph'], true);
|
||||
|
|
|
|||
|
|
@ -458,6 +458,8 @@ class HtmlTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink'));
|
||||
$this->assertEquals('link text', $doc->getElement('/w:document/w:body/w:p/w:hyperlink/w:r/w:t')->nodeValue);
|
||||
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink/w:r/w:rPr/w:u'));
|
||||
$this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:hyperlink/w:r/w:rPr/w:u', 'w:val'));
|
||||
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
|
|
|
|||
Loading…
Reference in New Issue