require "spec_helper" require "relaton_iec" require "fileutils" RSpec.describe Asciidoctor::Standoc do it "applies smartquotes by default" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == "Quotation" A's INPUT #{BLANK_HDR} “Quotation” A’s OUTPUT end it "applies smartquotes when requested" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :smartquotes: true == "Quotation" A's INPUT #{BLANK_HDR} “Quotation” A’s OUTPUT end it "does not apply smartquotes when requested not to" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :smartquotes: false == "Quotation" A's `"quote" A's` INPUT #{BLANK_HDR} "Quotation" A's

"quote" A's

OUTPUT end it "does not apply smartquotes to sourcecode, tt, pre, pseudocode" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :smartquotes: true == "Quotation" A's "Quotation" A's `"quote" A's` [source] ---- "quote" A's ---- [pseudocode] ==== "quote" A's ==== INPUT #{BLANK_HDR} “Quotation” A’s

“Quotation” A’s

"quote" A’s

"quote" A's

"quote" A's

OUTPUT end it "handles < > & in Asciidoctor correctly" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == {blank} <&> INPUT #{BLANK_HDR}

<&>

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

For the purposes of this document, the following terms and definitions apply.

t90t91

Time

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

For the purposes of this document, the following terms and definitions apply.

Tempus relativity

Time

Tempus1 relativity2

Time2

OUTPUT end it "permits multiple blocks in term definition paragraph" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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

For the purposes of this document, the following terms and definitions apply.

t90 tA

This paragraph is extraneous

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

For the purposes of this document, the following terms and definitions apply.

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(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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 expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} <> [bibliography] == Normative References * [[[iso216,ISO 216:2001]]], _Reference_ INPUT #{BLANK_HDR} Foreword

Normative References #{NORM_REF_BOILERPLATE} Reference ISO 216:2001 2001 ISO OUTPUT end it "extracts localities from erefs" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} <> [bibliography] == Normative References * [[[iso216,ISO 216]]], _Reference_ INPUT #{BLANK_HDR} Foreword

391133the reference

Normative References #{NORM_REF_BOILERPLATE} Reference ISO 216 ISO OUTPUT end it "strips type from xrefs" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} <> [bibliography] == Clause * [[[iso216,ISO 216]]], _Reference_ INPUT #{BLANK_HDR} Foreword

Bibliography Reference ISO 216 ISO OUTPUT end it "processes localities in term sources" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Terms and Definitions === Term1 [.source] <> INPUT #{BLANK_HDR} Terms and definitions

For the purposes of this document, the following terms and definitions apply.

Term1 1
OUTPUT end it "removes initial extraneous material from Normative References" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References This is extraneous information * [[[iso216,ISO 216]]], _Reference_ This is also extraneous information INPUT #{BLANK_HDR} Normative References #{NORM_REF_BOILERPLATE} Reference ISO 216 ISO

This is also extraneous information

OUTPUT end it "sorts references with their notes in Bibliography" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Bibliography This is extraneous information * [[[iso216,ISO 216]]], _Reference_ NOTE: ABC NOTE: DEF This is further extraneous information NOTE: GHI * [[[iso216,ISO 215]]], _Reference_ NOTE: JKL This is also extraneous information INPUT #{BLANK_HDR} Bibliography

This is extraneous information

Reference ISO 216 ISO

ABC

DEF

Reference ISO 215 ISO

JKL

This is further extraneous information

GHI

This is also extraneous information

OUTPUT end it "inserts IDs into paragraphs" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} Paragraph INPUT #{BLANK_HDR}

Paragraph

OUTPUT end it "inserts IDs into notes" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [stem] ++++ Formula ++++ Where, a:: b INPUT #{BLANK_HDR} Forμla
a

b

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

xyz

This is a footnote to a figure

This is another footnote to a figure

A

This is a third footnote

OUTPUT end it "moves figure key inside figure" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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}
Stages of gelatinization
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 expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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 #{NORM_REF_BOILERPLATE} Standard ISO 123:— ISO ISO DATE: The standard is in press OUTPUT end it "defaults section obligations" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Clause Text [appendix] == Clause Text INPUT #{BLANK_HDR} Clause

Text

Clause

Text

OUTPUT end it "rearranges term note, term example, term source" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Terms and definitions === Term [.source] <> NOTE: Note [example] Example 1 NOTE: Note 2 [example] Example 2 INPUT #{BLANK_HDR} Terms and definitions

For the purposes of this document, the following terms and definitions apply.

Term

Note

Note 2

