Skip to content

Commit

Permalink
Merge pull request #587 from metanorma/fix/publisher-multilingual
Browse files Browse the repository at this point in the history
multilingual publisher processing for metadata: https://github.com/re…
  • Loading branch information
opoudjis authored Jul 29, 2024
2 parents cfb96ef + 0471800 commit 384e337
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/isodoc/metadata_contributor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,15 @@ def agency1(xml)
publisher = []
xml.xpath(ns("//bibdata/contributor[xmlns:role/@type = 'publisher']/" \
"organization")).each do |org|
name = extract_variant(org.at(ns("./name")))
agency1 = org.at(ns("./abbreviation"))&.text || name
publisher << name if name
name = org.at(ns("./name[@language = '#{@lang}']")) ||
org.at(ns("./name"))
agency1 = org.at(ns("./abbreviation"))&.text || name&.text
publisher << name.text if name
agency = iso?(org) ? "ISO/#{agency}" : "#{agency}#{agency1}/"
end
[agency, publisher]
end

def extract_variant(node)
node.nil? and return node
x = node.at(ns("./variant[@language = '#{@lang}']")) and node = x
node.text
end

def agency(xml)
agency, publisher = agency1(xml)
set(:agency, agency.sub(%r{/$}, ""))
Expand Down
1 change: 1 addition & 0 deletions lib/isodoc/presentation_function/inline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def xref1(node)
get_linkend(node)
end

# there should be no //variant in bibdata now
def variant(xml)
b = xml.xpath(ns("//bibdata//variant"))
(xml.xpath(ns("//variant")) - b).each { |f| variant1(f) }
Expand Down

0 comments on commit 384e337

Please sign in to comment.