require "spec_helper" RSpec.describe IsoDoc do it "processes IsoXML terms" do input = <<~INPUT Terms and Definitions paddy rice

rice retaining its husk after threshing

Foreign seeds, husks, bran, sand, dust.

  • A
  • A
3.1

The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here

paddy paddy rice rough rice cargo rice

rice retaining its husk after threshing

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

  • A
  • A

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

3.1
term1 term1 definition term2 term2 definition
INPUT presxml = <<~OUTPUT 1<tab/>Terms and Definitions 1.1 paddy

<rice> rice retaining its husk after threshing

EXAMPLE 1

Foreign seeds, husks, bran, sand, dust.

  • A
EXAMPLE 2
  • A
[SOURCE: 3.1ISO 7301:2011, 3.1, modified – The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]
1.2 paddy paddy rice rough rice cargo rice

rice retaining its husk after threshing

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.

EXAMPLE
  • A
[SOURCE: 3.1ISO 7301:2011, 3.1]
1.3 term1 term1 definition 1.3.1 term2 term2 definition
OUTPUT html = <<~OUTPUT #{HTML_HDR}

1  Terms and Definitions

1.1

paddy

<rice> rice retaining its husk after threshing

EXAMPLE 1  Foreign seeds, husks, bran, sand, dust.

EXAMPLE 2 

[SOURCE: ISO 7301:2011, 3.1, modified – The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]

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.

[SOURCE: ISO 7301:2011, 3.1]

1.3

term1

term1 definition

1.3.1

term2

term2 definition
OUTPUT word = <<~OUTPUT

1  Terms and Definitions

1.1

paddy

<rice> rice retaining its husk after threshing

EXAMPLE 1  Foreign seeds, husks, bran, sand, dust.

EXAMPLE 2 

[SOURCE: ISO 7301:2011, 3.1, modified – The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]

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.

[SOURCE: ISO 7301:2011, 3.1]

1.3

term1

term1 definition

1.3.1

term2

term2 definition
OUTPUT expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}) .convert("test", input, true))) .to be_equivalent_to xmlpp(presxml) expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}) .convert("test", presxml, true))) .to be_equivalent_to xmlpp(html) expect(xmlpp(IsoDoc::Iso::WordConvert.new({}) .convert("test", presxml, true) .sub(%r{^.*

}m, "") .sub(%r{\s*