Skip to content

Commit

Permalink
wrap Word table key in distinct div: metanorma/metanorma-iso#1162
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Apr 24, 2024
1 parent f003214 commit a52ea21
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/isodoc/function/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def new_fullcolspan_row(table, tfoot)
end

TABLENOTE_CSS = "div[@class = 'Note' or @class = 'BlockSource' " \
"or @class = 'TableFootnote']".freeze
"or @class = 'TableFootnote' or @class = 'figdl']".freeze

def table_note_cleanup(docxml)
docxml.xpath("//table[dl or #{TABLENOTE_CSS}]").each do |t|
Expand Down
10 changes: 6 additions & 4 deletions lib/isodoc/word_function/lists.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ def dl_parse(node, out)
end

def dl_parse_nontable(node, out)
node["id"] and bookmark_parse(node, out)
list_title_parse(node, out)
out.div **attr_code(class: "figdl") do |div|
node["id"] and bookmark_parse(node, div)
list_title_parse(node, div)
node.elements.select { |n| dt_dd?(n) }
.each_slice(2) do |dt, dd|
dl_parse_nontable1(out, dt, dd)
dl_parse_nontable1(div, dt, dd)
end
dl_parse_notes(node, div)
end
dl_parse_notes(node, out)
end

WORD_EMBED_DL_ATTRS =
Expand Down
4 changes: 4 additions & 0 deletions spec/isodoc/lists_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,10 @@
<p align="left" style="margin-left:0pt;text-align:left;">A Deflist</p>
</td>
<td valign="top">
<div class="figdl">
<a id="_732d3f57-4f88-40bf-9ae9-633891edc395"/>
<p style="text-indent: -2.0cm; margin-left: 2.0cm; tab-stops: 2.0cm;">W<span style="mso-tab-count:1">  </span>mass fraction of gelatinized kernels</p>
</div>
</td>
</tr>
</table>
Expand All @@ -513,8 +515,10 @@
<tbody>
<tr>
<td style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;page-break-after:auto;">
<div class="figdl">
<a id="_732d3f57-4f88-40bf-9ae9-633891edc397"/>
<p style="text-indent: -2.0cm; margin-left: 2.0cm; tab-stops: 2.0cm;">X<span style="mso-tab-count:1">  </span>expressed in per cent</p>
</div>
</td>
</tr>
</tbody>
Expand Down
2 changes: 2 additions & 0 deletions spec/isodoc/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,10 @@
<td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;page-break-after:auto;">6,06</td>
</tr>
</tfoot>
<div class="figdl">
<p class="ListTitle">Key</p>
<p style="text-indent: -2.0cm; margin-left: 2.0cm; tab-stops: 2.0cm;">Drago<span style="mso-tab-count:1">  </span>A type of rice</p>
</div>
<div class="BlockSource">
<p>[SOURCE: <a href="#ISO712">ISO 712, Section 1</a> —
with adjustments]</p>
Expand Down

0 comments on commit a52ea21

Please sign in to comment.