From 50ffe2c0874ad561f2f7dccc42fafa0a2dca4f04 Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Wed, 10 Jan 2024 17:46:42 +1100 Subject: [PATCH] allow multiple email elements in an adddress: https://github.com/metanorma/metanorma-ietf/issues/95 --- lib/isodoc/ietf/front.rb | 14 +++++++------- spec/isodoc/metadata_spec.rb | 7 +++---- spec/isodoc/ref_spec.rb | 4 ---- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/lib/isodoc/ietf/front.rb b/lib/isodoc/ietf/front.rb index 34e8282..f08932f 100644 --- a/lib/isodoc/ietf/front.rb +++ b/lib/isodoc/ietf/front.rb @@ -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) @@ -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) @@ -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 @@ -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 @@ -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 diff --git a/spec/isodoc/metadata_spec.rb b/spec/isodoc/metadata_spec.rb index 6efd3ee..f4fabb4 100644 --- a/spec/isodoc/metadata_spec.rb +++ b/spec/isodoc/metadata_spec.rb @@ -87,8 +87,9 @@ 123c - 123d + 123d barney@rockhead.example.com + barney2@rockhead.example.com @@ -337,7 +338,6 @@ 123 123b - http://slate.example.com @@ -354,7 +354,7 @@ 123c 123d barney@rockhead.example.com - + barney2@rockhead.example.com @@ -509,7 +509,6 @@ 123 123b - http://slate.example.com diff --git a/spec/isodoc/ref_spec.rb b/spec/isodoc/ref_spec.rb index 318ea8f..192d446 100644 --- a/spec/isodoc/ref_spec.rb +++ b/spec/isodoc/ref_spec.rb @@ -225,8 +225,6 @@
- -
@@ -553,8 +551,6 @@
- -