File tree 1 file changed +5
-10
lines changed
Filter options
1 file changed +5
-10
lines changed
Original file line number Diff line number Diff line change @@ -35,19 +35,14 @@ class InlineHtmlParser extends AbstractParser
35
35
protected array $ items = [];
36
36
37
37
/**
38
- * There is a bug with the Stillat\BladeParser\Document\Document::fromText parser.
39
- * It doesn't parse the special characters correctly. It treats these characters
38
+ * Stillat\BladeParser\Document\Document::fromText treats multibyte characters
40
39
* as indentations and spaces resulting in a miscalculated Node position.
41
40
*
42
- * This function replaces the special characters with a single, placeholder character
41
+ * This function replaces the multibyte characters with a single, placeholder character
43
42
*/
44
- private function replaceSpecialAndEmoji (string $ text , string $ placeholder = '* ' ): string
43
+ private function replaceMultibyteChars (string $ text , string $ placeholder = '* ' ): string
45
44
{
46
- return preg_replace (
47
- '/[\x{3040}-\x{30FF}\x{4E00}-\x{9FFF}\x{1F300}-\x{1FAFF}\x{1F000}-\x{1F6FF}\x{2190}-\x{21AA}\x{2300}-\x{23FF}\x{25A0}-\x{25FF}\x{1F600}-\x{1F64F}\x{1F680}-\x{1F6FF}\x{2700}-\x{27BF}]/u ' ,
48
- $ placeholder ,
49
- $ text
50
- );
45
+ return preg_replace ('/[^\x00-\x7F]/u ' , $ placeholder , $ text );
51
46
}
52
47
53
48
public function parse (InlineHtml $ node )
@@ -63,7 +58,7 @@ public function parse(InlineHtml $node)
63
58
}
64
59
65
60
$ this ->parseBladeContent (Document::fromText (
66
- $ this ->replaceSpecialAndEmoji ($ node ->getText ())
61
+ $ this ->replaceMultibyteChars ($ node ->getText ())
67
62
));
68
63
69
64
if (count ($ this ->items )) {
You can’t perform that action at this time.
0 commit comments