Skip to content

Commit 9bc8534

Browse files
committed
fix code formatting
1 parent 6ba2df4 commit 9bc8534

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ v0.15.0 (?? ??? 2018)
2020
- Added support for Image text wrapping distance @troosan #1310
2121
- Added parsing of CSS line-height and text-indent in HTML reader @troosan #1316
2222
- Added the ability to enable gridlines and axislabels on charts @FrankMeyer #576
23+
- Added parsing of internal links in HTML reader @lalop #1336
2324

2425
### Fixed
2526
- Fix reading of docx default style - @troosan #1238

src/PhpWord/Shared/Html.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,10 @@ private static function parseLink($node, $element, &$styles)
723723
}
724724
self::parseInlineStyle($node, $styles['font']);
725725

726-
if(strpos($target, '#') === 0) {
727-
return $element->addLink(substr($target, 1), $node->textContent, $styles['font'], $styles['paragraph'], true);
728-
} else {
729-
return $element->addLink($target, $node->textContent, $styles['font'], $styles['paragraph']);
726+
if (strpos($target, '#') === 0) {
727+
return $element->addLink(substr($target, 1), $node->textContent, $styles['font'], $styles['paragraph'], true);
730728
}
729+
730+
return $element->addLink($target, $node->textContent, $styles['font'], $styles['paragraph']);
731731
}
732732
}

tests/PhpWord/Shared/HtmlTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ public function testParseLink()
453453

454454
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink'));
455455
$this->assertEquals('link text', $doc->getElement('/w:document/w:body/w:p/w:hyperlink/w:r/w:t')->nodeValue);
456-
456+
457457
$phpWord = new \PhpOffice\PhpWord\PhpWord();
458458
$section = $phpWord->addSection();
459459
$section->addBookmark('bookmark');
@@ -464,7 +464,6 @@ public function testParseLink()
464464
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink'));
465465
$this->assertTrue($doc->getElement('/w:document/w:body/w:p/w:hyperlink')->hasAttribute('w:anchor'));
466466
$this->assertEquals('bookmark', $doc->getElement('/w:document/w:body/w:p/w:hyperlink')->getAttribute('w:anchor'));
467-
468467
}
469468

470469
public function testParseMalformedStyleIsIgnored()

0 commit comments

Comments
 (0)