diff --git a/lib/isodoc/presentation_function/erefs.rb b/lib/isodoc/presentation_function/erefs.rb
index dc1f2da7..637b9963 100644
--- a/lib/isodoc/presentation_function/erefs.rb
+++ b/lib/isodoc/presentation_function/erefs.rb
@@ -6,13 +6,22 @@ def citeas(xmldoc)
xmldoc.xpath(ns("//eref | //origin | //quote//source | //link"))
.each do |e|
e["bibitemid"] && e["citeas"] or next
- a = @xrefs.anchor(e["bibitemid"], :xref, false) and
- e["citeas"] = a.gsub(%r{?[^>]+>}, "")
+ a = @xrefs.anchor(e["bibitemid"], :xref, false) or next
+ e["citeas"] = citeas_cleanup(a)
# link generated in collection postprocessing from eref
e.name == "link" && e.text.empty? and e.children = e["citeas"]
end
end
+ def citeas_cleanup(ref)
+ if /#{ref}")
+ xml.xpath("//semx").each { |x| x.replace(x.children) }
+ ref = to_xml(xml.at("//root").children)
+ end
+ ref
+ end
+
def expand_citeas(text)
text.nil? and return text
HTMLEntities.new.decode(text.gsub("&#x", ""))
diff --git a/lib/isodoc/presentation_function/xrefs.rb b/lib/isodoc/presentation_function/xrefs.rb
index 9d66f01e..ed43a9c0 100644
--- a/lib/isodoc/presentation_function/xrefs.rb
+++ b/lib/isodoc/presentation_function/xrefs.rb
@@ -21,7 +21,7 @@ def anchor_linkend(node, linkend)
node["style"] == "id" and
return anchor_id_postproc(node)
node["citeas"].nil? && node["bibitemid"] and
- return @xrefs.anchor(node["bibitemid"], :xref) || "???"
+ return citeas_cleanup(@xrefs.anchor(node["bibitemid"], :xref)) || "???"
node.at(ns("./location")) and
return combine_xref_locations(node) || "???"
node["target"] && node["droploc"] and
diff --git a/spec/isodoc/ref_spec.rb b/spec/isodoc/ref_spec.rb
index 8e10951c..1e91ca81 100644
--- a/spec/isodoc/ref_spec.rb
+++ b/spec/isodoc/ref_spec.rb
@@ -132,269 +132,269 @@
INPUT
presxml = <<~PRESXML
-
- The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies. Under preparation. (Stage at the time of publication ISO/DIS 16634) This is an annotation of ISO 20483:2013-2014 This is an annotation of document ISSN. This is another annotation of document ISSN. Under preparation. (Stage at the time of publication ISO/DIS 3696)
+ The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies. Under preparation. (Stage at the time of publication ISO/DIS 16634) This is an annotation of ISO 20483:2013-2014 This is an annotation of document ISSN. This is another annotation of document ISSN. Under preparation. (Stage at the time of publication ISO/DIS 3696)
-
-
-
-
-
The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.
-- - [1], ISO 712, International Organization for Standardization. - Cereals and cereal products - . -
-- - ISO 16634:-- (all parts) - - - - - - - - , - Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs - . -
-- - ISO 20483:2013-2014, International Organization for Standardization. - Cereals and pulses - . 2013–2014. -
-- - ICC/167, - Standard No I.C.C 167 - . - Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method - (see - http://www.icc.or.at - ) -
-- - NOTE - - - This is an annotation of ISO 20483:2013-2014 -
-
-
-
- - [3] - - Chemicals for analytical laboratory use - . n.p.: n.d. ISBN: ISBN. -
-- - [4] - - Instruments for analytical laboratory use - . n.d. ISSN: ISSN. -
-- - NOTE - - - This is an annotation of document ISSN. -
-- - NOTE - - - This is another annotation of document ISSN. -
-- - [5] - - ISO 3696 - - - - - - - - , - Water for analytical laboratory use - . -
-- - [6] - - Standard No I.C.C 167 - . - Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method - (see - http://www.icc.or.at - ) -
-- - [7] - - IETF RFC 10, - Internet Calendaring and Scheduling Core Object Specification (iCalendar) - . -
-- - Citn - - IETF RFC 20, CitationWorks. 2019. - How to cite a reference - . -
-- - [8] - - IETF RFC 20, - Internet Calendaring and Scheduling Core Object Specification (iCalendar) - . -
-- - [9] - - Internet Calendaring & Scheduling Core Object Specification (iCalendar) - . -
-- - - - - - Under preparation. (Stage at the time of publication ISO/DIS 16634) -
-- - - - - - Under preparation. (Stage at the time of publication ISO/DIS 3696) -
-
+
+
+
+
+
The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.
++ + [1], ISO 712, International Organization for Standardization. + Cereals and cereal products + . +
++ + ISO 16634:-- (all parts) + + + + + + + + , + Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs + . +
++ + ISO 20483:2013-2014, International Organization for Standardization. + Cereals and pulses + . 2013–2014. +
++ + ICC/167, + Standard No I.C.C 167 + . + Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method + (see + http://www.icc.or.at + ) +
++ + NOTE + + + This is an annotation of ISO 20483:2013-2014 +
+
+
+
+ + [3] + + Chemicals for analytical laboratory use + . n.p.: n.d. ISBN: ISBN. +
++ + [4] + + Instruments for analytical laboratory use + . n.d. ISSN: ISSN. +
++ + NOTE + + + This is an annotation of document ISSN. +
++ + NOTE + + + This is another annotation of document ISSN. +
++ + [5] + + ISO 3696 + + + + + + + + , + Water for analytical laboratory use + . +
++ + [6] + + Standard No I.C.C 167 + . + Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method + (see + http://www.icc.or.at + ) +
++ + [7] + + IETF RFC 10, + Internet Calendaring and Scheduling Core Object Specification (iCalendar) + . +
++ + Citn + + IETF RFC 20, CitationWorks. 2019. + How to cite a reference + . +
++ + [8] + + IETF RFC 20, + Internet Calendaring and Scheduling Core Object Specification (iCalendar) + . +
++ + [9] + + Internet Calendaring & Scheduling Core Object Specification (iCalendar) + . +
++ + + + + + Under preparation. (Stage at the time of publication ISO/DIS 16634) +
++ + + + + + Under preparation. (Stage at the time of publication ISO/DIS 3696) +
+
+
The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.
+
+
+ + ISO 712 + 1 + + + ISO 712 + 1 + +
+