diff --git a/lib/relaton_bib/document_identifier.rb b/lib/relaton_bib/document_identifier.rb
index 41db6ba..e8f67a4 100644
--- a/lib/relaton_bib/document_identifier.rb
+++ b/lib/relaton_bib/document_identifier.rb
@@ -61,7 +61,7 @@ def to_xml(**opts) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexi
id.sub %r{(?<=:)(?:\w{2},)*?(#{opts[:lang]})(?:,\w{2})*}, '\1'
else id
end
- element = opts[:builder].docidentifier lid
+ element = opts[:builder].docidentifier { |b| b.parent.inner_html = lid }
element[:type] = type if type
element[:scope] = scope if scope
element[:primary] = primary if primary
diff --git a/lib/relaton_bib/version.rb b/lib/relaton_bib/version.rb
index eea705f..a1c6bcd 100644
--- a/lib/relaton_bib/version.rb
+++ b/lib/relaton_bib/version.rb
@@ -1,3 +1,3 @@
module RelatonBib
- VERSION = "1.18.2".freeze
+ VERSION = "1.18.3".freeze
end
diff --git a/spec/relaton_bib/document_identifier_spec.rb b/spec/relaton_bib/document_identifier_spec.rb
index d3334c4..c0a30a9 100644
--- a/spec/relaton_bib/document_identifier_spec.rb
+++ b/spec/relaton_bib/document_identifier_spec.rb
@@ -21,7 +21,7 @@
context "ISO" do
subject do
RelatonBib::DocumentIdentifier.new(
- type: "URN", id: "urn:iso:std:iso:1111:-1:stage-60.60:ed-1:v1:en,fr"
+ type: "URN", id: "urn:iso:std:iso:1111:-1:stage-60.60:ed-1:v1:en,fr",
)
end
@@ -35,20 +35,18 @@
subject do
RelatonBib::DocumentIdentifier.new(
type: "URN",
- id: "urn:iec:std:iec:61058-2-4:1995::csv:en:plus:amd:1:2003"
+ id: "urn:iec:std:iec:61058-2-4:1995::csv:en:plus:amd:1:2003",
)
end
it "remove part" do
subject.remove_part
- expect(subject.id).to eq "urn:iec:std:iec:61058:1995::csv:en:plus:"\
- "amd:1:2003"
+ expect(subject.id).to eq "urn:iec:std:iec:61058:1995::csv:en:plus:amd:1:2003"
end
it "remove date" do
subject.remove_date
- expect(subject.id).to eq "urn:iec:std:iec:61058-2-4:::csv:en:plus:"\
- "amd:1:2003"
+ expect(subject.id).to eq "urn:iec:std:iec:61058-2-4:::csv:en:plus:amd:1:2003"
end
it "set all parts" do
@@ -60,8 +58,7 @@
context "GB" do
subject do
- RelatonBib::DocumentIdentifier.new(id: "1111.2-2014",
- type: "Chinese Standard")
+ RelatonBib::DocumentIdentifier.new(id: "1111.2-2014", type: "Chinese Standard")
end
it "remove part" do
@@ -74,4 +71,14 @@
expect(subject.id).to eq "1111.2"
end
end
+
+ context "#to_xml" do
+ it "with superscription" do
+ subject = RelatonBib::DocumentIdentifier.new(id: "CIPM 43e réunion (1950)", type: "BIPM")
+ xml = Nokogiri::XML::Builder.new do |builder|
+ subject.to_xml(builder: builder, lang: "en")
+ end.doc.root
+ expect(xml.to_xml).to eq "CIPM 43e réunion (1950)"
+ end
+ end
end