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

Commit 5367b69

Browse files
committed
fix regex to skip html tags, makes testShouldNotTouchHtmlTags() pass
1 parent d0acd47 commit 5367b69

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Generator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private function adjustString($s)
8080
}
8181

8282
return preg_replace_callback(
83-
'/:\w*/',
83+
'/(<[^>]*>(*SKIP)(*FAIL)|:\w*)/',
8484
function ($matches) {
8585
return '{' . mb_substr($matches[0], 1) . '}';
8686
},

tests/GenerateTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function testNamed()
119119
$this->destroyLocaleFilesFrom($arr, $root);
120120
}
121121

122-
function testLeaveHtmlTags()
122+
function testShouldNotTouchHtmlTags()
123123
{
124124
$arr = [
125125
'en' => [
@@ -135,7 +135,7 @@ function testLeaveHtmlTags()
135135
'export default {' . PHP_EOL
136136
. ' "en": {' . PHP_EOL
137137
. ' "help": {' . PHP_EOL
138-
. ' "yes": "see <a href=\"mailto:mail@com\">",' . PHP_EOL
138+
. ' "yes": "see <a href=\"mailto:mail@com\">"' . PHP_EOL
139139
. ' }' . PHP_EOL
140140
. ' }' . PHP_EOL
141141
. '}' . PHP_EOL,

0 commit comments

Comments
 (0)