Example 1

Example 2

1
OUTPUT end it "extends clause levels past 5" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Clause1 === Clause2 ==== Clause3 ===== Clause4 ====== Clause 5 [level=6] ====== Clause 6 [level=7] ====== Clause 7A [level=7] ====== Clause 7B [level=6] ====== Clause 6B ====== Clause 5B INPUT #{BLANK_HDR} Clause1 Clause2 Clause3 Clause4 Clause 5 Clause 6 Clause 7A Clause 7B Clause 6B Clause 5B OUTPUT end it "separates IEV citations by top-level clause" do FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1") FileUtils.mv File.expand_path("~/.relaton/cache"), File.expand_path("~/.relaton-bib.pstore1"), force: true FileUtils.rm_rf File.expand_path("~/.iev.pstore1") FileUtils.mv File.expand_path("~/.iev.pstore"), File.expand_path("~/.iev.pstore1"), force: true FileUtils.rm_rf "relaton/cache" FileUtils.rm_rf "test.iev.pstore" # mock_iecbib_get_iec60050_102_01 # mock_iecbib_get_iec60050_103_01 # mock_iev VCR.use_cassette "separates_iev_citations_by_top_level_clause" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{CACHED_ISOBIB_BLANK_HDR} [bibliography] == Normative References * [[[iev,IEV]]], _iev_ == Terms and definitions === Automation1 [.source] <> === Automation2 [.source] <> === Automation3 [.source] <> INPUT #{BLANK_HDR} Terms and definitions

For the purposes of this document, the following terms and definitions apply.

Automation1 103-01-02 Automation2 102-01-02 Automation3 103-01-02
Normative References #{NORM_REF_BOILERPLATE} #{Date.today} International Electrotechnical Vocabulary (IEV) Part 102: Mathematics — General concepts and linear algebra International Electrotechnical Vocabulary (IEV) – Part 102: Mathematics — General concepts and linear algebra https://webstore.iec.ch/publication/160 /preview/info_iec60050-102%7Bed1.0%7Db.pdf IEC 60050-102:2007 2007 International Electrotechnical Commission IEC www.iec.ch 1.0 en This part of IEC 60050 gives the general mathematical terminology used in the fields of electricity, electronics and telecommunications, together with basic concepts in linear algebra. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Another part will deal with functions. It has the status of a horizontal standard in accordance with IEC Guide 108. 60 60 2007 International Electrotechnical Commission IEC www.iec.ch Geneva #{Date.today} International Electrotechnical Vocabulary (IEV) Part 103: Mathematics — Functions International Electrotechnical Vocabulary (IEV) – Part 103: Mathematics — Functions https://webstore.iec.ch/publication/161 /preview/info_iec60050-103%7Bed1.0%7Db.pdf IEC 60050-103:2009 2009 International Electrotechnical Commission IEC www.iec.ch 1.0 en IEC 60050-103:2009 gives the terminology relative to functions of one or more variables. Together with IEC 60050-102, it covers the mathematical terminology used in the fields of electricity, electronics and telecommunications. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Mathematical symbols are generally in accordance with IEC 60027-1 and ISO 80000-2. This standard cancels and replaces Sections 101-13, 101-14 and 101-15 of International Standard IEC 60050-101:1998. It has the status of a horizontal standard in accordance with IEC Guide 108. 60 60 2009 International Electrotechnical Commission IEC www.iec.ch Geneva OUTPUT end FileUtils.rm_rf File.expand_path("~/.iev.pstore") FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev.pstore"), force: true FileUtils.rm_rf File.expand_path("~/.relaton/cache") FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton/cache"), force: true end it "counts footnotes with link-only content as separate footnotes" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} footnote:[http://www.example.com] footnote:[http://www.example.com] footnote:[http://www.example1.com] INPUT #{BLANK_HDR}

OUTPUT end it "retains AsciiMath on request" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :mn-keep-asciimath: stem:[1/r] INPUT #{BLANK_HDR}

1/r

OUTPUT end it "converts AsciiMath to MathML by default" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: stem:[1/r] INPUT #{BLANK_HDR}

1r

OUTPUT end it "cleans up text MathML" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: ++++ <math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mn>1</mn><mi>r</mi></mfrac></math> ++++ INPUT #{BLANK_HDR} 1r OUTPUT end it "renumbers numeric references in Bibliography sequentially" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Clause <> <> [bibliography] == Bibliography * [[[iso124,ISO 124]]] _Standard 124_ * [[[iso123,1]]] _Standard 123_ INPUT #{BLANK_HDR} Clause

