Skip to content

Commit

Permalink
allow multiple email elements in an adddress: #95
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Jan 10, 2024
1 parent 9be8b3e commit 50ffe2c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
14 changes: 7 additions & 7 deletions lib/isodoc/ietf/front.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def output_if_translit(text)
def title(_isoxml, front)
title = @meta.get[:doctitle] or return
front.title title, **attr_code(abbrev: @meta.get[:docabbrev],
ascii: (@meta.get[:docascii] ||
output_if_translit(title)))
ascii: @meta.get[:docascii] ||
output_if_translit(title))
end

def seriesinfo(isoxml, front)
Expand Down Expand Up @@ -69,8 +69,8 @@ def id_seriesinfo(isoxml, front)
end

def author(isoxml, front)
isoxml.xpath(("//xmlns:bibdata/xmlns:contributor[xmlns:role/@type = " \
"'author' or xmlns:role/@type = 'editor']")).each do |c|
isoxml.xpath("//xmlns:bibdata/xmlns:contributor[xmlns:role/@type = " \
"'author' or xmlns:role/@type = 'editor']").each do |c|
role = c.at(ns("./role/@type")).text == "editor" ? "editor" : nil
(c.at("./organization") and org_author(c, role, front)) or
person_author(c, role, front)
Expand Down Expand Up @@ -108,7 +108,7 @@ def person_author(contrib, role, front)
address(contrib.xpath(ns(".//address")),
contrib.at(ns(".//phone[not(@type = 'fax')]")),
contrib.at(ns(".//phone[@type = 'fax']")),
contrib.xpath(ns(".//email")), contrib.xpath(ns(".//uri")), a)
contrib.xpath(ns(".//email")), contrib.at(ns(".//uri")), a)
end
end

Expand All @@ -119,7 +119,7 @@ def org_author(contrib, role, front)
address(contrib.at(ns(".//address")),
contrib.at(ns(".//phone[not(@type = 'fax')]")),
contrib.at(ns(".//phone[@type = 'fax']")),
contrib.at(ns(".//email")), contrib.at(ns(".//uri")), a)
contrib.xpath(ns(".//email")), contrib.at(ns(".//uri")), a)
end
end

Expand All @@ -139,7 +139,7 @@ def address(addr, phone, fax, email, uri, out)
addr and postal(addr, a)
phone and a.phone phone.text
fax and a.facsimile fax.text
email and email(email, a)
email.each { |e| email(e, a) }
uri and a.uri uri.text
end
end
Expand Down
7 changes: 3 additions & 4 deletions spec/isodoc/metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@
</organization>
</affiliation>
<phone>123c</phone>
<phone type='fax'>123d</phone>
<phone type='fax'>123d</phone>
<email>barney@rockhead.example.com</email>
<email>barney2@rockhead.example.com</email>
</person>
</contributor>
<contributor>
Expand Down Expand Up @@ -337,7 +338,6 @@
</postal>
<phone>123</phone>
<facsimile>123b</facsimile>
<email/>
<uri>http://slate.example.com</uri>
</address>
</author>
Expand All @@ -354,7 +354,7 @@
<phone>123c</phone>
<facsimile>123d</facsimile>
<email>barney@rockhead.example.com</email>
<uri/>
<email>barney2@rockhead.example.com</email>
</address>
</author>
<date day='1' year='1000' month='January'/>
Expand Down Expand Up @@ -509,7 +509,6 @@
</postal>
<phone>123</phone>
<facsimile>123b</facsimile>
<email/>
<uri>http://slate.example.com</uri>
</address>
</author>
Expand Down
4 changes: 0 additions & 4 deletions spec/isodoc/ref_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@
<author fullname="Arthur son of Uther Pendragon">
<address>
<postal/>
<email/>
<uri/>
</address>
</author>
<abstract>
Expand Down Expand Up @@ -553,8 +551,6 @@
<author fullname="Arthur son of Uther Pendragon">
<address>
<postal/>
<email/>
<uri/>
</address>
</author>
<abstract>
Expand Down

0 comments on commit 50ffe2c

Please sign in to comment.