html2doc 1.8.8 → 1.9.0
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/html2doc.gemspec +5 -3
- data/lib/html2doc/notes.rb +23 -15
- data/lib/html2doc/version.rb +1 -1
- metadata +40 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd9aa0c3f133e294fecba1a04b8b3fb817029f5caef8449e00544e6b5f1e78f9
|
4
|
+
data.tar.gz: 7cca11025865ec7ed9e4cfd40223df969e2edbeae16809559ed10a9fae678056
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1d1308b98007926b078afb54e43906f613366236997f563141a56b9a7852d6d98a682fe920e5d9855c46233a04e71123cee8e7e5a6b46820cc22de5d2cd9859
|
7
|
+
data.tar.gz: e494f012eb58a10268227e3a445bc0ae2d592f023f2eb0d9fb57133d444bb507b8b5ec428018a8f7e01020e06b547593b1f41b208e8146ba136963e7fee99b03
|
data/html2doc.gemspec
CHANGED
@@ -28,11 +28,12 @@ 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 "lutaml-model", "~> 0.7.0"
|
31
32
|
spec.add_dependency "metanorma-utils", ">= 1.9.0"
|
32
33
|
spec.add_dependency "mime-types"
|
33
|
-
spec.add_dependency "nokogiri", "~> 1.
|
34
|
+
spec.add_dependency "nokogiri", "~> 1.18.3"
|
34
35
|
spec.add_dependency "plane1converter", "~> 0.0.1"
|
35
|
-
spec.add_dependency "plurimath", "~> 0.
|
36
|
+
spec.add_dependency "plurimath", "~> 0.9.0"
|
36
37
|
spec.add_dependency "thread_safe"
|
37
38
|
spec.add_dependency "uuidtools"
|
38
39
|
spec.add_dependency "unitsml"
|
@@ -45,7 +46,8 @@ Gem::Specification.new do |spec|
|
|
45
46
|
spec.add_development_dependency "rake", "~> 12.0"
|
46
47
|
spec.add_development_dependency "rspec", "~> 3.6"
|
47
48
|
spec.add_development_dependency "rspec-match_fuzzy", "~> 0.2.0"
|
48
|
-
spec.add_development_dependency "rubocop", "~> 1
|
49
|
+
spec.add_development_dependency "rubocop", "~> 1"
|
50
|
+
spec.add_development_dependency "rubocop-performance"
|
49
51
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
50
52
|
spec.add_development_dependency "timecop", "~> 0.9"
|
51
53
|
end
|
data/lib/html2doc/notes.rb
CHANGED
@@ -2,22 +2,27 @@ require "uuidtools"
|
|
2
2
|
|
3
3
|
class Html2Doc
|
4
4
|
def footnotes(docxml)
|
5
|
-
i = 1
|
5
|
+
#i = 1
|
6
|
+
indexes = {}
|
7
|
+
@footnote_idx = 1
|
6
8
|
fn = []
|
7
9
|
docxml.xpath("//a").each do |a|
|
8
|
-
|
9
|
-
|
10
|
-
i += 1
|
10
|
+
process_footnote_link(docxml, a, indexes, fn) or next
|
11
|
+
#i += 1
|
11
12
|
end
|
12
|
-
process_footnote_texts(docxml, fn)
|
13
|
+
process_footnote_texts(docxml, fn, indexes)
|
13
14
|
end
|
14
15
|
|
15
|
-
|
16
|
+
# Currently cannot deal with separate footnote containers in each chapter
|
17
|
+
# We may eventually need to support that
|
18
|
+
def process_footnote_texts(docxml, footnotes, indexes)
|
16
19
|
body = docxml.at("//body")
|
17
20
|
list = body.add_child("<div style='mso-element:footnote-list'/>")
|
18
|
-
footnotes.
|
19
|
-
|
21
|
+
footnotes.each do |f|
|
22
|
+
#require 'debug'; binding.b
|
23
|
+
fn = list.first.add_child(footnote_container(docxml, indexes[f["id"]]))
|
20
24
|
f.parent = fn.first
|
25
|
+
f["id"] = ""
|
21
26
|
footnote_div_to_p(f)
|
22
27
|
end
|
23
28
|
footnote_cleanup(docxml)
|
@@ -47,14 +52,17 @@ class Html2Doc
|
|
47
52
|
DIV
|
48
53
|
end
|
49
54
|
|
50
|
-
def process_footnote_link(docxml, elem,
|
51
|
-
|
52
|
-
|
55
|
+
def process_footnote_link(docxml, elem, indexes, footnote)
|
56
|
+
footnote?(elem) or return false
|
53
57
|
href = elem["href"].gsub(/^#/, "")
|
58
|
+
#require "debug"; binding.b
|
54
59
|
note = docxml.at("//*[@name = '#{href}' or @id = '#{href}']")
|
55
|
-
|
56
|
-
|
57
|
-
|
60
|
+
note.nil? and return false
|
61
|
+
unless indexes[href]
|
62
|
+
indexes[href] = @footnote_idx
|
63
|
+
@footnote_idx += 1
|
64
|
+
end
|
65
|
+
set_footnote_link_attrs(elem, indexes[href])
|
58
66
|
if elem.at("./span[@class = 'MsoFootnoteReference']")
|
59
67
|
process_footnote_link1(elem)
|
60
68
|
else elem.children = FN
|
@@ -73,7 +81,7 @@ class Html2Doc
|
|
73
81
|
end
|
74
82
|
|
75
83
|
def transform_footnote_text(note)
|
76
|
-
note["id"] = ""
|
84
|
+
#note["id"] = ""
|
77
85
|
note.xpath(".//div").each { |div| div.replace(div.children) }
|
78
86
|
note.xpath(".//aside | .//p").each do |p|
|
79
87
|
p.name = "p"
|
data/lib/html2doc/version.rb
CHANGED
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.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 4.3.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: lutaml-model
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.7.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.7.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: metanorma-utils
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +86,14 @@ dependencies:
|
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
89
|
+
version: 1.18.3
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
96
|
+
version: 1.18.3
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: plane1converter
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +114,14 @@ dependencies:
|
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
117
|
+
version: 0.9.0
|
104
118
|
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
124
|
+
version: 0.9.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: thread_safe
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,14 +282,28 @@ dependencies:
|
|
268
282
|
requirements:
|
269
283
|
- - "~>"
|
270
284
|
- !ruby/object:Gem::Version
|
271
|
-
version: 1
|
285
|
+
version: '1'
|
272
286
|
type: :development
|
273
287
|
prerelease: false
|
274
288
|
version_requirements: !ruby/object:Gem::Requirement
|
275
289
|
requirements:
|
276
290
|
- - "~>"
|
277
291
|
- !ruby/object:Gem::Version
|
278
|
-
version: 1
|
292
|
+
version: '1'
|
293
|
+
- !ruby/object:Gem::Dependency
|
294
|
+
name: rubocop-performance
|
295
|
+
requirement: !ruby/object:Gem::Requirement
|
296
|
+
requirements:
|
297
|
+
- - ">="
|
298
|
+
- !ruby/object:Gem::Version
|
299
|
+
version: '0'
|
300
|
+
type: :development
|
301
|
+
prerelease: false
|
302
|
+
version_requirements: !ruby/object:Gem::Requirement
|
303
|
+
requirements:
|
304
|
+
- - ">="
|
305
|
+
- !ruby/object:Gem::Version
|
306
|
+
version: '0'
|
279
307
|
- !ruby/object:Gem::Dependency
|
280
308
|
name: simplecov
|
281
309
|
requirement: !ruby/object:Gem::Requirement
|
@@ -339,7 +367,7 @@ licenses:
|
|
339
367
|
- CC-BY-SA-3.0
|
340
368
|
- BSD-2-Clause
|
341
369
|
metadata: {}
|
342
|
-
post_install_message:
|
370
|
+
post_install_message:
|
343
371
|
rdoc_options: []
|
344
372
|
require_paths:
|
345
373
|
- lib
|
@@ -354,8 +382,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
354
382
|
- !ruby/object:Gem::Version
|
355
383
|
version: '0'
|
356
384
|
requirements: []
|
357
|
-
rubygems_version: 3.
|
358
|
-
signing_key:
|
385
|
+
rubygems_version: 3.5.22
|
386
|
+
signing_key:
|
359
387
|
specification_version: 4
|
360
388
|
summary: Convert HTML document to Microsoft Word document
|
361
389
|
test_files: []
|