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 +4 -4
- data/lib/canon/pretty_printer/html.rb +15 -7
- data/lib/canon/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: 4fd3055b37e95e61ad3a0ae681f7ff189110e0c165d16eeb8cc8a5622c4d0c90
|
|
4
|
+
data.tar.gz: 8fe029c9c738bd420d00987c1d3294135d3ba2e0c887ce79d776d2174a200cea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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