Bibliography Standard 124 ISO 124 ISO Standard 123 [2] OUTPUT end it "renumbers numeric references in Bibliography subclauses sequentially" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Clause <> <> <> <> [bibliography] == Bibliography [bibliography] === Clause 1 * [[[iso124,ISO 124]]] _Standard 124_ * [[[iso123,1]]] _Standard 123_ [bibliography] === {blank} * [[[iso125,ISO 125]]] _Standard 124_ * [[[iso126,1]]] _Standard 123_ INPUT #{BLANK_HDR} Clause

Bibliography Clause 1 Standard 124 ISO 124 ISO Standard 123 [2] Standard 124 ISO 125 ISO Standard 123 [4] OUTPUT end it "inserts boilerplate before empty Normative References" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References INPUT #{BLANK_HDR} Normative References

There are no normative references in this document.

OUTPUT end it "inserts boilerplate before non-empty Normative References" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References * [[[a,b]]] A INPUT #{BLANK_HDR} Normative References

The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

A b
OUTPUT end it "inserts boilerplate before empty Normative References in French" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :language: fr [bibliography] == Normative References INPUT #{BLANK_HDR.sub(/en/, "fr")} Normative References

Le présent document ne contient aucune référence normative.

OUTPUT end it "removes bibdata bibitem IDs" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :translated-from: IEC 60050-102 [bibliography] == Normative References INPUT Document title en published #{Date.today.year} -- IEC 60050-102 article Normative References

There are no normative references in this document.

OUTPUT end it "imports boilerplate file" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docstage: 10 :boilerplate-authority: spec/assets/boilerplate.xml == Clause 1 INPUT Document title en 10 #{Date.today.year} article 10 Clause 1 OUTPUT end it "sorts symbols lists" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [[L]] == Symbols and abbreviated terms α:: Definition 1 xa:: Definition 2 x_1_:: Definition 3 x_m_:: Definition 4 x:: Definition 5 INPUT #{BLANK_HDR} Symbols and abbreviated terms
x

Definition 5

x_m_

Definition 4

x_1_

Definition 3

xa

Definition 2

α

Definition 1

OUTPUT end it "sorts symbols lists" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [[L]] == Symbols and abbreviated terms stem:[alpha]:: Definition 1 xa:: Definition 2 stem:[x_1]:: Definition 3 stem:[x_m]:: Definition 4 x:: Definition 5 INPUT #{BLANK_HDR} Symbols and abbreviated terms
x

Definition 5

x_m

Definition 4

x_1

Definition 3

xa

Definition 2

α

Definition 1

OUTPUT end it "moves inherit macros to correct location" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Clause [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 & /ss/584/2015/level/2"] .Title ==== inherit:[A] inherit:[B] I recommend this ==== [.requirement,subsequence="A",classification="X:Y"] .Title ==== inherit:[A] I recommend this ==== [.requirement,subsequence="A"] .Title ==== inherit:[A] I recommend this ==== [.requirement,subsequence="A"] .Title ==== inherit:[A] ==== INPUT #{BLANK_HDR} Clause Title /ss/584/2015/level/1 & /ss/584/2015/level/2 A B

I recommend this

Title A X Y

I recommend this

Title A

I recommend this

Title A

OUTPUT end private def mock_iecbib_get_iec60050_103_01 expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-103", nil, {keep_year: true}) do IsoBibItem::XMLParser.from_xml(<<~"OUTPUT") International Electrotechnical Vocabulary IEC 60050-103:2009 2009 International Electrotechnical Commission IEC www.iec.ch en fr 60 2018 International Electrotechnical Commission IEC www.iec.ch OUTPUT end end def mock_iecbib_get_iec60050_102_01 expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-102", nil, {keep_year: true}) do IsoBibItem::XMLParser.from_xml(<<~"OUTPUT") International Electrotechnical Vocabulary IEC 60050-102:2007 2007 International Electrotechnical Commission IEC www.iec.ch en fr 60 2018 International Electrotechnical Commission IEC www.iec.ch OUTPUT end end def mock_iev expect(Iecbib::IecBibliography).to receive(:get).with("IEV", nil, {}) do IsoBibItem::XMLParser.from_xml(<<~"OUTPUT") International Electrotechnical Vocabulary IEC 60050:2011 2007 International Electrotechnical Commission IEC www.iec.ch en fr 60 2018 International Electrotechnical Commission IEC www.iec.ch OUTPUT end.at_least :once end end