lib/isodoc/presentation_function/xrefs.rb in isodoc-2.3.6 vs lib/isodoc/presentation_function/xrefs.rb in isodoc-2.4.0

- old
+ new

@@ -36,18 +36,24 @@ end def anchor_xref(node, target) x = @xrefs.anchor(target, :xref) t = @xrefs.anchor(target, :title) - if node["style"] == "basic" && t then t - elsif node["style"] == "full" && t - l10n("#{x}, #{t}") - else x + case node["style"] + when "basic" then t || x + when "full" then t ? anchor_xref_full(x, t) : x + when "short", nil then x + else @xrefs.anchor(target, node[:style].to_sym) end end + def anchor_xref_full(num, title) + l10n("#{num}, #{title}") + end + def prefix_container?(container, node) + node["style"] == "modspec" and return false # TODO: move to mn-requirements? type = @xrefs.anchor(node["target"], :type) container && get_note_container_id(node, type) != container && @xrefs.get[node["target"]] end @@ -64,11 +70,11 @@ end def combine_conflated_xref_locations(locs) out = locs.each { |l| l[:label] = anchor_value(l[:target]) } label = @i18n.inflect(locs.first[:elem], number: "pl") - ret = l10n("#{label} #{combine_conn(out)}") - combine_conflated_xref_locations_container(locs, ret) + out[0][:label] = l10n("#{label} #{out[0][:label]}") + combine_conflated_xref_locations_container(locs, l10n(combine_conn(out))) end def combine_conflated_xref_locations_container(locs, ret) container = @xrefs.anchor(locs.first[:node]["target"], :container, false)