require "spec_helper" RSpec.describe Asciidoctor::ISO do it "removes empty text elements" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} == {blank} INPUT #{BLANK_HDR} OUTPUT end it "processes stem-only terms as admitted" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} == Terms and Definitions === stem:[t_90] stem:[t_91] Time INPUT #{BLANK_HDR} Terms and Definitions t_90t_91

Time

OUTPUT end it "moves term domains out of the term definition paragraph" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} == Terms and Definitions === Tempus domain:[relativity] Time INPUT #{BLANK_HDR} Terms and Definitions Tempus relativity

Time

OUTPUT end it "permits multiple blocks in term definition paragraph" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" = Document title Author :docfile: test.adoc :nodoc: :novalid: :stem: == Terms and Definitions === stem:[t_90] [stem] ++++ t_A ++++ This paragraph is extraneous INPUT #{BLANK_HDR} Terms and Definitions t_90 t_A

This paragraph is extraneous

OUTPUT end it "strips any initial boilerplate from terms and definitions" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} == Terms and Definitions I am boilerplate * So am I === Time This paragraph is extraneous INPUT #{BLANK_HDR} Terms and Definitions Time

This paragraph is extraneous

OUTPUT end it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} [stem] ++++ r = 1 % r = 1 % ++++ NOTE: That formula does not do much Indeed. INPUT #{BLANK_HDR} r = 1 % r = 1 %

That formula does not do much

Indeed.

OUTPUT end it "does not move notes inside preceding blocks, if they are at clause end" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} [source,ruby] [1...x].each do |y| puts y end NOTE: That loop does not do much INPUT #{BLANK_HDR} [1...x].each do |y| puts y end

That loop does not do much

OUTPUT end it "converts xrefs to references into erefs" do stub_fetch_ref expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} <> [bibliography] == Normative References * [[[iso216,ISO 216:2001]]], _Reference_ INPUT #{BLANK_HDR} Foreword

Normative References Writing paper and certain classes of printed matter -- Trimmed sizes -- A and B series, and indication of machine direction Papiers à écrire et certaines catégories d'imprimés -- Formats finis -- Séries A et B, et indication du sens machine https://www.iso.org/standard/36631.html https://www.iso.org/obp/ui/#!iso:std:36631:en https://www.iso.org/contents/data/standard/03/66/36631.detail.rss ISO 216 2007 International Organization for Standardization ISO www.iso.org 2 en fr ISO 216:2007 specifies the trimmed sizes of writing paper and certain classes of printed matter.It applies to trimmed sizes of paper for administrative, commercial and technical use, and also to certain classes of printed matter, such as forms, catalogues, etc.It does not necessarily apply to newspapers, published books, posters or other special items which may be the subject of separate International Standards.ISO 216:2007 also specifies the method for the indication of the machine direction for trimmed sheets. L'ISO 216:2007 spécifie les formats finis des papiers à écrire et de certaines catégories d'imprimés.Elle s'applique aux formats finis de papier pour usages administratif, commercial et technique ainsi qu'à certaines catégories d'imprimés, tels que formulaires, catalogues, etc.Elle ne s'applique pas nécessairement au papier journal, à l'édition, aux affiches publicitaires ou aux usages particuliers qui pourront faire l'objet d'autres Normes internationales.L'ISO 216:2007 spécifie également la méthode permettant d'indiquer le sens machine des formats finis. Published 2007 ISO ISO 216:1975 ISO 216:1975 ISO 216:2007 ISO 216:2007 OUTPUT end it "extracts localities from erefs" do stub_fetch_ref expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} <> [bibliography] == Normative References * [[[iso216,ISO 216]]], _Reference_ INPUT #{BLANK_HDR} Foreword

391133the reference

Normative References Writing paper and certain classes of printed matter -- Trimmed sizes -- A and B series, and indication of machine direction Papiers à écrire et certaines catégories d'imprimés -- Formats finis -- Séries A et B, et indication du sens machine https://www.iso.org/standard/36631.html https://www.iso.org/obp/ui/#!iso:std:36631:en https://www.iso.org/contents/data/standard/03/66/36631.detail.rss ISO 216 2007 International Organization for Standardization ISO www.iso.org 2 en fr ISO 216:2007 specifies the trimmed sizes of writing paper and certain classes of printed matter.It applies to trimmed sizes of paper for administrative, commercial and technical use, and also to certain classes of printed matter, such as forms, catalogues, etc.It does not necessarily apply to newspapers, published books, posters or other special items which may be the subject of separate International Standards.ISO 216:2007 also specifies the method for the indication of the machine direction for trimmed sheets. L'ISO 216:2007 spécifie les formats finis des papiers à écrire et de certaines catégories d'imprimés.Elle s'applique aux formats finis de papier pour usages administratif, commercial et technique ainsi qu'à certaines catégories d'imprimés, tels que formulaires, catalogues, etc.Elle ne s'applique pas nécessairement au papier journal, à l'édition, aux affiches publicitaires ou aux usages particuliers qui pourront faire l'objet d'autres Normes internationales.L'ISO 216:2007 spécifie également la méthode permettant d'indiquer le sens machine des formats finis. Published 2007 ISO ISO 216:1975 ISO 216:1975 ISO 216:2007 ISO 216:2007 OUTPUT end it "strips type from xrefs" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} <> [bibliography] == Clause * [[[iso216,ISO 216]]], _Reference_ INPUT #{BLANK_HDR} Foreword

