require "spec_helper" RSpec.describe IsoDoc do it "cross-references external documents in HTML" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"

Foreword

a#b

OUTPUT end it "cross-references external documents in DOC" do expect(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*

/m, '
').sub(%r{
.*$}m, "
")).to be_equivalent_to <<~"OUTPUT"


Foreword

a#b

OUTPUT end it "cross-references notes" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)). to be_equivalent_to <<~"OUTPUT"

These results are based on a study carried out on three different types of kernel.

Preparatory

These results are based on a study carried out on three different types of kernel.

Scope

These results are based on a study carried out on three different types of kernel.

Widgets

These results are based on a study carried out on three different types of kernel.

These results are based on a study carried out on three different types of kernel.

These results are based on a study carried out on three different types of kernel.

These results are based on a study carried out on three different types of kernel.

These results are based on a study carried out on three different types of kernel.

INPUT #{HTML_HDR}

Foreword

Introduction, Note Preparatory, Note Clause 1, Note Clause 3.1, Note 1 Clause 3.1, Note 2 Annex A.1, Note Annex A.2, Note 1 Annex A.2, Note 2


Introduction

NOTE  These results are based on a study carried out on three different types of kernel.

Preparatory

NOTE  These results are based on a study carried out on three different types of kernel.

1.  Scope

NOTE  These results are based on a study carried out on three different types of kernel.

Note

2.  Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

3.  Widgets

3.1.

NOTE 1  These results are based on a study carried out on three different types of kernel.

NOTE 2  These results are based on a study carried out on three different types of kernel.

Note 1 Note 2


A.1.

NOTE  These results are based on a study carried out on three different types of kernel.

A.2.

NOTE 1  These results are based on a study carried out on three different types of kernel.

NOTE 2  These results are based on a study carried out on three different types of kernel.

OUTPUT end it "cross-references figures" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"

Split-it-right sample divider
Preparatory
Split-it-right sample divider
Scope
Split-it-right sample divider

Widgets
Split-it-right sample divider
Split-it-right sample divider

Split-it-right sample divider
Split-it-right sample divider
Split-it-right sample divider
INPUT #{HTML_HDR}

Foreword

Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure A.1 Figure A.2 Figure A.3


Introduction

Figure 1 — Split-it-right sample divider

Preparatory

Figure 2 — Split-it-right sample divider

1.  Scope

Figure 3 — Split-it-right sample divider

Figure 3

2.  Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

3.  Widgets

3.1.

Figure 4 — Split-it-right sample divider

Figure 5 — Split-it-right sample divider

Figure 4 Figure 5


A.1.

Figure A.1 — Split-it-right sample divider

A.2.

Figure A.2 — Split-it-right sample divider

Figure A.3 — Split-it-right sample divider

OUTPUT end it "cross-references subfigures" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"

Scope Widgets
Split-it-right sample divider
Split-it-right sample divider

Split-it-right sample divider
Split-it-right sample divider
INPUT #{HTML_HDR}

Foreword

Figure 1 Figure 1-1 Figure 1-2 Figure A.1 Figure A.1-1 Figure A.1-2

1.  Scope

2.  Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

3.  Widgets

3.1.

Figure 1-1 — Split-it-right sample divider

Figure 1-2 — Split-it-right sample divider

Figure 1-1 Figure 1-2


A.1.

A.2.

Figure A.1-1 — Split-it-right sample divider

Figure A.1-2 — Split-it-right sample divider

OUTPUT end it "cross-references examples" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"

Hello

Preparatory

Hello

Scope

Hello

Widgets

Hello

Hello

Hello

Hello

Hello

INPUT #{HTML_HDR}

Foreword

Introduction, Example Preparatory, Example Clause 1, Example Clause 3.1, Example 1 Clause 3.1, Example 2 Annex A.1, Example Annex A.2, Example 1 Annex A.2, Example 2


Introduction

EXAMPLE

Hello

Preparatory

EXAMPLE

Hello

1.  Scope

EXAMPLE

Hello

Example

2.  Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

3.  Widgets

3.1.

EXAMPLE 1

Hello

EXAMPLE 2

Hello

Example 1 Example 2


A.1.

EXAMPLE

Hello

A.2.

EXAMPLE 1

Hello

EXAMPLE 2

Hello

OUTPUT end it "cross-references formulae" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"

r = 1 % Preparatory r = 1 %
Scope r = 1 %

Widgets r = 1 % r = 1 %

r = 1 % r = 1 % r = 1 %
r = 1 %
r

is the repeatability limit.

INPUT #{HTML_HDR}

Foreword

Introduction, Formula (1) Preparatory, Formula (2) Clause 1, Formula (3) Clause 3.1, Formula (4) Clause 3.1, Formula (5) Annex A.1, Formula (A.1) Annex A.2, Formula (A.2) Annex A.2, Formula (A.3)


Introduction

