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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1eb9d918d0eb1683e04662e5aeca7950b148dbd80116d43dd5f04f434b9a9034
4
- data.tar.gz: 4631038216a5a0cb6b652ee2ba745d85fede3902cb5e53908a36e74963ae5644
3
+ metadata.gz: 72a1458a9c37027dedf18e1d3d1175cc4b544623af1ee53baf8eacf1bc89d7c4
4
+ data.tar.gz: 45622c7da01df4d9f61ba538d914c5174a10f6f6b71c57bfa101353aeaa1b929
5
5
  SHA512:
6
- metadata.gz: 4fe78070839a8674229a9eb60274979caf2bba98277ed9ea9c3a4c2937670a6ba0a10a3f8e958230f04c3667dacb8cac02012e84caf2303e4dd1e8539f7aa7c9
7
- data.tar.gz: 1fdf6b18e212321e788e5c0706738fc3a23d5dbd918f39a25e25e3b0c3b52042daf37c1fdfc42366c7d1d59db5dafd81220fb251a1b39e62e67fd2273256fb61
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 117 pages: the test fixtures, the
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
- flags = is_xml ? 0 : FLAGS[key]
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>, ...) and declarations never contain anything.
724
- is_void = flags & F_VOID != 0
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastHtmlParser
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fasthtmlparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - z3l