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 in agriculture dated 3.1

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

rice

rice retaining its husk after threshing

Foreign seeds, husks, bran, sand, dust.

  • A
  • A
t1

with adjustments

paddy paddy rice in agriculture 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, <in agriculture, dated>[SOURCE: 3.1 ISO 7301:2011, Clause 3.1, modified – The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here] rice

rice retaining its husk after threshing

EXAMPLE 1

Foreign seeds, husks, bran, sand, dust.

  • A
EXAMPLE 2
  • A
[SOURCE: t1 , modified ; , modified – with adjustments]
1.2.paddy paddy rice, <in agriculture> 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.

[SOURCE: 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, <in agriculture, dated>

[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]

<rice> rice retaining its husk after threshing

EXAMPLE 1

Foreign seeds, husks, bran, sand, dust.

EXAMPLE 2

[SOURCE: t1, modified ; Termbase IEV, term ID xyz, modified – with adjustments]

1.2.

paddy

paddy rice, <in agriculture>

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 ISO 7301:2011, clause 3.1]

OUTPUT word = <<~"WORD" #{WORD_HDR}

1.  Terms and Definitions

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

1.1.

paddy, <in agriculture, dated>

[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]

<rice> rice retaining its husk after threshing

EXAMPLE 1

Foreign seeds, husks, bran, sand, dust.

EXAMPLE 2

[SOURCE: t1, modified ; Termbase IEV, term ID xyz, modified – with adjustments]

1.2.

paddy

paddy rice, <in agriculture>

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 ISO 7301:2011, clause 3.1]

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

    [SOURCE: 3.1 ISO 7301:2011, Clause 3.1 , modified – 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
[SOURCE: t1 ; , modified – with adjustments]
PRESXML expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}) .convert("test", input, true))).to be_equivalent_to xmlpp(presxml) end it "processes IsoXML term with multiple preferred terms" do input = <<~"INPUT" Terms and Definitions paddy muddy rice rice

rice retaining its husk after threshing

paddy muddy rice rice

rice retaining its husk after threshing

paddy muddy rice rice

rice retaining its husk after threshing

paddy muddy rice rice

rice retaining its husk after threshing

INPUT presxml = <<~PRESXML 1. <tab/> Terms and Definitions 1.1. paddy; muddy rice rice

rice retaining its husk after threshing

1.2. paddy; muddy rice rice

rice retaining its husk after threshing

1.3. paddy, US muddy rice rice

rice retaining its husk after threshing

1.4. paddy, eng muddy rice, fra rice

rice retaining its husk after threshing

PRESXML expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}) .convert("test", input, true))).to be_equivalent_to xmlpp(presxml) end it "processes IsoXML term with grammatical information" do input = <<~"INPUT" Terms and Definitions paddy pædiː masculine feminine singular false true irregular declension muddy rice neuter true irregular declension rice

rice retaining its husk after threshing

INPUT presxml = <<~PRESXML 1. <tab/> Terms and Definitions 1.1. paddy, m, f, sg, noun, en Latn US, /pædiː/ muddy rice, n, noun rice

rice retaining its husk after threshing

PRESXML expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}) .convert("test", input, true))).to be_equivalent_to xmlpp(presxml) end it "processes IsoXML term with empty or graphical designations" do input = <<~"INPUT" Terms and Definitions
<LITERAL> FIGURATIVE
rice

rice retaining its husk after threshing

INPUT presxml = <<~PRESXML 1.<tab/>Terms and Definitions 1.1.
Figure 1
<LITERAL> FIGURATIVE
rice

rice retaining its husk after threshing

PRESXML expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}) .convert("test", input, true))).to be_equivalent_to xmlpp(presxml) end it "processes IsoXML term with nonverbal definitions" do input = <<~"INPUT" Terms and definitions

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

Term

Definition

1
A B
C D
2
Term 2
Literal
x = y 3
INPUT presxml = <<~PRESXML 1. <tab/> Terms and definitions

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

1.1. Term

Definition

[SOURCE: 1 , Section 1 ] Table 1
A B
C D
[SOURCE: 2 , Section 2 ]
1.2. Term 2
Figure 1
Literal
1 x = y [SOURCE: 3 , Section 3 ]
PRESXML expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}) .convert("test", input, true))).to be_equivalent_to xmlpp(presxml) end end