Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13970023
D20631.id49212.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1006 B
Referenced Files
None
Subscribers
None
D20631.id49212.diff
View Options
diff --git a/src/parser/html/PhutilHTMLParser.php b/src/parser/html/PhutilHTMLParser.php
--- a/src/parser/html/PhutilHTMLParser.php
+++ b/src/parser/html/PhutilHTMLParser.php
@@ -30,9 +30,13 @@
continue;
}
- if (!$in_tag && ($c === '<')) {
+ // When we encounter a "<", we start a new tag whether we're already in
+ // a tag or not. We want to parse "<x>1 < 2</x>" as a single tag with
+ // the content "1 < 2".
+
+ if ($c === '<') {
$segments[] = array(
- 'tag' => $in_tag,
+ 'tag' => false,
'pos' => $segment_pos,
'end' => $ii,
);
diff --git a/src/parser/html/__tests__/data/tag-angle.txt b/src/parser/html/__tests__/data/tag-angle.txt
new file mode 100644
--- /dev/null
+++ b/src/parser/html/__tests__/data/tag-angle.txt
@@ -0,0 +1,13 @@
+<math>1 < 2</math>
+~~~~~~~~~~
+[
+ {
+ "tag": "math",
+ "attributes": {},
+ "children": [
+ {
+ "content": "1 < 2"
+ }
+ ]
+ }
+]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 18, 5:17 AM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6725133
Default Alt Text
D20631.id49212.diff (1006 B)
Attached To
Mode
D20631: When parsing HTML in remarkup, always start a new tag when encountering "<"
Attached
Detach File
Event Timeline
Log In to Comment