From 551bf072f6e21ad4aa29f5c9f78ae0f28a759b39 Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Fri, 1 Dec 2023 00:00:51 +1100 Subject: [PATCH] rspec: https://github.com/metanorma/metanorma-jis/issues/125 --- spec/isodoc/ref_spec.rb | 206 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 200 insertions(+), 6 deletions(-) diff --git a/spec/isodoc/ref_spec.rb b/spec/isodoc/ref_spec.rb index ada92e30..791a9a94 100644 --- a/spec/isodoc/ref_spec.rb +++ b/spec/isodoc/ref_spec.rb @@ -137,7 +137,7 @@ en - Table of contents #{' '} + Table of contents

[110] @@ -563,7 +563,7 @@ en - Table of contents #{' '} + Table of contents

[110] @@ -880,7 +880,7 @@ en - Table of contents #{' '} + Table of contents

[110] @@ -1351,10 +1351,10 @@ International vocabulary of metrology Basic and general concepts and associated terms (VIM) International vocabulary of metrology — Basic and general concepts and associated terms (VIM) - https://www.iso.org/standard/45324.html https://www.iso.org/obp/ui/#!iso:std:45324:en https://www.iso.org/contents/data/standard/04/53/45324.detail.rss https://isotc.iso.org/livelink/livelink/Open/8389141#{' '} + https://www.iso.org/standard/45324.html https://www.iso.org/obp/ui/#!iso:std:45324:en https://www.iso.org/contents/data/standard/04/53/45324.detail.rss https://isotc.iso.org/livelink/livelink/Open/8389141 ISO/IEC Guide 99:2007 - [ISO/IEC Guide 99:2007

Also known as JCGM 200

]#{' '} - urn:iso:std:iso-iec:guide:99:ed-1#{' '} + [ISO/IEC Guide 99:2007

Also known as JCGM 200

]
+ urn:iso:std:iso-iec:guide:99:ed-1 99 2007-12 International Organization for Standardization ISO www.iso.org @@ -1405,4 +1405,198 @@ .convert("test", doc, true)))) .to be_equivalent_to xmlpp(html) end + + it "renders mixed bibitems and bibliographic subclauses" do + input = <<~INPUT + + + en + + + + Normative References +

Text

+ + + + Standard + + [A.

hello

]
+ XYZ +
+

More text

+
+ + Normative 1 + + + Standard + + [A.

hello

]
+ XYZ +
+
+
+ + Bibliography +

Text

+ + + + Standard + + [A.

hello

]
+ XYZ +
+

More text

+
+ + Bibliography 1 + + + Standard + + [A.

hello

]
+ XYZ +
+
+
+
+
+ INPUT + presxml = <<~PRESXML + + + en + + + + Table of contents + + + + + 1.<tab/>Normative References +

Text

+ + + + Standard + + [A.] + XYZ + A., XYZ

hello

,
+
+

More text

+
+ + 1.1.<tab/>Normative 1 + + + Standard + + [A.] + XYZ + A., XYZ

hello

,
+
+
+
+
+ + + Bibliography +

Text

+ + + + Standard + + [A.] + XYZ + A.XYZ

hello

,
+
+

More text

+
+ + Bibliography 1 + + + Standard + + [A.] + XYZ + A.XYZ

hello

,
+
+
+
+
+
+ PRESXML + html = <<~OUTPUT + + + +
+

 

+
+
+
+

 

+
+
+
+
+
+

Table of contents

+
+
+

1.  Normative References

+

Text

+
+

A., XYZ1, + Standard +

+

More text

+
+
+

1.1.  Normative 1

+

A., XYZ1, + Standard +

+
+
+
+
+

Bibliography

+

Text

+
+

A.  XYZ1, + Standard +

+

More text

+
+
+

Bibliography 1

+

A.  XYZ1, + Standard +

+
+
+ +
+ + + OUTPUT + doc = IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true) + xml = Nokogiri::XML(doc) + xml.at("//xmlns:localized-strings").remove + expect(strip_guid(xmlpp(xml.to_xml))) + .to be_equivalent_to xmlpp(presxml) + expect(strip_guid(xmlpp(IsoDoc::HtmlConvert.new({}) + .convert("test", doc, true)))) + .to be_equivalent_to xmlpp(html) + end end