uniword 1.7.5 → 1.7.6
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/uniword/transformation/ooxml_to_mhtml_converter.rb +46 -7
- data/lib/uniword/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f78e4ec92cc4ea7740d9e2ec0d3b2acf76ef1851331be34219795c902ebf090
|
|
4
|
+
data.tar.gz: e722b7c3c0b32d87477e727f4f6eeea54c3a766d5d9593d18b6f3698949fc4f5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c34a8c5593579f138e64e36ee04f7cd4e8a0fcd6088c7f4d522bc9efdffb6f22c3ceb89d44a0b5e7d64508fad54df2ac856dbd220b8fb989fef3ed635d43b0d
|
|
7
|
+
data.tar.gz: 2eba230eaeffd07d2c30227c81fe4263dabff15f0802df553c42da0062a865283fe8a33fc0ba777b574aa9e5f454a59c3f06323f6a9953994117cc573b578e3e
|
|
@@ -270,16 +270,55 @@ document_name = nil)
|
|
|
270
270
|
# Build HTML body content from sections array.
|
|
271
271
|
# Each section is wrapped in a <div class=WordSectionN> with <br> between them.
|
|
272
272
|
def build_sections_html(sections)
|
|
273
|
-
return
|
|
273
|
+
return footnote_list_html if sections.empty?
|
|
274
|
+
|
|
275
|
+
body = if sections.size == 1
|
|
276
|
+
elements_html = sections.first.map do |element|
|
|
277
|
+
@element_renderer.element_to_html(element)
|
|
278
|
+
end.join("\n")
|
|
279
|
+
"<div class=WordSection1>\n\n#{elements_html}\n\n</div>"
|
|
280
|
+
else
|
|
281
|
+
section_divs(sections)
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
body + footnote_list_html
|
|
285
|
+
end
|
|
274
286
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
287
|
+
# Word MHTML carries footnote bodies at the end of the document body,
|
|
288
|
+
# wrapped in a footnote-list container; the in-text footnote
|
|
289
|
+
# references point at these blocks. Without this section the MHTML
|
|
290
|
+
# output silently loses every footnote body that the DOCX output
|
|
291
|
+
# keeps in word/footnotes.xml.
|
|
292
|
+
def footnote_list_html
|
|
293
|
+
entries = footnote_entries
|
|
294
|
+
return "" if entries.empty?
|
|
295
|
+
|
|
296
|
+
blocks = entries.map { |entry| footnote_entry_to_html(entry) }
|
|
297
|
+
"<div style='mso-element:footnote-list'>\n#{blocks.join("\n")}\n</div>"
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# User footnote entries, in document order. The separator and
|
|
301
|
+
# continuationSeparator entries are Word plumbing, not content.
|
|
302
|
+
def footnote_entries
|
|
303
|
+
footnotes = @document.footnotes
|
|
304
|
+
return [] unless footnotes.is_a?(Uniword::Wordprocessingml::Footnotes)
|
|
305
|
+
|
|
306
|
+
footnotes.footnote_entries.reject do |entry|
|
|
307
|
+
entry.type == "separator" || entry.type == "continuationSeparator"
|
|
281
308
|
end
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def footnote_entry_to_html(entry)
|
|
312
|
+
html = Array(entry.paragraphs).map do |paragraph|
|
|
313
|
+
@element_renderer.paragraph_to_html(paragraph)
|
|
314
|
+
end.join("\n")
|
|
315
|
+
|
|
316
|
+
"<div style='mso-element:footnote' id=\"ftn#{entry.id}\">\n#{html}\n</div>"
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
private
|
|
282
320
|
|
|
321
|
+
def section_divs(sections)
|
|
283
322
|
section_divs = sections.each_with_index.map do |section_elements, idx|
|
|
284
323
|
elements_html = section_elements.map do |element|
|
|
285
324
|
@element_renderer.element_to_html(element)
|
data/lib/uniword/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uniword
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: logger
|