Clause
  • [ISO 216]

    , Reference

OUTPUT end it "processes localities in term sources" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} == Terms and Definitions === Term1 [.source] <> INPUT #{BLANK_HDR} Terms and Definitions Term1 1 OUTPUT end it "removes extraneous material from Normative References" do stub_fetch_ref expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References This is extraneous information * [[[iso216,ISO 216]]], _Reference_ INPUT #{BLANK_HDR} Normative References Writing paper and certain classes of printed matter -- Trimmed sizes -- A and B series, and indication of machine direction Papiers à écrire et certaines catégories d'imprimés -- Formats finis -- Séries A et B, et indication du sens machine https://www.iso.org/standard/36631.html https://www.iso.org/obp/ui/#!iso:std:36631:en https://www.iso.org/contents/data/standard/03/66/36631.detail.rss ISO 216 2007 International Organization for Standardization ISO www.iso.org 2 en fr ISO 216:2007 specifies the trimmed sizes of writing paper and certain classes of printed matter.It applies to trimmed sizes of paper for administrative, commercial and technical use, and also to certain classes of printed matter, such as forms, catalogues, etc.It does not necessarily apply to newspapers, published books, posters or other special items which may be the subject of separate International Standards.ISO 216:2007 also specifies the method for the indication of the machine direction for trimmed sheets. L'ISO 216:2007 spécifie les formats finis des papiers à écrire et de certaines catégories d'imprimés.Elle s'applique aux formats finis de papier pour usages administratif, commercial et technique ainsi qu'à certaines catégories d'imprimés, tels que formulaires, catalogues, etc.Elle ne s'applique pas nécessairement au papier journal, à l'édition, aux affiches publicitaires ou aux usages particuliers qui pourront faire l'objet d'autres Normes internationales.L'ISO 216:2007 spécifie également la méthode permettant d'indiquer le sens machine des formats finis. Published 2007 ISO ISO 216:1975 ISO 216:1975 ISO 216:2007 ISO 216:2007 OUTPUT end it "inserts IDs into paragraphs" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} Paragraph INPUT #{BLANK_HDR}

Paragraph

OUTPUT end it "inserts IDs into notes" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} [example] ==== NOTE: This note has no ID ==== INPUT #{BLANK_HDR}

This note has no ID

OUTPUT end it "moves table key inside table" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} |=== |a |b |c |=== Key a:: b INPUT #{BLANK_HDR}
a

b

a b c
OUTPUT end it "processes headerrows attribute for table without header rows" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} [headerrows=3] |=== |a |b |c |a |b |c |a |b |c |a |b |c |=== INPUT #{BLANK_HDR}
a b c
a b c
a b c
a b c
OUTPUT end it "processes headerrows attribute for table with header rows" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} [headerrows=3] |=== |a |b |c |a |b |c |a |b |c |a |b |c |=== INPUT #{BLANK_HDR}
a b c
a b c
a b c
a b c
OUTPUT end it "moves table notes inside table" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} |=== |a |b |c |=== NOTE: Note 1 NOTE: Note 2 INPUT #{BLANK_HDR}

Note 1

Note 2

a b c
OUTPUT end it "moves formula key inside formula" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} [stem] ++++ Formula ++++ where a:: b INPUT #{BLANK_HDR} Formula
a

b

OUTPUT end it "moves footnotes inside figures" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} image::spec/examples/rice_images/rice_image1.png[] footnote:[This is a footnote to a figure] footnote:[This is another footnote to a figure] INPUT #{BLANK_HDR}

This is a footnote to a figure

This is another footnote to a figure

OUTPUT end it "moves figure key inside figure" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} image::spec/examples/rice_images/rice_image1.png[] Key a:: b INPUT #{BLANK_HDR}
a

b

OUTPUT end it "processes subfigures" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} [[figureC-2]] .Stages of gelatinization ==== .Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels) image::spec/examples/rice_images/rice_image3_1.png[] .Intermediate stages: Some fully gelatinized kernels are visible image::spec/examples/rice_images/rice_image3_2.png[] .Final stages: All kernels are fully gelatinized image::spec/examples/rice_images/rice_image3_3.png[] ==== INPUT #{BLANK_HDR}
Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)
Intermediate stages: Some fully gelatinized kernels are visible
Final stages: All kernels are fully gelatinized
OUTPUT end it "numbers bibliographic notes and footnotes sequentially" do stub_fetch_ref(no_year: true, note: "The standard is in press") expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} footnote:[Footnote] [bibliography] == Normative References * [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_ == Clause footnote:[Footnote2] INPUT #{BLANK_HDR} Foreword

Footnote

Clause

Footnote2

Normative References Rubber latex -- Sampling -- Latex de caoutchouc -- Échantillonnage -- https://www.iso.org/standard/23281.html https://www.iso.org/obp/ui/#!iso:std:23281:en https://www.iso.org/contents/data/standard/02/32/23281.detail.rss ISO 123 -- International Organization for Standardization ISO www.iso.org 3 en fr Published 2001 ISO ISO 123:1985 ISO 123:1985 ISO 123:2001 ISO 123:2001 ISO DATE: The standard is in press OUTPUT end it "defaults section obligations" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} == Clause Text [appendix] == Clause Text INPUT #{BLANK_HDR} Clause

Text

Clause

Text

OUTPUT end end