uniword 1.7.6 → 1.7.7

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: 1f78e4ec92cc4ea7740d9e2ec0d3b2acf76ef1851331be34219795c902ebf090
4
- data.tar.gz: e722b7c3c0b32d87477e727f4f6eeea54c3a766d5d9593d18b6f3698949fc4f5
3
+ metadata.gz: 40c1d49a7c8a953a11ecdde25ac3c1b6631734a9ed0678f6a62fa5facda9ff93
4
+ data.tar.gz: bc7d43f6f328119727f5bed425d617a9ac1d45a88cb3df4e2a91ac70f20d3362
5
5
  SHA512:
6
- metadata.gz: 3c34a8c5593579f138e64e36ee04f7cd4e8a0fcd6088c7f4d522bc9efdffb6f22c3ceb89d44a0b5e7d64508fad54df2ac856dbd220b8fb989fef3ed635d43b0d
7
- data.tar.gz: 2eba230eaeffd07d2c30227c81fe4263dabff15f0802df553c42da0062a865283fe8a33fc0ba777b574aa9e5f454a59c3f06323f6a9953994117cc573b578e3e
6
+ metadata.gz: b52f4c4a769593ac97e1a86c968406adedb268bd814e783fc2d85c0725f9e239110c9ed5f1be76804e2f41878c34170b89a8d3708efd131f6f8b86b2645620e7
7
+ data.tar.gz: 33923d0ccadaba2cbd51b72f58417be44bf8c981d0b223c90e785645efc52df992e6fe2f273766c5b552be2ce4497b3f3e07aa3b42e2e864b3986598c5d830ae
@@ -83,7 +83,9 @@ module Uniword
83
83
  elsif text
84
84
  para << text
85
85
  end
86
- entry.paragraphs << para.build
86
+ paragraph = para.build
87
+ prepend_ref_marker(paragraph, :footnote_ref, Wordprocessingml::FootnoteRef)
88
+ entry.paragraphs << paragraph
87
89
  footnotes.footnote_entries << entry
88
90
  end
89
91
 
@@ -95,9 +97,20 @@ module Uniword
95
97
  elsif text
96
98
  para << text
97
99
  end
98
- entry.paragraphs << para.build
100
+ paragraph = para.build
101
+ prepend_ref_marker(paragraph, :endnote_ref, Wordprocessingml::EndnoteRef)
102
+ entry.paragraphs << paragraph
99
103
  endnotes.endnote_entries << entry
100
104
  end
105
+
106
+ # OOXML 17.11.10/17.11.11: a note body begins with the automatic
107
+ # number marker (<w:footnoteRef/> / <w:endnoteRef/>); Word renders
108
+ # the note's number from this marker. Without it the footnote pane
109
+ # shows the body text with no number label.
110
+ def prepend_ref_marker(paragraph, attr, marker_class)
111
+ marker = Wordprocessingml::Run.new(attr => marker_class.new)
112
+ paragraph.runs.unshift(marker)
113
+ end
101
114
  end
102
115
  end
103
116
  end
@@ -22,6 +22,8 @@ module Uniword
22
22
  return false if run.alternate_content
23
23
  return false if run.footnote_reference
24
24
  return false if run.endnote_reference
25
+ return false if run.footnote_ref
26
+ return false if run.endnote_ref
25
27
  return false if run.comment_reference
26
28
  return false if run.field_char
27
29
  return false if run.instr_text
@@ -46,6 +48,8 @@ module Uniword
46
48
  return false if run.alternate_content
47
49
  return false if run.footnote_reference
48
50
  return false if run.endnote_reference
51
+ return false if run.footnote_ref
52
+ return false if run.endnote_ref
49
53
  return false if run.comment_reference
50
54
  return false if run.field_char
51
55
  return false if run.instr_text
@@ -77,6 +77,8 @@ module Uniword
77
77
  # Handle footnote/endnote references (rendered as special markers)
78
78
  return footnote_reference_to_html(run) if run.footnote_reference
79
79
  return endnote_reference_to_html(run) if run.endnote_reference
80
+ return footnote_ref_to_html(run) if run.footnote_ref
81
+ return endnote_ref_to_html(run) if run.endnote_ref
80
82
 
81
83
  # Render content based on run type
82
84
  content = render_run_content(run)
@@ -143,6 +145,19 @@ module Uniword
143
145
  %(<span class="MsoEndnoteReference"><span style="mso-special-character:endnote"></span></span>)
144
146
  end
145
147
 
148
+ # Automatic number marker at the start of a note body
149
+ # (<w:footnoteRef/> / <w:endnoteRef/>): rendered with the same
150
+ # special-character span as the in-text reference, so the note body
151
+ # keeps its number placeholder in MHTML output.
152
+ def footnote_ref_to_html(_run)
153
+ %(<span class="MsoFootnoteReference"><span style="mso-special-character:footnote"></span></span>)
154
+ end
155
+
156
+ # Convert OOXML EndnoteRef to HTML
157
+ def endnote_ref_to_html(_run)
158
+ %(<span class="MsoEndnoteReference"><span style="mso-special-character:endnote"></span></span>)
159
+ end
160
+
146
161
  # Convert OOXML Breaks to HTML, one <br> per Break element
147
162
  def break_to_html(breaks)
148
163
  Array(breaks).map do |brk|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uniword
4
- VERSION = "1.7.6"
4
+ VERSION = "1.7.7"
5
5
  end
@@ -18,6 +18,8 @@ module Uniword
18
18
  attribute :alternate_content, AlternateContent, default: nil
19
19
  attribute :footnote_reference, FootnoteReference
20
20
  attribute :endnote_reference, EndnoteReference
21
+ attribute :footnote_ref, FootnoteRef
22
+ attribute :endnote_ref, EndnoteRef
21
23
  attribute :comment_reference, CommentReference
22
24
  attribute :field_char, FieldChar
23
25
  attribute :instr_text, InstrText
@@ -56,6 +58,10 @@ module Uniword
56
58
  render_nil: false
57
59
  map_element "endnoteReference", to: :endnote_reference,
58
60
  render_nil: false
61
+ # Automatic number markers inside note bodies
62
+ # (OOXML 17.11.10 / 17.11.11).
63
+ map_element "footnoteRef", to: :footnote_ref, render_nil: false
64
+ map_element "endnoteRef", to: :endnote_ref, render_nil: false
59
65
  map_element "commentReference", to: :comment_reference,
60
66
  render_nil: false
61
67
  map_element "fldChar", to: :field_char, render_nil: false
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.6
4
+ version: 1.7.7
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-14 00:00:00.000000000 Z
11
+ date: 2026-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logger