require "spec_helper" require "relaton_iso" RSpec.describe Asciidoctor::Standoc do it "processes simple dl reference" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References [%bibitem] === Standard id:: iso123 docid:: type::: ISO id::: ISO 123 type:: standard contributor:: role::: publisher organization::: name:::: ISO contributor:: role::: author person::: name:::: + -- completename:: language::: en content::: Fred -- contributor:: role::: author person::: name:::: completename::::: Jack INPUT #{BLANK_HDR} Normative references #{NORM_REF_BOILERPLATE} #{Date.today} Standard Standard ISO 123 ISO Fred Jack OUTPUT end it "processes complex dl reference" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Clause <> [bibliography] == Normative References [[ISOTC211]] [%bibitem] === Other Title fetched:: 2019-06-30 title:: type::: main content::: Geographic information title:: type::: subtitle content::: Geographic information subtitle language::: en script::: Latn format::: text/plain type:: standard docid:: type::: ISO id::: TC211 docnumber:: 211 edition:: 1 language:: . en . fr script:: Latn version:: revision_date::: 2019-04-01 draft::: draft biblionote:: type::: bibnote content::: + -- Mark set a major league home run record in 1998. -- docstatus:: stage::: stage substage::: substage iteration::: iteration date:: type::: issued value::: 2014 date:: type::: published from::: 2014-04 to::: 2014-05 date:: type::: accessed value::: 2015-05-20 abstract:: content::: + -- ISO 19115-1:2014 defines the schema required for ... -- abstract:: content::: L'ISO 19115-1:2014 définit le schéma requis pour ... language::: fr script::: Latn format::: text/plain copyright:: owner::: name:::: International Organization for Standardization abbreviation:::: ISO url:::: www.iso.org from::: 2014 to::: #{Time.now.year} link:: type::: src content::: https://www.iso.org/standard/53798.html link:: type::: obp content::: https://www.iso.org/obp/ui/#!iso:std:53798:en link:: type::: rss content::: https://www.iso.org/contents/data/standard/05/37/53798.detail.rss medium:: form::: medium form size::: medium size scale::: medium scale place:: bib place extent:: type::: section reference_from::: 7 accesslocation:: . accesslocation1 . accesslocation2 classification:: type::: type value::: value validity:: begins::: 2010-10-10 12:21 ends::: 2011-02-03 18:30 ==== Contributor organization:: name::: International Organization for Standardization url::: www.iso.org abbreviation::: ISO subdivision::: division role:: type::: publisher description::: Publisher role ==== Contributor person:: name::: completename:::: + -- content:: A. Bierman language:: en -- affiliation::: organization:::: + -- name:: IETF abbreviation:: IETF identifier:: type::: uri id::: www.ietf.org -- description:::: Affiliation description contact::: street:::: . 8 Street St city:::: City postcode:::: 123456 country:::: Country state:::: State contact::: type:::: phone value:::: 223322 role:: author ==== Contributor organization:: name::: IETF abbreviation::: IETF identifier::: type:::: uri id:::: www.ietf.org role:: publisher ==== Contributor person:: name::: language:::: en initial:::: A. surname:::: Bierman affiliation::: + -- organization:: name::: IETF abbreviation::: IETF description:: content::: Affiliation description language::: en script::: Latn -- identifier::: type:::: uri id:::: www.person.com role:: author ==== Relation type:: updates bibitem:: formattedref::: ISO 19115:2003 bib_locality::: type:::: page reference_from:::: 7 reference_to:::: 10 ==== Relation type:: updates bibitem:: type::: standard formattedref::: ISO 19115:2003/Cor 1:2006 ==== Series type:: main title:: type::: original content::: ISO/IEC FDIS 10118-3 language::: en script::: Latn format::: text/plain place:: Serie's place organization:: Serie's organization abbreviation:: content::: ABVR language::: en script::: Latn from:: 2009-02-01 to:: 2010-12-20 number:: serie1234 partnumber:: part5678 ==== Series type:: alt formattedref:: content::: serieref language::: en script::: Latn INPUT #{BLANK_HDR} Clause

