html2doc 1.8.5 → 1.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/html2doc.gemspec +1 -1
- data/lib/html2doc/mime.rb +3 -3
- data/lib/html2doc/version.rb +1 -1
- data/lib/html2doc/xml.rb +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 563dde5d3ec00d1784672a23c75c6db13927399428862bf7bb2a6bb7806bc99d
|
4
|
+
data.tar.gz: 0bfb562fa02686ecb94445ae13c878dbe0a3201d936df75799ae7cec19d5b2a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 957bdc4a94fd2d6bd35e9a490c7330d0f6e7ea910756fcaf13a414fd6247a93c79ab4bdc78bdb5beb9e7b31edd2b7bdaadfdd4fe25e9bd9a86f40e3c11dac6f9
|
7
|
+
data.tar.gz: f0292a9acd9cad87f58ca5e0e203ca1f049e4cac8bb06926dafc5448a026143e01db3ccc7a8f7d0cd6cdad0f7df9a8a5f881bd945476fedc8bc05fd3687ee0a3
|
data/html2doc.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_dependency "base64"
|
30
30
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
31
|
-
spec.add_dependency "metanorma-utils", "
|
31
|
+
spec.add_dependency "metanorma-utils", ">= 1.9.0"
|
32
32
|
spec.add_dependency "mime-types"
|
33
33
|
spec.add_dependency "nokogiri", "~> 1.16"
|
34
34
|
spec.add_dependency "plane1converter", "~> 0.0.1"
|
data/lib/html2doc/mime.rb
CHANGED
@@ -48,7 +48,7 @@ class Html2Doc
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def mime_boundary
|
51
|
-
salt = UUIDTools::UUID.random_create.to_s.
|
51
|
+
salt = UUIDTools::UUID.random_create.to_s.tr("-", ".")[0..17]
|
52
52
|
"----=_NextPart_#{salt}"
|
53
53
|
end
|
54
54
|
|
@@ -67,10 +67,10 @@ class Html2Doc
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def contentid(mhtml)
|
70
|
-
mhtml.gsub %r{(<img[
|
70
|
+
mhtml.gsub %r{(<img[^<>]*?src=")([^"'<]+)(['"])}m do |m|
|
71
71
|
repl = "#{$1}cid:#{File.basename($2)}#{$3}"
|
72
72
|
/^data:|^https?:/ =~ $2 ? m : repl
|
73
|
-
end.gsub %r{(<v:imagedata[
|
73
|
+
end.gsub %r{(<v:imagedata[^<>]*?src=")([^"'<]+)(['"])}m do |m|
|
74
74
|
repl = "#{$1}cid:#{File.basename($2)}#{$3}"
|
75
75
|
/^data:|^https?:/ =~ $2 ? m : repl
|
76
76
|
end
|
data/lib/html2doc/version.rb
CHANGED
data/lib/html2doc/xml.rb
CHANGED
@@ -8,12 +8,12 @@ class Html2Doc
|
|
8
8
|
HERE
|
9
9
|
|
10
10
|
def to_xhtml(xml)
|
11
|
-
xml.gsub!(/<\?xml[
|
11
|
+
xml.gsub!(/<\?xml[^<>]*>/, "")
|
12
12
|
unless /<!DOCTYPE /.match? xml
|
13
13
|
xml = '<!DOCTYPE html SYSTEM
|
14
14
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' + xml
|
15
15
|
end
|
16
|
-
xml = xml.gsub(/<!--\s*\[([
|
16
|
+
xml = xml.gsub(/<!--\s*\[([^\<\]]+)\]>/, "<!-- MSWORD-COMMENT \\1 -->")
|
17
17
|
.gsub(/<!\s*\[endif\]\s*-->/, "<!-- MSWORD-COMMENT-END -->")
|
18
18
|
Nokogiri::XML.parse(xml)
|
19
19
|
end
|
@@ -38,7 +38,7 @@ class Html2Doc
|
|
38
38
|
'<span style="mso-special-character:footnote"></span>')
|
39
39
|
doc.gsub!(%r{<div style="mso-element:footnote-list"></div>},
|
40
40
|
'<div style="mso-element:footnote-list"/>')
|
41
|
-
doc.gsub!(%r{(<a style="mso-comment-reference:[
|
41
|
+
doc.gsub!(%r{(<a style="mso-comment-reference:[^<>/]+)/>}, "\\1></a>")
|
42
42
|
doc.gsub!(%r{<link rel="File-List"}, "<link rel=File-List")
|
43
43
|
doc.gsub!(%r{<meta http-equiv="Content-Type"},
|
44
44
|
"<meta http-equiv=Content-Type")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html2doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: metanorma-utils
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.9.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.9.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mime-types
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|