Skip to content

Commit 13ca799

Browse files
committed
inherit JIS sorting of references: metanorma/metanorma-jis#205
1 parent 17b0d59 commit 13ca799

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

Gemfile.devel

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gem "metanorma-jis", git: "https://github.com/metanorma/metanorma-jis", branch: "fix/refs-ordering"

lib/metanorma/plateau/cleanup.rb

+9-8
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ def blocksource_cleanup(xmldoc)
2828
super
2929
end
3030

31-
def pub_class(bib)
32-
return 1 if bib.at("#{PUBLISHER}[name = '#{pub_hash['en']}']") ||
33-
bib.at("#{PUBLISHER}[name = '#{pub_hash['ja']}']") ||
34-
bib.at("#{PUBLISHER}[abbreviation = 'MLIT']")
35-
return 2 if bib["type"] == "standard"
36-
37-
3
38-
end
31+
# Abandoned in favour of JIS ordering
32+
# def pub_class(bib)
33+
# return 1 if bib.at("#{PUBLISHER}[name = '#{pub_hash['en']}']") ||
34+
# bib.at("#{PUBLISHER}[name = '#{pub_hash['ja']}']") ||
35+
# bib.at("#{PUBLISHER}[abbreviation = 'MLIT']")
36+
# return 2 if bib["type"] == "standard"
37+
#
38+
# 3
39+
# end
3940

4041
def biblio_reorder(xmldoc)
4142
xmldoc.xpath("//references").each do |r|

spec/metanorma/refs_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@
7171
out = Nokogiri::XML(Asciidoctor.convert(input, *OPTIONS))
7272
expect(out.xpath("//xmlns:references/xmlns:bibitem/@id")
7373
.map(&:value))
74-
.to be_equivalent_to ["ref4", "ref1", "ref2", "ref5", "ref3", "ref6"]
74+
.to be_equivalent_to ["ref3", "ref6", "ref5", "ref2", "ref4", "ref1"]
7575
end
7676

7777
VCR.use_cassette "sortrefs" do
7878
out = Nokogiri::XML(Asciidoctor.convert(input
7979
.sub("== Bibliography", "== Normative References"), *OPTIONS))
8080
expect(out.xpath("//xmlns:references/xmlns:bibitem/@id")
8181
.map(&:value))
82-
.to be_equivalent_to ["ref4", "ref1", "ref2", "ref5", "ref3", "ref6"]
82+
.to be_equivalent_to ["ref3", "ref6", "ref5", "ref2", "ref4", "ref1"]
8383
end
8484
end
8585
end

0 commit comments

Comments
 (0)