require "spec_helper"
RSpec.describe IsoDoc do
it "processes prefatory blocks" do
input = <<~INPUT
abstract
introduction
note
Clause 4
Introduction
Clause 4.2
admonition
INPUT
expect(xmlpp(IsoDoc::HtmlConvert.new({})
.convert("test", input, true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
note
abstract
introduction
Clause 4
Introduction
Clause 4.2
OUTPUT
expect(xmlpp(IsoDoc::WordConvert.new({})
.convert("test", input, true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
Clause 4
Introduction
Clause 4.2
OUTPUT
end
it "processes document with no content" do
input = <<~INPUT
INPUT
output = <<~OUTPUT
OUTPUT
expect(xmlpp(IsoDoc::HtmlConvert.new({})
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
end
it "processes section names" do
input = <<~"INPUT"
Copyright
License
Legal
Feedback
Abstract
Foreword
This is a preamble
Introduction
Introduction Subsection
Dedication
Note to reader
Acknowledgements
Initial note
Initial admonition
Scope
Text
Terms, Definitions, Symbols and Abbreviated Terms
Normal Terms
Term2
Definitions
- Symbol
- Definition
Symbols and abbreviated terms
- Symbol
- Definition
Clause 4
Introduction
Clause 4.2
Annex
Annex A.1
Annex A.1a
Annex Bibliography
Normative References
Bibliography
Bibliography Subsection
INPUT
presxml = <<~"PRESXML"
Copyright
License
Legal
Feedback
Abstract
Foreword
This is a preamble
Introduction
Introduction Subsection
Dedication
Note to reader
Acknowledgements
NOTE
Initial note
Initial admonition
1.Scope
Text
3.Terms, Definitions, Symbols and Abbreviated Terms
3.1.Normal Terms
3.1.1.
Term2
3.2.Definitions
- Symbol
- Definition
4.Symbols and abbreviated terms
- Symbol
- Definition
5.Clause 4
5.1.Introduction
5.2.Clause 4.2
5.3.
Annex A
(normative)
Annex
A.1.Annex A.1
A.1.1.Annex A.1a
A.1.2.Annex Bibliography
Annex B
(normative)
2.Normative References
Bibliography
Bibliography Subsection
PRESXML
html = <<~"OUTPUT"
#{HTML_HDR}
Abstract
Foreword
This is a preamble
Introduction
Introduction Subsection
Dedication
Note to reader
Acknowledgements
WARNING
Initial admonition
2. Normative References
3. Terms, Definitions, Symbols and Abbreviated Terms
3.1. Normal Terms
3.1.1.
Term2
3.2. Definitions
Symbol
- Definition
4. Symbols and abbreviated terms
-
Symbol
- Definition
5. Clause 4
5.1. Introduction
5.2. Clause 4.2
5.3.
Annex A
(normative)
Annex
A.1. Annex A.1
A.1.1. Annex A.1a
A.1.2. Annex Bibliography
Annex B
(normative)
Bibliography
Bibliography Subsection