lib/isodoc/presentation_function/xrefs.rb in isodoc-2.3.2 vs lib/isodoc/presentation_function/xrefs.rb in isodoc-2.3.3

- old
+ new

@@ -1,9 +1,10 @@ module IsoDoc class PresentationXMLConvert < ::IsoDoc::Convert - def prefix_container(container, linkend, _target) - l10n("#{@xrefs.anchor(container, :xref)}, #{linkend}") + def prefix_container(container, linkend, node, _target) + # l10n("#{@xrefs.anchor(container, :xref)}, #{linkend}") + l10n("#{anchor_xref(node, container)}, #{linkend}") end def anchor_value(id) @xrefs.anchor(id, :value) || @xrefs.anchor(id, :label) || @xrefs.anchor(id, :xref) @@ -22,17 +23,28 @@ linkend || "???" end def anchor_linkend1(node) - linkend = @xrefs.anchor(node["target"], :xref) + linkend = anchor_xref(node, node["target"]) container = @xrefs.anchor(node["target"], :container, false) prefix_container?(container, node) and - linkend = prefix_container(container, linkend, node["target"]) + linkend = prefix_container(container, linkend, node, node["target"]) capitalise_xref(node, linkend, anchor_value(node["target"])) 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 + end + end + def prefix_container?(container, node) type = @xrefs.anchor(node["target"], :type) container && get_note_container_id(node, type) != container && @xrefs.get[node["target"]] @@ -53,10 +65,11 @@ out = locs.each { |l| l[:target] = anchor_value(l[:target]) } ret = l10n("#{locs.first[:elem]} #{combine_conn(out)}") container = @xrefs.anchor(locs.first[:node]["target"], :container, false) prefix_container?(container, locs.first[:node]) and - ret = prefix_container(container, ret, locs.first[:node]["target"]) + ret = prefix_container(container, ret, locs.first[:node], + locs.first[:node]["target"]) ret end def gather_xref_locations(node) node.xpath(ns("./location")).each_with_object([]) do |l, m|