Normative references #{NORM_REF_BOILERPLATE} 2019-06-30 Geographic information Geographic information subtitle Other Title Other Title https://www.iso.org/standard/53798.html https://www.iso.org/obp/ui/#!iso:std:53798:en https://www.iso.org/contents/data/standard/05/37/53798.detail.rss TC211 211 2014 2014-04 2014-05 2015-05-20 Publisher role International Organization for Standardization division ISO www.iso.org A. Bierman Affiliation description IETF IETF www.ietf.org
8 Street St City State Country 123456
223322
IETF IETF www.ietf.org A. Bierman Affiliation description IETF IETF www.person.com 1 2019-04-01 draft Mark set a major league home run record in 1998. en fr ISO 19115-1:2014 defines the schema required for …​ L’ISO 19115-1:2014 définit le schéma requis pour …​ stage substage iteration 2014 #{Time.now.year} International Organization for Standardization ISO www.iso.org ISO 19115:2003 ISO 19115:2003/Cor 1:2006 ISO/IEC FDIS 10118-3 Serie’s place Serie’s organization ABVR 2009-02-01 2010-12-20 serie1234 part5678 serieref
medium form
medium size medium scale
bib place 7 accesslocation1 accesslocation2 value 2010-10-10 12:21 2011-02-03 18:30
OUTPUT end it "processes complex dl reference with dot path keys" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References [[ISOTC211]] [%bibitem] === {blank} fetched:: 2019-06-30 title:: title.type:: main title.content:: Geographic information title:: title.type:: subtitle title.content:: Geographic information subtitle title.language:: en title.script:: Latn title.format:: text/plain type:: standard docid:: docid.type:: ISO docid.id:: TC211 docnumber:: 211 edition:: 1 language:: en language:: fr script:: Latn version.revision_date:: 2019-04-01 version.draft:: draft biblionote.type:: bibnote biblionote.content:: + -- Mark set a major league home run record in 1998. -- docstatus.stage:: stage docstatus.substage:: substage docstatus.iteration:: iteration date:: date.type:: issued date.value:: 2014 date:: date.type:: published date.from:: 2014-04 date.to:: 2014-05 date:: date.type:: accessed date.value:: 2015-05-20 abstract:: abstract.content:: + -- ISO 19115-1:2014 defines the schema required for ... -- abstract:: abstract.content:: L'ISO 19115-1:2014 définit le schéma requis pour ... abstract.language:: fr abstract.script:: Latn abstract.format:: text/plain copyright.owner.name:: International Organization for Standardization copyright.owner.abbreviation:: ISO copyright.owner.url:: www.iso.org copyright.from:: 2014 copyright.to:: #{Time.now.year} link:: link.type:: src link.content:: https://www.iso.org/standard/53798.html link:: link.type:: obp link.content:: https://www.iso.org/obp/ui/#!iso:std:53798:en link:: link.type:: rss link.content:: https://www.iso.org/contents/data/standard/05/37/53798.detail.rss medium:: medium.form:: medium form medium.size:: medium size medium.scale:: medium scale place:: bib place extent.type:: section extent.reference_from:: 7 accesslocation:: accesslocation1 accesslocation:: accesslocation2 classification.type:: type classification.value:: value validity.begins:: 2010-10-10 12:21 validity.ends:: 2011-02-03 18:30 contributor:: contributor.organization.name:: International Organization for Standardization contributor.organization.url:: www.iso.org contributor.organization.abbreviation:: ISO contributor.organization.subdivision:: division contributor.role.type:: publisher contributor.role.description:: Publisher role contributor:: contributor.person.name.completename.content:: A. Bierman contributor.person.name.completename.language:: en contributor.person.affiliation.organization.name:: IETF contributor.person.affiliation.organization.abbreviation:: IETF contributor.person.affiliation.organization.identifier.type:: uri contributor.person.affiliation.organization.identifier.id:: www.ietf.org contributor.person.affiliation.description:: Affiliation description contributor.person.contact:: contributor.person.contact.street:: 8 Street St contributor.person.contact.city:: City contributor.person.contact.postcode:: 123456 contributor.person.contact.country:: Country contributor.person.contact.state:: State contributor.person.contact:: contributor.person.contact.type:: phone contributor.person.contact.value:: 223322 contributor.role:: author contributor:: contributor.organization.name:: IETF contributor.organization.abbreviation:: IETF contributor.organization.identifier.type:: uri contributor.organization.identifier.id:: www.ietf.org contributor.role:: publisher contributor:: contributor.person.name.language:: en contributor.person.name.initial:: A. contributor.person.name.surname:: Bierman contributor.person.affiliation.organization.name:: IETF contributor.person.affiliation.organization.abbreviation:: IETF contributor.person.affiliation.description.content:: Affiliation description contributor.person.affiliation.description.language:: en contributor.person.affiliation.description.script:: Latn contributor.person.identifier.type:: uri contributor.person.identifier.id:: www.person.com contributor.role:: author relation:: relation.type:: updates relation.bibitem.formattedref:: ISO 19115:2003 relation.bibitem.bib_locality.type:: page relation.bibitem.bib_locality.reference_from:: 7 relation.bibitem.bib_locality.reference_to:: 10 relation:: relation.type:: updates relation.bibitem.type:: standard relation.bibitem.formattedref:: ISO 19115:2003/Cor 1:2006 series:: series.type:: main series.title.type:: original series.title.content:: ISO/IEC FDIS 10118-3 series.title.language:: en series.title.script:: Latn series.title.format:: text/plain series.place:: Serie's place series.organization:: Serie's organization series.abbreviation.content:: ABVR series.abbreviation.language:: en series.abbreviation.script:: Latn series.from:: 2009-02-01 series.to:: 2010-12-20 series.number:: serie1234 series.partnumber:: part5678 series:: series.type:: alt series.formattedref.content:: serieref series.formattedref.language:: en series.formattedref.script:: Latn INPUT #{BLANK_HDR} Normative references #{NORM_REF_BOILERPLATE} 2019-06-30 Geographic information Geographic information subtitle https://www.iso.org/standard/53798.html https://www.iso.org/obp/ui/#!iso:std:53798:en https://www.iso.org/contents/data/standard/05/37/53798.detail.rss TC211 211 2014 2014-04 2014-05 2015-05-20 Publisher role International Organization for Standardization division ISO www.iso.org A. Bierman Affiliation description IETF IETF www.ietf.org
8 Street St City State Country 123456
223322
IETF IETF www.ietf.org A. Bierman Affiliation description IETF IETF www.person.com 1 2019-04-01 draft Mark set a major league home run record in 1998. en fr ISO 19115-1:2014 defines the schema required for …​ L’ISO 19115-1:2014 définit le schéma requis pour …​ stage substage iteration 2014 #{Time.now.year} International Organization for Standardization ISO www.iso.org ISO 19115:2003 ISO 19115:2003/Cor 1:2006 ISO/IEC FDIS 10118-3 Serie’s place Serie’s organization ABVR 2009-02-01 2010-12-20 serie1234 part5678 serieref
medium form
medium size medium scale
bib place 7 accesslocation1 accesslocation2 value 2010-10-10 12:21 2011-02-03 18:30
OUTPUT end it "processes mix of dl and default references" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Section === Subsection [bibliography] === Normative References * [[[A, B]]], Title [%bibitem] ==== Standard id:: iso123 docid:: type::: ISO id::: ISO 123 type:: standard contributor:: role::: publisher organization::: name:::: ISO contributor:: role::: author person::: name:::: + -- completename:: language::: en content::: Fred -- contributor:: role::: author person::: name:::: completename::::: Jack INPUT #{BLANK_HDR} Section Subsection Normative references Title B #{Date.today.to_s} Standard Standard ISO 123 ISO Fred Jack OUTPUT end end