(#(r = 1 %)#)  (1)

Preparatory

(#(r = 1 %)#)  (2)

1.  Scope

(#(r = 1 %)#)  (3)

Formula (3)

2.  Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

3.  Widgets

3.1.

(#(r = 1 %)#)  (4)
(#(r = 1 %)#)  (5)

Formula (4) Formula (5)


A.1.

(#(r = 1 %)#)  (A.1)

A.2.

(#(r = 1 %)#)  (A.2)
(#(r = 1 %)#)  (A.3)
OUTPUT end it "cross-references tables" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"

Repeatability and reproducibility of husked rice yield
Number of laboratories retained after eliminating outliers 13 11
Preparatory Repeatability and reproducibility of husked rice yield
Number of laboratories retained after eliminating outliers 13 11
Scope Repeatability and reproducibility of husked rice yield
Number of laboratories retained after eliminating outliers 13 11

Widgets Repeatability and reproducibility of husked rice yield
Number of laboratories retained after eliminating outliers 13 11
Repeatability and reproducibility of husked rice yield
Number of laboratories retained after eliminating outliers 13 11

Repeatability and reproducibility of husked rice yield
Number of laboratories retained after eliminating outliers 13 11
Repeatability and reproducibility of husked rice yield
Number of laboratories retained after eliminating outliers 13 11
Repeatability and reproducibility of husked rice yield
Number of laboratories retained after eliminating outliers 13 11
INPUT #{HTML_HDR}

Foreword

Table 1 Table 2 Table 3 Table 4 Table 5 Table A.1 Table A.2 Table A.3


Introduction

Table 1 — Repeatability and reproducibility of husked rice yield

Number of laboratories retained after eliminating outliers 13 11

Preparatory

Table 2 — Repeatability and reproducibility of husked rice yield

Number of laboratories retained after eliminating outliers1311

1.  Scope

Table 3 — Repeatability and reproducibility of husked rice yield

Number of laboratories retained after eliminating outliers 13 11

Table 3

2.  Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

3.  Widgets

3.1.

Table 4 — Repeatability and reproducibility of husked rice yield

Number of laboratories retained after eliminating outliers1311

Table 5 — Repeatability and reproducibility of husked rice yield

Number of laboratories retained after eliminating outliers1311

Table 4 Table 5


A.1.

Table A.1 — Repeatability and reproducibility of husked rice yield

Number of laboratories retained after eliminating outliers1311

A.2.

Table A.2 — Repeatability and reproducibility of husked rice yield

Number of laboratories retained after eliminating outliers1311

Table A.3 — Repeatability and reproducibility of husked rice yield

Number of laboratories retained after eliminating outliers1311
OUTPUT end it "cross-references term notes" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"

Scope waxy rice

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

nonwaxy rice

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

INPUT #{HTML_HDR}

Foreword

Clause 2.1, Note 1 Clause 2.2, Note 1 Clause 2.2, Note 2

1.  Scope

2.  Terms and definitions

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

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

2.1

waxy rice

Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

2.2

nonwaxy rice

Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

Note 2 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

OUTPUT end it "cross-references sections" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Foreword

This is a preamble

Introduction Introduction Subsection Text
Scope

Text

Terms, definitions, symbols and abbreviated terms Normal Terms Term2
Symbol
Definition
Symbol
Definition
Clause 4 Introduction Clause 4.2
Annex Annex A.1 Annex A.1a Normative References Bibliography Bibliography Subsection
INPUT #{HTML_HDR}

Foreword

This is a preamble Introduction Subsection Introduction, 2 Clause 1 Clause 3 Clause 3.1 Clause 3.1.1 Clause 3.2 Clause 4 Clause 5 Clause 5.1 Clause 5.2 Annex A Annex A.1 Annex A.1.1 Clause 2


Introduction

Introduction Subsection

Text

1.  Scope

Text

2.  Normative references

There are no normative references in this document.

3.  Terms, definitions, symbols and abbreviated terms

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

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

3.1. Normal Terms

3.1.1

Term2

3.2. Symbols and abbreviated terms

Symbol

Definition

4.  Symbols and abbreviated terms

Symbol

Definition

5.  Clause 4

5.1. Introduction

5.2. Clause 4.2


Annex A
(normative)

Annex

A.1. Annex A.1

A.1.1. Annex A.1a


Bibliography

Bibliography Subsection

OUTPUT end it "cross-references lists" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"

  1. A

Preparatory
  1. A

Scope
  1. A

Widgets

    These results are based on a study carried out on three different types of kernel.

    These results are based on a study carried out on three different types of kernel.

    These results are based on a study carried out on three different types of kernel.

    These results are based on a study carried out on three different types of kernel.

    These results are based on a study carried out on three different types of kernel.

INPUT #{HTML_HDR}

Foreword

Introduction, List Preparatory, List Clause 1, List Clause 3.1, List 1 Clause 3.1, List 2 Annex A.1, List Annex A.2, List 1 Annex A.2, List 2


Introduction

  1. A

Preparatory

  1. A

1.  Scope

  1. A

2.  Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

3.  Widgets

3.1.

    These results are based on a study carried out on three different types of kernel.

    These results are based on a study carried out on three different types of kernel.


A.1.

    These results are based on a study carried out on three different types of kernel.

A.2.

    These results are based on a study carried out on three different types of kernel.

    These results are based on a study carried out on three different types of kernel.

OUTPUT end it "cross-references list items" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"

  1. A

Preparatory
  1. A

Scope
  1. A

Widgets
  1. A

  1. A

  1. A

  1. A

  1. A

INPUT #{HTML_HDR}

Foreword

Introduction, a) Preparatory, a) Clause 1, a) Clause 3.1, List 1 a) Clause 3.1, List 2 a) Annex A.1, a) Annex A.2, List 1 a) Annex A.2, List 2 a)


Introduction

  1. A

Preparatory

  1. A

1.  Scope

  1. A

2.  Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

3.  Widgets

3.1.

  1. A

  1. A


A.1.

  1. A

A.2.

  1. A

  1. A

OUTPUT end it "cross-references nested list items" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"

Scope
  1. A

    1. A

      1. A

        1. A

          1. A

            1. A

INPUT #{HTML_HDR}

Foreword

Clause 1, a) Clause 1, a.1) Clause 1, a.1.i) Clause 1, a.1.i.A) Clause 1, a.1.i.A.I) Clause 1, a.1.i.A.I.a)

1.  Scope

  1. A

    1. A

      1. A

        1. A

          1. A

            1. A

OUTPUT end end