Page MenuHomePhabricator

D20631.id49212.diff
No OneTemporary

D20631.id49212.diff

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

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)

Event Timeline