Skip to content

Commit

Permalink
fix code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
troosan committed Apr 14, 2018
1 parent 6ba2df4 commit 9bc8534
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ v0.15.0 (?? ??? 2018)
- Added support for Image text wrapping distance @troosan #1310
- Added parsing of CSS line-height and text-indent in HTML reader @troosan #1316
- Added the ability to enable gridlines and axislabels on charts @FrankMeyer #576
- Added parsing of internal links in HTML reader @lalop #1336

### Fixed
- Fix reading of docx default style - @troosan #1238
Expand Down
8 changes: 4 additions & 4 deletions src/PhpWord/Shared/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -723,10 +723,10 @@ private static function parseLink($node, $element, &$styles)
}
self::parseInlineStyle($node, $styles['font']);

if(strpos($target, '#') === 0) {
return $element->addLink(substr($target, 1), $node->textContent, $styles['font'], $styles['paragraph'], true);
} else {
return $element->addLink($target, $node->textContent, $styles['font'], $styles['paragraph']);
if (strpos($target, '#') === 0) {
return $element->addLink(substr($target, 1), $node->textContent, $styles['font'], $styles['paragraph'], true);
}

return $element->addLink($target, $node->textContent, $styles['font'], $styles['paragraph']);
}
}
3 changes: 1 addition & 2 deletions tests/PhpWord/Shared/HtmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public function testParseLink()

$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);

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addBookmark('bookmark');
Expand All @@ -464,7 +464,6 @@ public function testParseLink()
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink'));
$this->assertTrue($doc->getElement('/w:document/w:body/w:p/w:hyperlink')->hasAttribute('w:anchor'));
$this->assertEquals('bookmark', $doc->getElement('/w:document/w:body/w:p/w:hyperlink')->getAttribute('w:anchor'));

}

public function testParseMalformedStyleIsIgnored()
Expand Down

0 comments on commit 9bc8534

Please sign in to comment.