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

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

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

t1

with adjustments

paddypaddy rice rough rice cargo rice

rice retaining its husk after threshing

  • A

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

  • A

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

3.1 3.1
INPUT presxml = <<~"PRESXML" 1. <tab/> 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
3.1 ISO 7301:2011, Clause 3.1

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

t1

with adjustments

1.2. paddy paddy rice rough rice 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.

3.1 ISO 7301:2011, 3.1 3.1 ISO 7301:2011, clause 3.1
PRESXML html = <<~"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] t1 [/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, 3.1 ISO 7301:2011, clause 3.1 [/TERMREF]

OUTPUT word = <<~"WORD" #{WORD_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] t1 [/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, 3.1 ISO 7301:2011, clause 3.1 [/TERMREF]

WORD expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}) .convert("test", input, true))).to be_equivalent_to xmlpp(presxml) expect(xmlpp(IsoDoc::HtmlConvert.new({}) .convert("test", presxml, true))).to be_equivalent_to xmlpp(html) expect(xmlpp(IsoDoc::WordConvert.new({}) .convert("test", presxml, true))).to be_equivalent_to xmlpp(word) end it "processes IsoXML term with multiple definitions" do input = <<~"INPUT" Terms and Definitions

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

paddy rice

rice retaining its husk after threshing

rice retaining its husk after threshing, mark 2

3.1

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

Foreign seeds, husks, bran, sand, dust.

  • A
  • A
t1

with adjustments

INPUT presxml = <<~PRESXML 1. <tab/> Terms and Definitions

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

1.1. paddy rice
  1. rice retaining its husk after threshing

  2. rice retaining its husk after threshing, mark 2

    3.1 ISO 7301:2011, Clause 3.1

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

EXAMPLE 1

Foreign seeds, husks, bran, sand, dust.

  • A
EXAMPLE 2
  • A
t1

with adjustments

PRESXML expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}) .convert("test", input, true))).to be_equivalent_to xmlpp(presxml) end end