fasthtmlparser 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/fasthtmlparser/parser.rb +7 -3
- data/lib/fasthtmlparser/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 72a1458a9c37027dedf18e1d3d1175cc4b544623af1ee53baf8eacf1bc89d7c4
|
|
4
|
+
data.tar.gz: 45622c7da01df4d9f61ba538d914c5174a10f6f6b71c57bfa101353aeaa1b929
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5db82ddcfe62b16744c14e973a3c4ac75e0c51f302ccf8c987d570ec0d1bdfc72ff76141fd5f582aa1cd3e51764d578e3c9c0e5016f2a110f4bf2d5af608615a
|
|
7
|
+
data.tar.gz: 5ec9c282270638569f2d6d801d0a276f33944b9f77aa0cdcb49ac0fcd53827f1119c423bbe34c2315c25438bff958e3cf1a401e0cf59fc3dbed57f235962ba28
|
data/README.md
CHANGED
|
@@ -122,7 +122,7 @@ returned as written.
|
|
|
122
122
|
|
|
123
123
|
## Same results as the .NET version
|
|
124
124
|
|
|
125
|
-
The conformance tests compare the port with z3l.FastHtmlParser 1.4.1 (.NET) on
|
|
125
|
+
The conformance tests compare the port with z3l.FastHtmlParser 1.4.1 (.NET) on 121 pages: the test fixtures, the
|
|
126
126
|
broken-markup snippets of the .NET cross-check tests, extra edge cases (entities, raw text, comments, XML, custom
|
|
127
127
|
elements, 600-deep nesting, Unicode whitespace, links of every kind, line breaks), and every fixture with
|
|
128
128
|
`</li> </p> </td> </tr>` left out, plus three copies of each with random end tags dropped, names upper-cased and the
|
|
@@ -302,7 +302,8 @@ module FastHtmlParser
|
|
|
302
302
|
p += ss.skip(TAG_BODY) if src.getbyte(p) != 62
|
|
303
303
|
last = p < to ? src.getbyte(p - 1) : 0
|
|
304
304
|
if name && p < to && src.getbyte(p) == 62 && last < 0x80 && (key = KEYS[name] || (name.bytesize <= 32 && KEYS[name.downcase]))
|
|
305
|
-
|
|
305
|
+
# in XML only "?xml" is void here ('!' never takes this path)
|
|
306
|
+
flags = is_xml ? (c == 63 ? F_VOID : 0) : FLAGS[key]
|
|
306
307
|
if flags & F_RULE == 0 || stack_top == 0 || (top = keys[stack[stack_top - 1]]) < 0 || !RULES[key].t[top]
|
|
307
308
|
if open_p == 0 || flags & F_CLOSES_P == 0
|
|
308
309
|
# a known tag that ends no open tag
|
|
@@ -720,8 +721,11 @@ module FastHtmlParser
|
|
|
720
721
|
@inner_starts[index] = gt + 1
|
|
721
722
|
@inner_ends[index] = 0
|
|
722
723
|
|
|
723
|
-
# Void elements (<br>, <img>, <meta>, ...)
|
|
724
|
-
|
|
724
|
+
# Void elements (<br>, <img>, <meta>, ...) never contain anything. Neither does markup named "!..." or "?..."
|
|
725
|
+
# (<!doctype>, <?xml ...?>, <?php ...?>, <![if IE]>), in HTML and in XML alike: a bogus comment in a browser,
|
|
726
|
+
# a declaration or processing instruction in XML. first is a letter, '!' or '?' (63), and '!' and '?' sort
|
|
727
|
+
# before the letters: one compare.
|
|
728
|
+
is_void = first <= 63 || flags & F_VOID != 0
|
|
725
729
|
self_closing = is_void
|
|
726
730
|
unless self_closing
|
|
727
731
|
if last == 47
|