require "spec_helper" RSpec.describe IsoDoc do it "processes IsoXML tables" do input = <<~INPUT Repeatability and reproducibility of husked rice yield
Drago
A type of rice

This is a table about rice

Description Rice sample
Arborio Drago

Parboiled rice.

Balilla

Parboiled rice.

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
Annex Another table
?
INPUT presxml = <<~OUTPUT 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 Drago

Parboiled rice.

Balilla

Parboiled rice.

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
<strong>Annex A</strong> <br/> (informative) <br/> <br/> <strong>Annex</strong> Table A.1 — Another table
?
OUTPUT html = <<~OUTPUT

Foreword

Table 1 — Repeatability and reproducibility of husked rice yield

Drago

A type of rice
long desc
Description Rice sample
Arborio Drago a Balilla a 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.


Annex A
(informative)

Annex

Table A.1 — Another table

OUTPUT doc = <<~OUTPUT

Drago

A type of rice
Description Rice sample
Arborio Drago a Balilla a 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

OUTPUT doc2 = <<~OUTPUT


(informative)

Annex

Table A.1 — Another table

OUTPUT expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}) .convert("test", input, true))).to be_equivalent_to xmlpp(presxml) IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, false) expect(File.exist?("test.html")).to be true out = File.read("test.html") .sub(/^.*
.*$}m, "
") expect(xmlpp(out)).to be_equivalent_to xmlpp(html) IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, false) expect(File.exist?("test.doc")).to be true out = File.read("test.doc") .sub(/^.+?\s*

.*$}m, "") expect(xmlpp("

#{out}")).to be_equivalent_to xmlpp(doc) out = File.read("test.doc") .sub(/^.+?
\s*]+>\s*