Skip to content

Commit

Permalink
Merge pull request #408 from metanorma/fix/optimise-biblio-sort
Browse files Browse the repository at this point in the history
optimise sorting of bibliography: https://github.com/metanorma/metano…
  • Loading branch information
opoudjis authored Aug 9, 2024
2 parents ea1bd84 + 46da09e commit bd364c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/isodoc/ieee/presentation_ref.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ def author_date?(xml)
def creatornames(bibitem)
::Relaton::Render::IEEE::General
.new(language: @lang, i18nhash: @i18n.get,
template: { (bibitem["type"] || "misc").to_sym =>
"{{ creatornames }}" })
#template: { (bibitem["type"] || "misc").to_sym =>
#"{{ creatornames }}" },
template: "{{ creatornames }}" ,
extenttemplate: { (bibitem["type"] || "misc").to_sym => "{{page}}"} ,
sizetemplate: { (bibitem["type"] || "misc").to_sym => "{{data}}"} ,
)
.render1(RelatonBib::XMLParser.from_xml(bibitem.to_xml))
end

Expand Down
5 changes: 4 additions & 1 deletion lib/metanorma/ieee/cleanup_ref.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ def sort_biblio(bib)
@i = IsoDoc::IEEE::PresentationXMLConvert
.new({ lang: @lang, script: @script, locale: @locale })
@i.i18n_init(@lang, @script, @locale)
bib.sort { |a, b| sort_biblio_key(a) <=> sort_biblio_key(b) }
sort_keys = bib.each_with_object({}) do |b, m|
m[b["id"]] = sort_biblio_key(b)
end
bib.sort { |a, b| sort_keys[a["id"]] <=> sort_keys[b["id"]] }
end

# Alphabetic by rendering: author surname or designation, followed by title
Expand Down

0 comments on commit bd364c6

Please sign in to comment.