require "spec_helper" require "nokogiri" RSpec.describe IsoDoc do it "cleans up admonitions" do expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
Warning

Text

INPUT

Warning—Text

OUTPUT end it "cleans up figures" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")

Warning

a
INPUT

Warning

Key

a 

Parboiled rice.

OUTPUT end it "cleans up figures (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")

Warning

a
INPUT

Warning

Key

a 

Parboiled rice.

OUTPUT end it "cleans up inline headers" do expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT") test

 


 


4.  Clause 4

4.1. Introduction

4.2. Clause 4.2
4.3. Clause 4.3

text

INPUT test

 


 


4.  Clause 4

4.1. Introduction

4.2. Clause 4.2

4.3. Clause 4.3 text

OUTPUT end it "cleans up footnotes" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT") #{HTML_HDR}

Foreword

A.2

B.2

C.1

INPUT #{HTML_HDR}

Foreword

A.1

B.2

C.3

OUTPUT end it "cleans up footnotes (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")

 



Foreword

A.1

B.2

C.3

 


INPUT

 



Foreword

A.1

B.2

C.3

 


OUTPUT end it "cleans up tables with tfoot" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT") test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Drago

A type of rice

NOTE  This is a table about rice

Description Rice sample
Arborio Dragoa Balillaa Thaibonnet
Number of laboratories retained after eliminating outliers 13 11 13 13
Mean value, g/100 g 81,2 82,0 81,8 77,7
Reproducibility limit, (#(R)#) (= 2,83 (#(s_R)#)) 2,89 0,57 2,26 6,06

 


INPUT test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Drago

A type of rice
Description Rice sample
Arborio Dragoa Balillaa Thaibonnet
Number of laboratories retained after eliminating outliers 13 11 13 13
Mean value, g/100 g 81,2 82,0 81,8 77,7
Reproducibility limit, (#(R)#) (= 2,83 (#(s_R)#)) 2,89 0,57 2,26 6,06

NOTE  This is a table about rice

a  Parboiled rice.

 


OUTPUT end it "cleans up tables with tfoot (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT") test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Drago

A type of rice

NOTE  This is a table about rice

Description Rice sample
Arborio Dragoa Balillaa Thaibonnet
Number of laboratories retained after eliminating outliers 13 11 13 13
Mean value, g/100 g 81,2 82,0 81,8 77,7
Reproducibility limit, (#(R)#) (= 2,83 (#(s_R)#)) 2,89 0,57 2,26 6,06

 


INPUT test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Drago

A type of rice
Description Rice sample
Arborio Dragoa Balillaa Thaibonnet
Number of laboratories retained after eliminating outliers 13 11 13 13
Mean value, g/100 g 81,2 82,0 81,8 77,7
Reproducibility limit, (#(R)#) (= 2,83 (#(s_R)#)) 2,89 0,57 2,26 6,06

NOTE  This is a table about rice

a  Parboiled rice.

 


OUTPUT end it "cleans up tables without tfoot" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT") test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Drago

A type of rice

NOTE  This is a table about rice

Description Rice sample
Arborio Dragoa Balillaa Thaibonnet
Number of laboratories retained after eliminating outliers 13 11 13 13
Mean value, g/100 g 81,2 82,0 81,8 77,7

 


INPUT test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Drago

A type of rice
Description Rice sample
Arborio Dragoa Balillaa Thaibonnet
Number of laboratories retained after eliminating outliers 13 11 13 13
Mean value, g/100 g 81,2 82,0 81,8 77,7

NOTE  This is a table about rice

a  Parboiled rice.

 


OUTPUT end it "does not break up very long strings in tables by default" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT") test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Description Description Rice sample
http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
INPUT test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Description Description Rice sample
http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
OUTPUT end it "does not break up very long strings in tables on request in HTML" do expect(xmlpp(IsoDoc::HtmlConvert.new({break_up_urls_in_tables: "true"}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT") test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Description Description Rice sample
http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
INPUT test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Description Description Rice sample
http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
OUTPUT end it "does not break up very long strings in tables by default (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT") test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Description Description Rice sample
http://www.example.com/&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
INPUT test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Description Description Rice sample
http://www.example.com/&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
OUTPUT end it "breaks up very long strings in tables on request (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({break_up_urls_in_tables: "true"}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT") test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Description Description Rice sample
http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
INPUT test

 



Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Description Description Rice sample
http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/ BBBBBBBBBBBBBBBBBBBBBBBBBBBB http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
OUTPUT end it "cleans up term sources" do c = IsoDoc::HtmlConvert.new({i18nyaml: "spec/assets/i18n.yaml"}) c.i18n_init("en", "Latn") expect(xmlpp(c.textcleanup(<<~"INPUT").to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT") #{HTML_HDR}

1.  Terms and Definitions

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

1.1.

paddy

<rice> rice retaining its husk after threshing

EXAMPLE 1

Foreign seeds, husks, bran, sand, dust.

EXAMPLE 2

[TERMREF] ISO 7301:2011, Clause 3.1 [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here [/TERMREF]

[TERMREF] Termbase IEV, term ID xyz [/TERMREF]

[TERMREF] Termbase IEV, term ID xyz [MODIFICATION] [/TERMREF]

[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]

1.2.

paddy

paddy rice

rough rice

DEPRECATED: cargo rice

rice retaining its husk after threshing

EXAMPLE

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.

[TERMREF] ISO 7301:2011, Clause 3.1 [/TERMREF]

INPUT

 


 


1.  Terms and Definitions

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

1.1.

paddy

<rice> rice retaining its husk after threshing

EXAMPLE 1

Foreign seeds, husks, bran, sand, dust.

  • A

EXAMPLE 2

  • A

[SOURCE: ISO 7301:2011, Clause 3.1 , modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here; Termbase IEV, term ID xyz; Termbase IEV, term ID xyz, modified; Termbase IEV, term ID xyz, modified — with adjustments]

1.2.

paddy

paddy rice

rough rice

DEPRECATED: cargo rice

rice retaining its husk after threshing

EXAMPLE

  • A

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:

  • A

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

[SOURCE: ISO 7301:2011, Clause 3.1 ]

OUTPUT end end