canon 0.3.82 → 0.3.83

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: 6247e852d634ff01d8c91dba814cc1dbc1266ab9a4d2a1acde3951538d9592fc
4
- data.tar.gz: 69d4cd8b46214f5fb221f6ca7d5511207d51f188ffee251e77537cdd916223d8
3
+ metadata.gz: 4fd3055b37e95e61ad3a0ae681f7ff189110e0c165d16eeb8cc8a5622c4d0c90
4
+ data.tar.gz: 8fe029c9c738bd420d00987c1d3294135d3ba2e0c887ce79d776d2174a200cea
5
5
  SHA512:
6
- metadata.gz: c515a0e11aa4fb7c71464d43ccb406d3d330807705e40b6cb773b7b138865beb0c96e08dfd48a3093a81f0594a4c7b679e57f2b94cb5109b27447f007131277b
7
- data.tar.gz: c039d97d063e52571c6b9a7eced35afa09eaf9579581de963bd5da65845418d8a225c12506c293e162f520406f78ea53ffccdf1b5901decada3f7800699742da
6
+ metadata.gz: 458b046a6f3d1fcff7e3ee1cbb3dd8440410f50235f150752dda31c553c4381851483f957f8ac156a60e02b2a6fb2835d07a33a61d2eefa9a556bd3ed83fbfb4
7
+ data.tar.gz: 0c728faa6b73f461130ca780ee29d360e4ea71a64e723a990d488a677e161692e8ab4e65a903f8788ef9ff10dda749589b63386aeb8c93f372e1a6c3449f2a77
@@ -53,14 +53,22 @@ module Canon
53
53
  html_string.include?('xmlns="http://www.w3.org/1999/xhtml"')
54
54
  end
55
55
 
56
+ # XHTML is XML: the shared XML pretty-printer lane owns it (the
57
+ # leptris serializer under the default engine — Nokogiri serving
58
+ # only the forced-fallback engine), keeping the XML loud/tolerant
59
+ # parse contract and the engine's byte-faithful serializer.
60
+ #
61
+ # This replaces a direct Nokogiri::XML call whose serializer
62
+ # INJECTED a <meta http-equiv="Content-Type"> element into <head>
63
+ # of XHTML PUBLIC-doctype documents at serialization time — a
64
+ # pretty-printer must never invent content. Intentional byte
65
+ # changes vs the Nokogiri lane: the phantom meta is gone;
66
+ # body-level PIs/comments indent like every other child; void
67
+ # elements self-close without a space (<br/>).
56
68
  def format_as_xhtml(html_string)
57
- doc = Nokogiri::XML(html_string, &:noblanks)
58
-
59
- out = if @indent_type == "tab"
60
- doc.to_xml(indent: 1, indent_text: "\t", encoding: "UTF-8")
61
- else
62
- doc.to_xml(indent: @indent, encoding: "UTF-8")
63
- end
69
+ out = Canon::PrettyPrinter::Xml.new(
70
+ indent: @indent, indent_type: @indent_type,
71
+ ).format(html_string)
64
72
 
65
73
  expand_non_void_self_closing(out)
66
74
  end
data/lib/canon/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Canon
4
- VERSION = "0.3.82"
4
+ VERSION = "0.3.83"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.82
4
+ version: 0.3.83
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.