spec/isodoc/iev_spec.rb in metanorma-iec-1.4.3 vs spec/isodoc/iev_spec.rb in metanorma-iec-1.4.4

- old
+ new

@@ -322,16 +322,14 @@ <name>EXAMPLE 2</name> <ul> <li>A</li> </ul> </termexample> - <termsource status="modified"> - <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin> - <modification> - <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p> - </modification> - </termsource></term> + <termsource status="modified">SOURCE: + <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>, modified &#x2013; + The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</termsource> + </term> <term id="paddy"> <name>192-01-02</name> <preferred><strong>paddy</strong></preferred><admitted>paddy rice</admitted> <admitted>rough rice</admitted> <deprecates>cargo rice</deprecates> @@ -349,11 +347,11 @@ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f"> <name>Note 2 to entry</name> <ul><li>A</li></ul> <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p> </termnote> - <termsource status="identical"> + <termsource status="identical">SOURCE: <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin> </termsource></term> </terms> </clause> </sections> @@ -365,88 +363,91 @@ <div id=''> <h1 class='ForewordTitle'>FOREWORD</h1> <div class='boilerplate_legal'/> </div> #{IEC_TITLE1} - <div id='_terms_and_definitions'> - <h1>1&#160; Terms and definitions</h1> - <br/> - <div id='_general'> - <p class='zzSTDTitle2'> - <b>192-01 General</b> - </p> - <p class='TermNum' id='paddy1'>192-01-01</p> - <p class='Terms' style='text-align:left;'><b>paddy</b></p> - <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p> - <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'> - <p> - <span class='example_label'>EXAMPLE 1</span> - &#160; Foreign seeds, husks, bran, sand, dust. - </p> - <ul> - <li>A</li> - </ul> - </div> - <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'> - <p> - <span class='example_label'>EXAMPLE 2</span> - &#160; - </p> - <ul> - <li>A</li> - </ul> - </div> - <p> - [TERMREF] - <a href='#ISO7301'>ISO 7301:2011, 3.1</a> - [MODIFICATION]The term "cargo rice" is shown as deprecated, and - Note 1 to entry is not included here [/TERMREF] - </p> - <p class='TermNum' id='paddy'>192-01-02</p> - <p class='Terms' style='text-align:left;'><b>paddy</b></p> - <p class='AltTerms' style='text-align:left;'>paddy rice</p> - <p class='AltTerms' style='text-align:left;'>rough rice</p> - <p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice</p> - <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>&lt;rice&gt; rice retaining its husk after threshing</p> - <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'> - <p> - <span class='example_label'>EXAMPLE</span> - &#160; - </p> - <ul> - <li>A</li> - </ul> - </div> - <div class='Note' id='_671a1994-4783-40d0-bc81-987d06ffb74e'> - <p> - Note 1 to entry: The starch of waxy rice consists almost entirely - of amylopectin. The kernels have a tendency to stick together - after cooking. - </p> - </div> - <div class='Note' id='_671a1994-4783-40d0-bc81-987d06ffb74f'> - <p> - Note 2 to entry: - <ul> - <li>A</li> - </ul> - <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'> - The starch of waxy rice consists almost entirely of amylopectin. - The kernels have a tendency to stick together after cooking. - </p> - </p> - </div> - <p> - [TERMREF] - <a href='#ISO7301'>ISO 7301:2011, 3.1</a> - [/TERMREF] - </p> - </div> - </div> - </div> - </body> - </html> + <div id='_terms_and_definitions'> + <h1>1&#160; Terms and definitions</h1> + <br/> + <div id='_general'> + <p class='zzSTDTitle2'> + <b>192-01 General</b> + </p> + <p class='TermNum' id='paddy1'>192-01-01</p> + <p class='Terms' style='text-align:left;'> + <b>paddy</b> + </p> + <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p> + <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'> + <p> + <span class='example_label'>EXAMPLE 1</span> + &#160; Foreign seeds, husks, bran, sand, dust. + </p> + <ul> + <li>A</li> + </ul> + </div> + <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'> + <p> + <span class='example_label'>EXAMPLE 2</span> + &#160; + </p> + <ul> + <li>A</li> + </ul> + </div> + <p> + SOURCE: + <a href='#ISO7301'>ISO 7301:2011, 3.1</a> + , modified &#8211; The term "cargo rice" is shown as deprecated, and + Note 1 to entry is not included here + </p> + <p class='TermNum' id='paddy'>192-01-02</p> + <p class='Terms' style='text-align:left;'> + <b>paddy</b> + </p> + <p class='AltTerms' style='text-align:left;'>paddy rice</p> + <p class='AltTerms' style='text-align:left;'>rough rice</p> + <p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice</p> + <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>&lt;rice&gt; rice retaining its husk after threshing</p> + <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'> + <p> + <span class='example_label'>EXAMPLE</span> + &#160; + </p> + <ul> + <li>A</li> + </ul> + </div> + <div id='_671a1994-4783-40d0-bc81-987d06ffb74e' class='Note'> + <p> + Note 1 to entry: The starch of waxy rice consists almost entirely + of amylopectin. The kernels have a tendency to stick together + after cooking. + </p> + </div> + <div id='_671a1994-4783-40d0-bc81-987d06ffb74f' class='Note'> + <p> + Note 2 to entry: + <ul> + <li>A</li> + </ul> + <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'> + The starch of waxy rice consists almost entirely of amylopectin. + The kernels have a tendency to stick together after cooking. + </p> + </p> + </div> + <p> + SOURCE: + <a href='#ISO7301'>ISO 7301:2011, 3.1</a> + </p> + </div> + </div> + </div> + </body> + </html> OUTPUT expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}) .convert("test", input, true) .sub(%r{<localized-strings>.*</localized-strings>}m, ""))) .to be_equivalent_to xmlpp(presxml) @@ -495,23 +496,16 @@ <name>192-01-01</name> <preferred><strong>paddy</strong></preferred> <definition> <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p> </definition> - <termsource status='modified'> - <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'> - <locality type='clause'> + <termsource status='modified'>SOURCE: + <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'><locality type='clause'> <referenceFrom>3.1</referenceFrom> - </locality> - ISO 7301:2011, 3.1 - </origin> - <modification> - <p id='_e73a417d-ad39-417d-a4c8-20e4e2529489'> + </locality>ISO 7301:2011, 3.1</origin>, modified &#x2013; The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here - </p> - </modification> </termsource> </term> </terms> </clause> </sections> @@ -556,11 +550,11 @@ rice retaining its husk after threshing </p> <p class='MsoNormal'> SOURCE: <a href='#ISO7301'>ISO 7301:2011, 3.1</a> - , modified &#x2014; The term "cargo rice" is shown as deprecated, and + , modified &#x2013; The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here </p> </div> </div> </div> @@ -620,11 +614,11 @@ <title depth='1'>1<tab/>Terms and definitions</title> <terms id='_general' obligation='normative'> <title>192-01 General</title> <term id='term-durability'> <name>192-01-01</name> - <preferred><strong>durability, &#x3c;of an item&#x3e;</strong></preferred> + <preferred><strong>durability</strong>, &#x3c;of an item&#x3e;</preferred> <definition> <verbaldefinition> <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p> </verbaldefinition> </definition> @@ -646,9 +640,239 @@ </term> </terms> </clause> </sections> </iso-standard> + PRESXML + expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}) + .convert("test", input, true) + .sub(%r{<localized-strings>.*</localized-strings>}m, ""))) + .to be_equivalent_to xmlpp(presxml) + end + + it "processes multilingual IEV terms" do + input = <<~INPUT + <iso-standard xmlns="http://riboseinc.com/isoxml"> + <bibdata type='standard'> + <docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier> + <docnumber>60050</docnumber> + </bibdata> + <sections> + <clause id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title> + <terms id="_general" obligation="normative"><title>General</title> + <term id="item" language="en" tag="item"> + <preferred><expression language="en"><name>system</name></expression><field-of-application>in dependability</field-of-application></preferred> + <preferred><expression language="ar"><name>نظام،</name></expression><field-of-application>في الاعتمادیة</field-of-application></preferred> + <preferred><expression language="de"><name>Betrachtungseinheit</name<grammar><gender>feminine</gender></grammar></expression></preferred> + <preferred><expression language="de"><name>Einheit</name><grammar><gender>feminine</gender></grammar></expression></preferred> + <preferred><expression language="ja"><name>アイテム</name></expression></preferred> + <admitted><expression><name>paddy rice</name></expression></admitted> + <admitted><expression><name>rough rice</name></expression></admitted> + <deprecates><expression><name>cargo rice</name></expression></deprecates> + <related type='contrast'><preferred><expression><name>Fifth Designation</name></expression></preferred><xref target="paddy1"/></related> + <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">set of interrelated items that collectively fulfil a requirement</p></verbal-definition></definition> + <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e"> + <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">A system is considered to have a defined real or abstract boundary.</p> + </termnote> + <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74d"> + <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">External resources (from outside the system boundary) may be required for the system to operate.</p> + </termnote> + <termexample id="_671a1994-4783-40d0-bc81-987d06ffb740"> + <p id="_19830f33-e46c-42cc-94ca-a5ef101132d0">External resources (from outside the system boundary) may be required for the system to operate.</p> + </termexample> + <termsource status="modified"> + <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin> + <modification>modified by extension to suit the dependability context</modification> + </termsource></term> + <term id="item-fr" language="fr" tag="item"> + <preferred><expression language="fr"><name>entité</name<grammar><gender>masculine</gender></grammar></expression> + <field-of-application>en sûreté de fonctionnement</field-of-application> + </preferred> + <related type='contrast'><preferred><expression><name>Designation cinquième</name></expression></preferred><xref target="paddy1"/></related> + <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747d">ensemble d’entités reliées entre elles qui satisfont collectivement à une exigence</p></verbal-definition></definition> + <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74c"> + <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">Un système est considéré comme ayant une frontière définie, réelle ou abstraite.</p> + </termnote> + <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74b"> + <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">Des ressources externes (provenant d’au-delà de la frontière) peuvent être nécessaires au fonctionnement du système.</p> + </termnote> + <termexample id="_671a1994-4783-40d0-bc81-987d06ffb741"> + <p id="_19830f33-e46c-42cc-94ca-a5ef101132d1">External resources (from outside the system boundary) may be required for the system to operate.</p> + </termexample> + <termsource status="modified"> + <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin> + <modification>modifié pour adapter au contexte de la sûreté de fonctionnement</modification> + </termsource></term> + <term id="paddy1"><preferred><expression><name>paddy</name></expression></preferred> + <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747d">rice retaining its husk after threshing</p></verbal-definition></definition> + </term> + </terms> + </clause> + </sections> + </iso-standard> + INPUT + + presxml = <<~PRESXML + <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'> + <bibdata type='standard'> + <docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier> + <docnumber>60050</docnumber> + </bibdata> + <sections> + <clause id='_terms_and_definitions' obligation='normative' displayorder='1'> + <title depth='1'> + 1 + <tab/> + Terms and definitions + </title> + <terms id='_general' obligation='normative'> + <title>192-01 General</title> + <term id='item' language='en,fr'> + <name>192-01-01</name> + <preferred> + <strong>system</strong> + , &#x3c;in dependability&#x3e; + </preferred> + <admitted>paddy rice</admitted> + <admitted>rough rice</admitted> + <deprecates>cargo rice</deprecates> + <p> + <strong>CONTRAST:</strong> + <em> + <preferred> + <strong>Fifth Designation</strong> + </preferred> + </em> + ( + <xref target='paddy1'>192-01-02</xref> + ) + </p> + <definition> + <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>set of interrelated items that collectively fulfil a requirement</p> + </definition> + <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74e'> + <name>Note 1 to entry</name> + <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>A system is considered to have a defined real or abstract boundary.</p> + </termnote> + <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74d'> + <name>Note 2 to entry</name> + <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'> + External resources (from outside the system boundary) may be + required for the system to operate. + </p> + </termnote> + <termexample id='_671a1994-4783-40d0-bc81-987d06ffb740'> + <name>EXAMPLE</name> + <p id='_19830f33-e46c-42cc-94ca-a5ef101132d0'> + External resources (from outside the system boundary) may be + required for the system to operate. + </p> + </termexample> + <termsource status='modified'>SOURCE: + <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'> + <locality type='clause'> + <referenceFrom>3.1</referenceFrom> + </locality> + ISO 7301:2011, 3.1 + </origin>, modified &#x2013; + modified by extension to suit the dependability context + </termsource> + <preferred> + <strong>entit&#xE9;</strong> + , &#x3c;en s&#xFB;ret&#xE9; de fonctionnement&#x3e;, m + </preferred> + <p> + <strong>CONTRASTEZ:</strong> + <em> + <preferred> + <strong>Designation cinqui&#xE8;me</strong> + </preferred> + </em> + ( + <xref target='paddy1'>192-01-02</xref> + ) + </p> + <definition> + <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747d'> + ensemble d&#x2019;entit&#xE9;s reli&#xE9;es entre elles qui + satisfont collectivement &#xE0; une exigence + </p> + </definition> + <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74c'> + <name>Note 1 &#xE0; l&#x2019;article</name> + <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'> + Un syst&#xE8;me est consid&#xE9;r&#xE9; comme ayant une + fronti&#xE8;re d&#xE9;finie, r&#xE9;elle ou abstraite. + </p> + </termnote> + <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74b'> + <name>Note 2 &#xE0; l&#x2019;article</name> + <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'> + Des ressources externes (provenant d&#x2019;au-del&#xE0; de la + fronti&#xE8;re) peuvent &#xEA;tre n&#xE9;cessaires au + fonctionnement du syst&#xE8;me. + </p> + </termnote> + <termexample id='_671a1994-4783-40d0-bc81-987d06ffb741'> + <name>EXEMPLE</name> + <p id='_19830f33-e46c-42cc-94ca-a5ef101132d1'> + External resources (from outside the system boundary) may be + required for the system to operate. + </p> + </termexample> + <termsource status='modified'>SOURCE: + <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'> + <locality type='clause'> + <referenceFrom>3.1</referenceFrom> + </locality> + ISO 7301:2011, 3.1 + </origin>, modifi&#xE9; &#x2013; + modifi&#xE9; pour adapter au contexte de la s&#xFB;ret&#xE9; de fonctionnement + </termsource> + <dl type='other-lang'> + <dt>ar</dt> + <dd language="ar" script="Arab"> + <preferred> + <strong>&#x61C;&#x646;&#x638;&#x627;&#x645;&#x60C;&#x61C;</strong> + &#x61C;, &#x3c;&#x641;&#x64A; + &#x627;&#x644;&#x627;&#x639;&#x62A;&#x645;&#x627;&#x62F;&#x6CC;&#x629;&#x3e;&#x61C; + </preferred> + </dd> + <dt>de</dt> + <dd language="de" script="Latn"> + <preferred> + <strong>Betrachtungseinheit</strong> + , f + </preferred> + </dd> + <dt>de</dt> + <dd language="de" script="Latn"> + <preferred> + <strong>Einheit</strong> + , f + </preferred> + </dd> + <dt>ja</dt> + <dd language="ja" script="Jpan"> + <preferred> + <strong>&#x30A2;&#x30A4;&#x30C6;&#x30E0;</strong> + </preferred> + </dd> + </dl> + </term> + <term id='paddy1'> + <name>192-01-02</name> + <preferred> + <strong>paddy</strong> + </preferred> + <definition> + <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747d'>rice retaining its husk after threshing</p> + </definition> + </term> + </terms> + </clause> + </sections> + </iso-standard> PRESXML expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}) .convert("test", input, true) .sub(%r{<localized-strings>.*</localized-strings>}m, ""))) .to be_equivalent_to xmlpp(presxml)