Skip to content
This repository was archived by the owner on Apr 4, 2020. It is now read-only.

Commit 128893c

Browse files
committed
Fix incorrect parenthesis order (#13)
1 parent c13eefe commit 128893c

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased][unreleased]
99

10+
### Fixed
11+
12+
- Fixed incorrect parenthesis order (#13)
13+
1014
## [1.0.0] - 2019-06-29
1115

1216
No changes have been introduced since 1.0.0-beta3.

src/UrlAutolinkProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private static function processAutolinks(Text $node, $regex)
105105
// Does the URL need its closing paren chopped off?
106106
if (\substr($content, -1) === ')' && self::hasMoreCloserParensThanOpeners($content)) {
107107
$content = \substr($content, 0, -1);
108-
$leftovers .= ')';
108+
$leftovers = ')' . $leftovers;
109109
}
110110

111111
self::addLink($node, $content);

tests/UrlAutolinkProcessorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function dataProviderForAutolinkTests()
6262
yield ['www.google.com/search?q=Markup+(business)', '<p><a href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a></p>'];
6363
yield ['(www.google.com/search?q=Markup+(business))', '<p>(<a href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a>)</p>'];
6464
yield ['www.google.com/search?q=(business))+ok', '<p><a href="http://www.google.com/search?q=(business))+ok">www.google.com/search?q=(business))+ok</a></p>'];
65+
yield ['(https://www.example.com/test).', '<p>(<a href="https://www.example.com/test">https://www.example.com/test</a>).</p>'];
6566

6667
// Tests involving semi-colon endings
6768
yield ['www.google.com/search?q=commonmark&hl=en', '<p><a href="http://www.google.com/search?q=commonmark&amp;hl=en">www.google.com/search?q=commonmark&amp;hl=en</a></p>'];

0 commit comments

Comments
 (0)