Skip to content

Commit

Permalink
include dl title in postprocessing of table keys: metanorma/metanorma…
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Apr 24, 2024
1 parent 118d491 commit f003214
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 5 additions & 4 deletions lib/isodoc/function/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,14 @@ def new_fullcolspan_row(table, tfoot)
tfoot.xpath(".//td").last
end

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

def table_note_cleanup(docxml)
docxml.xpath("//table[dl or div[@class = 'Note' or @class = 'BlockSource' " \
"or @class = 'TableFootnote']]").each do |t|
docxml.xpath("//table[dl or #{TABLENOTE_CSS}]").each do |t|
tfoot = table_get_or_make_tfoot(t)
insert_here = new_fullcolspan_row(t, tfoot)
t.xpath("dl | div[@class = 'Note' or @class = 'BlockSource' or " \
"@class = 'TableFootnote']")
t.xpath("dl | p[@class = 'ListTitle'] | #{TABLENOTE_CSS}")
.each do |d|
d.parent = insert_here
end
Expand Down
8 changes: 6 additions & 2 deletions spec/isodoc/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
<td align="center">6,06</td>
</tr>
</tfoot>
<dl>
<dl key="true">
<name>Key</name>
<dt>Drago</dt>
<dd>A type of rice</dd>
</dl>
Expand Down Expand Up @@ -171,7 +172,8 @@
<td align='center'>6,06</td>
</tr>
</tfoot>
<dl>
<dl key="true">
<name>Key</name>
<dt>Drago</dt>
<dd>A type of rice</dd>
</dl>
Expand Down Expand Up @@ -266,6 +268,7 @@
<td style="text-align:center;border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">6,06</td>
</tr>
</tfoot>
<p class="ListTitle">Key</p>
<dl>
<dt>
<p>Drago</p>
Expand Down Expand Up @@ -386,6 +389,7 @@
<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>
<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 class="BlockSource">
<p>[SOURCE: <a href="#ISO712">ISO 712, Section 1</a> —
Expand Down

0 comments on commit f003214

Please sign in to comment.