lib/metanorma/standoc/cleanup_table.rb in metanorma-standoc-2.8.2 vs lib/metanorma/standoc/cleanup_table.rb in metanorma-standoc-2.8.3
- old
+ new
@@ -20,12 +20,11 @@
end
end
def insert_thead(table)
thead = table.at("./thead")
- return thead unless thead.nil?
-
+ thead.nil? or return thead
if tname = table.at("./name")
thead = tname.add_next_sibling("<thead/>").first
return thead
end
table.children.first.add_previous_sibling("<thead/>").first
@@ -33,11 +32,10 @@
def header_rows_cleanup(xmldoc)
xmldoc.xpath("//table[@headerrows]").each do |s|
thead = insert_thead(s)
(thead.xpath("./tr").size...s["headerrows"].to_i).each do
- row = s.at("./tbody/tr")
- row.parent = thead
+ s.at("./tbody/tr").parent = thead
end
thead.xpath(".//td").each { |n| n.name = "th" }
s.delete("headerrows")
end
end