lib/isodoc/presentation_function/terms.rb in isodoc-2.2.0 vs lib/isodoc/presentation_function/terms.rb in isodoc-2.2.1

- old
+ new

@@ -26,14 +26,13 @@ concept1_nonital(node, opts) node.replace(node.children) end def concept1_nonital(node, opts) - if opts[:ital] == "false" - r = node.at(ns(".//renderterm")) - r&.replace(r&.children) - end + opts[:ital] == "false" or return + r = node.at(ns(".//renderterm")) + r&.replace(r&.children) end def concept_render_init(node, defaults) opts = %i(ital ref linkref linkmention).each_with_object({}) do |x, m| m[x] = node[x.to_s] || defaults[x] @@ -41,15 +40,15 @@ [opts, node.at(ns("./renderterm")), node.at(ns("./xref | ./eref | ./termref"))] end def concept1_linkmention(ref, renderterm, opts) - if opts[:linkmention] == "true" && !renderterm.nil? && !ref.nil? - ref2 = ref.clone - r2 = renderterm.clone - renderterm.replace(ref2).children = r2 - end + return unless opts[:linkmention] == "true" && !renderterm.nil? && !ref.nil? + + ref2 = ref.clone + r2 = renderterm.clone + renderterm.replace(ref2).children = r2 end def concept1_ref(_node, ref, opts) ref.nil? and return return ref.remove if opts[:ref] == "false" @@ -90,13 +89,11 @@ "<strong>**RELATED TERM NOT FOUND**</strong></p>")) end end def designation(docxml) - docxml.xpath(ns("//term")).each do |t| - merge_second_preferred(t) - end + docxml.xpath(ns("//term")).each { |t| merge_second_preferred(t) } docxml.xpath(ns("//preferred | //admitted | //deprecates")).each do |p| designation1(p) end end @@ -192,10 +189,9 @@ docxml.xpath(ns("//termnote")).each do |f| termnote1(f) end end - # introduce name element def termnote1(elem) lbl = l10n(@xrefs.anchor(elem["id"], :label) || "???") prefix_name(elem, "", lower2cap(lbl), "name") end