metanorma-iso 1.7.2 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +11 -41
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +7 -1
  5. data/lib/asciidoctor/iso/base.rb +14 -11
  6. data/lib/asciidoctor/iso/biblio.rng +4 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +40 -24
  8. data/lib/asciidoctor/iso/front.rb +29 -17
  9. data/lib/asciidoctor/iso/front_id.rb +81 -60
  10. data/lib/asciidoctor/iso/isodoc.rng +327 -2
  11. data/lib/asciidoctor/iso/isostandard.rng +12 -97
  12. data/lib/asciidoctor/iso/section.rb +2 -1
  13. data/lib/asciidoctor/iso/validate.rb +22 -109
  14. data/lib/asciidoctor/iso/validate_image.rb +97 -0
  15. data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
  16. data/lib/asciidoctor/iso/validate_section.rb +39 -20
  17. data/lib/asciidoctor/iso/validate_style.rb +36 -24
  18. data/lib/asciidoctor/iso/validate_title.rb +23 -17
  19. data/lib/isodoc/iso/base_convert.rb +19 -2
  20. data/lib/isodoc/iso/html/style-human.css +7 -0
  21. data/lib/isodoc/iso/html/style-iso.css +7 -0
  22. data/lib/isodoc/iso/html_convert.rb +0 -1
  23. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  24. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  25. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  26. data/lib/isodoc/iso/index.rb +140 -0
  27. data/lib/isodoc/iso/iso.amendment.xsl +1157 -208
  28. data/lib/isodoc/iso/iso.international-standard.xsl +1157 -208
  29. data/lib/isodoc/iso/metadata.rb +1 -0
  30. data/lib/isodoc/iso/presentation_xml_convert.rb +45 -37
  31. data/lib/isodoc/iso/sts_convert.rb +10 -13
  32. data/lib/isodoc/iso/word_convert.rb +0 -1
  33. data/lib/isodoc/iso/xref.rb +46 -25
  34. data/lib/metanorma/iso/processor.rb +1 -0
  35. data/lib/metanorma/iso/version.rb +1 -1
  36. data/metanorma-iso.gemspec +8 -8
  37. data/spec/{asciidoctor-iso → asciidoctor}/amd_spec.rb +5 -5
  38. data/spec/asciidoctor/base_spec.rb +825 -0
  39. data/spec/{asciidoctor-iso → asciidoctor}/blocks_spec.rb +0 -0
  40. data/spec/{asciidoctor-iso → asciidoctor}/cleanup_spec.rb +383 -25
  41. data/spec/{asciidoctor-iso → asciidoctor}/inline_spec.rb +0 -0
  42. data/spec/{asciidoctor-iso → asciidoctor}/lists_spec.rb +0 -0
  43. data/spec/{asciidoctor-iso → asciidoctor}/refs_spec.rb +0 -0
  44. data/spec/{asciidoctor-iso → asciidoctor}/section_spec.rb +0 -14
  45. data/spec/{asciidoctor-iso → asciidoctor}/table_spec.rb +0 -0
  46. data/spec/{asciidoctor-iso → asciidoctor}/validate_spec.rb +188 -83
  47. data/spec/isodoc/postproc_spec.rb +481 -438
  48. data/spec/isodoc/section_spec.rb +219 -0
  49. data/spec/spec_helper.rb +2 -0
  50. metadata +65 -64
  51. data/lib/isodoc/iso/html/scripts.html +0 -178
  52. data/spec/asciidoctor-iso/base_spec.rb +0 -704
@@ -1,178 +0,0 @@
1
- <script>
2
- $("#toc").on('click', 'li', function(e) {
3
- $(this).parent().find('li.toc-active').removeClass('toc-active');
4
- $(this).addClass('toc-active');
5
- });
6
- </script>
7
-
8
- <script>
9
- //TOC toggle animation
10
- $('#toggle').on('click', function(){
11
- if( $('nav').is(':visible') ) {
12
- $('nav').animate({ 'left': '-353px' }, 'slow', function(){
13
- $('nav').hide();
14
- });
15
- $('body').animate({ 'margin-left': '0' }, 'slow');
16
- }
17
- else {
18
- $('nav').show();
19
- $('nav').animate({ 'left': '0px' }, 'slow');
20
- $('body').animate({ 'margin-left': '298px' }, 'slow');
21
- }
22
- });
23
- </script>
24
-
25
- <script>
26
- // Scroll to top button
27
- window.onscroll = function() {scrollFunction()};
28
-
29
- function scrollFunction() {
30
- if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
31
- document.getElementById("myBtn").style.display = "block";
32
- } else {
33
- document.getElementById("myBtn").style.display = "none";
34
- }
35
- }
36
-
37
- // When the user clicks on the button, scroll to the top of the document
38
- function topFunction() {
39
- document.body.scrollTop = 0;
40
- document.documentElement.scrollTop = 0;
41
- }
42
- </script>
43
-
44
- <script>
45
- /*
46
- $(document).ready(function() {
47
- $('[id^=toc]').each(function ()
48
- {
49
- var currentToc = $(this);
50
- var url = window.location.href;
51
- currentToc.wrap("<a href='" + url + "#" + currentToc.attr("id") + "'></a>");
52
- });
53
- });
54
- */
55
- </script>
56
-
57
-
58
- <script>
59
-
60
- // jQuery Inline Footnotes v1.0.3
61
- // Copyright (c) 2011 Vesa Vänskä, released under the MIT License.
62
-
63
- // Generated by CoffeeScript 1.6.1
64
- (function() {
65
-
66
- (function($) {
67
- $.inlineFootnote = function(el, options) {
68
- var _this = this;
69
- this.el = $(el);
70
- this.el.data("inlineFootnote", this);
71
- this.initialize = function() {
72
- this.options = $.extend({}, $.inlineFootnote.defaultOptions, options);
73
- this.footnoteId = this.el.attr("href").match(/#(.*)/)[1];
74
- if (this.footnoteId) {
75
- this.el.mouseenter(this.openBox);
76
- return $("body").mousemove(this.closeBox);
77
- }
78
- };
79
- this.openBox = function(event) {
80
- var footnoteContent, linkOffset;
81
- if (!_this.box) {
82
- footnoteContent = $("[id='" + _this.footnoteId + "']").children().filter(":not('" + _this.options.hideFromContent + "')");
83
- linkOffset = _this.el.offset();
84
- _this.box = $("<div />", {
85
- id: _this.options.boxId,
86
- html: footnoteContent.clone().find(_this.options.hideFromContent).remove().end(),
87
- css: {
88
- position: "absolute",
89
- top: linkOffset.top,
90
- left: linkOffset.left + _this.el.outerWidth()
91
- }
92
- }).appendTo("body");
93
- return _this.positionBox();
94
- }
95
- };
96
- this.closeBox = function(event) {
97
- if (_this.box) {
98
- if (_this.isHoveringFootnote(event)) {
99
- clearTimeout(_this.closeTimeout);
100
- return _this.closeTimeout = null;
101
- } else {
102
- if (!_this.closeTimeout) {
103
- return _this.closeTimeout = setTimeout((function() {
104
- _this.box.remove();
105
- return _this.box = null;
106
- }), _this.options.hideDelay);
107
- }
108
- }
109
- }
110
- };
111
- this.isHoveringFootnote = function(event) {
112
- return this.box.is(event.target) || $(event.target).closest(this.box).length > 0 || event.target === this.el[0];
113
- };
114
- this.positionBox = function() {
115
- var boxHorizontalPadding, boxLeft, boxWidth, linkLeftOffset, windowWidth;
116
- boxHorizontalPadding = parseInt(this.box.css("padding-left")) + parseInt(this.box.css("padding-right"));
117
- linkLeftOffset = this.el.offset().left;
118
- windowWidth = $(window).width();
119
- if ((windowWidth / 2) > linkLeftOffset) {
120
- boxLeft = linkLeftOffset + 20;
121
- boxWidth = windowWidth - boxLeft - boxHorizontalPadding - this.options.boxMargin * 2;
122
- if (boxWidth > this.options.maximumBoxWidth) {
123
- boxWidth = this.options.maximumBoxWidth;
124
- }
125
- } else {
126
- boxWidth = linkLeftOffset - boxHorizontalPadding - this.options.boxMargin * 2;
127
- if (boxWidth > this.options.maximumBoxWidth) {
128
- boxWidth = this.options.maximumBoxWidth;
129
- }
130
- boxLeft = linkLeftOffset - boxWidth - this.options.boxMargin * 2;
131
- }
132
- return this.box.css({
133
- width: boxWidth,
134
- left: boxLeft
135
- });
136
- };
137
- return this.initialize();
138
- };
139
- $.inlineFootnote.defaultOptions = {
140
- boxMargin: 20,
141
- hideDelay: 200,
142
- hideFromContent: "[rel=footnote]",
143
- maximumBoxWidth: 500,
144
- boxId: "footnote_box"
145
- };
146
- return $.fn.inlineFootnote = function(options) {
147
- return this.each(function() {
148
- return new $.inlineFootnote(this, options);
149
- });
150
- };
151
- })(jQuery);
152
-
153
- }).call(this);
154
- </script>
155
-
156
- <script>
157
- $(function() {
158
- $("[rel=footnote]").inlineFootnote();
159
- });
160
- </script>
161
- <script>
162
- // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
163
- //
164
- // AnchorJS - v4.2.2 - 2020-04-20
165
- // https://www.bryanbraun.com/anchorjs/
166
- // Copyright (c) 2020 Bryan Braun; Licensed MIT
167
- //
168
- // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
169
- !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function f(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.base=A.hasOwnProperty("base")?A.base:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64,A.titleText=A.hasOwnProperty("titleText")?A.titleText:""}function p(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],f(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var e,t,i,n,o,s,a,r,c,h,l,u,d=[];if(f(this.options),"touch"===(l=this.options.visible)&&(l=this.isTouchDevice()?"always":"hover"),0===(e=p(A=A||"h2, h3, h4, h5, h6")).length)return this;for(!function(){if(null!==document.head.querySelector("style.anchorjs"))return;var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(e):document.head.insertBefore(e,A);e.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",e.sheet.cssRules.length),e.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",e.sheet.cssRules.length),e.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",e.sheet.cssRules.length),e.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',e.sheet.cssRules.length)}(),t=document.querySelectorAll("[id]"),i=[].map.call(t,function(A){return A.id}),o=0;o<e.length;o++)if(this.hasAnchorJSLink(e[o]))d.push(o);else{if(e[o].hasAttribute("id"))n=e[o].getAttribute("id");else if(e[o].hasAttribute("data-anchor-id"))n=e[o].getAttribute("data-anchor-id");else{for(c=r=this.urlify(e[o].textContent),a=0;void 0!==s&&(c=r+"-"+a),a+=1,-1!==(s=i.indexOf(c)););s=void 0,i.push(c),e[o].setAttribute("id",c),n=c}(h=document.createElement("a")).className="anchorjs-link "+this.options.class,h.setAttribute("aria-label",this.options.ariaLabel),h.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(h.title=this.options.titleText),u=document.querySelector("base")?window.location.pathname+window.location.search:"",u=this.options.base||u,h.href=u+"#"+n,"always"===l&&(h.style.opacity="1"),""===this.options.icon&&(h.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(h.style.lineHeight="inherit")),"left"===this.options.placement?(h.style.position="absolute",h.style.marginLeft="-1em",h.style.paddingRight="0.5em",e[o].insertBefore(h,e[o].firstChild)):(h.style.paddingLeft="0.375em",e[o].appendChild(h))}for(o=0;o<d.length;o++)e.splice(d[o]-o,1);return this.elements=this.elements.concat(e),this},this.remove=function(A){for(var e,t,i=p(A),n=0;n<i.length;n++)(t=i[n].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(i[n]))&&this.elements.splice(e,1),i[n].removeChild(t));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){return this.options.truncate||f(this.options),A.trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),t=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||t||!1}}});
170
- // @license-end
171
- </script>
172
- <script>
173
- anchors.options = {
174
- placement: 'left'
175
- };
176
- anchors.add('h1, h2, h3, h4');
177
- </script>
178
-
@@ -1,704 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Asciidoctor::ISO do
4
- it "has a version number" do
5
- expect(Metanorma::ISO::VERSION).not_to be nil
6
- end
7
-
8
- it "processes a blank document" do
9
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", *OPTIONS))).to be_equivalent_to xmlpp(<<~"OUTPUT")
10
- #{ASCIIDOC_BLANK_HDR}
11
- INPUT
12
- #{BLANK_HDR}
13
- <sections/>
14
- </iso-standard>
15
- OUTPUT
16
- end
17
-
18
- it "converts a blank document" do
19
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", *OPTIONS))).to be_equivalent_to xmlpp(<<~"OUTPUT")
20
- = Document title
21
- Author
22
- :docfile: test.adoc
23
- :novalid:
24
- :no-isobib:
25
- INPUT
26
- #{BLANK_HDR}
27
- <sections/>
28
- </iso-standard>
29
- OUTPUT
30
- expect(File.exist?("test_alt.html")).to be true
31
- expect(File.exist?("test.html")).to be true
32
- expect(File.exist?("test.doc")).to be true
33
- expect(File.exist?("test.pdf")).to be true
34
- expect(File.exist?("htmlstyle.css")).to be false
35
- end
36
-
37
- it "converts a blank document in French" do
38
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", *OPTIONS))).to be_equivalent_to xmlpp(<<~"OUTPUT")
39
- = Document title
40
- Author
41
- :docfile: test.adoc
42
- :novalid:
43
- :no-isobib:
44
- :no-pdf:
45
- :language: fr
46
- INPUT
47
- #{BLANK_HDR_FR}
48
- <sections/>
49
- </iso-standard>
50
- OUTPUT
51
- end
52
-
53
- it "processes default metadata" do
54
- output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
55
- = Document title
56
- Author
57
- :docfile: test.adoc
58
- :nodoc:
59
- :novalid:
60
- :no-isobib:
61
- :docnumber: 1000
62
- :partnumber: 1
63
- :edition: 2
64
- :revdate: 2000-01-01
65
- :draft: 0.3.4
66
- :technical-committee: TC
67
- :technical-committee-number: 1
68
- :technical-committee-type: A
69
- :subcommittee: SC
70
- :subcommittee-number: 2
71
- :subcommittee-type: B
72
- :workgroup: WG
73
- :workgroup-number: 3
74
- :workgroup-type: C
75
- :technical-committee_2: TC1
76
- :technical-committee-number_2: 11
77
- :technical-committee-type_2: A1
78
- :subcommittee_2: SC1
79
- :subcommittee-number_2: 21
80
- :subcommittee-type_2: B1
81
- :workgroup_2: WG1
82
- :workgroup-number_2: 31
83
- :workgroup-type_2: C1
84
- :secretariat: SECRETARIAT
85
- :docstage: 20
86
- :docsubstage: 20
87
- :iteration: 3
88
- :language: en
89
- :title-intro-en: Introduction
90
- :title-main-en: Main Title -- Title
91
- :title-part-en: Title Part
92
- :title-intro-fr: Introduction Française
93
- :title-main-fr: Titre Principal
94
- :title-part-fr: Part du Titre
95
- :library-ics: 1,2,3
96
- :copyright-year: 2000
97
- :horizontal: true
98
- INPUT
99
- expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
100
- <?xml version="1.0" encoding="UTF-8"?>
101
- <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
102
- <bibdata type="standard">
103
- <title format="text/plain" language="en" type="main">Introduction — Main Title — Title — Title Part</title>
104
- <title format="text/plain" language="en" type="title-intro">Introduction</title>
105
- <title format="text/plain" language="en" type="title-main">Main Title — Title</title>
106
- <title format="text/plain" language="en" type="title-part">Title Part</title>
107
- <title format="text/plain" language="fr" type="main">Introduction Française — Titre Principal — Part du Titre</title>
108
- <title format="text/plain" language="fr" type="title-intro">Introduction Française</title>
109
- <title format="text/plain" language="fr" type="title-main">Titre Principal</title>
110
- <title format="text/plain" language="fr" type="title-part">Part du Titre</title>
111
- <docidentifier type="ISO">ISO/PreWD3 1000-1</docidentifier>
112
- <docidentifier type="iso-with-lang">ISO/PreWD3 1000-1(E)</docidentifier>
113
- <docidentifier type="iso-reference">ISO/PreWD3 1000-1:2000(E)</docidentifier>
114
- <docnumber>1000</docnumber>
115
- <contributor>
116
- <role type="author"/>
117
- <organization>
118
- <name>International Organization for Standardization</name>
119
- <abbreviation>ISO</abbreviation>
120
- </organization>
121
- </contributor>
122
- <contributor>
123
- <role type="publisher"/>
124
- <organization>
125
- <name>International Organization for Standardization</name>
126
- <abbreviation>ISO</abbreviation>
127
- </organization>
128
- </contributor>
129
- <edition>2</edition>
130
- <version>
131
- <revision-date>2000-01-01</revision-date>
132
- <draft>0.3.4</draft>
133
- </version>
134
- <language>en</language>
135
- <script>Latn</script>
136
- <status>
137
- <stage abbreviation="WD">20</stage>
138
- <substage>20</substage>
139
- <iteration>3</iteration>
140
- </status>
141
- <copyright>
142
- <from>2000</from>
143
- <owner>
144
- <organization>
145
- <name>International Organization for Standardization</name>
146
- <abbreviation>ISO</abbreviation>
147
- </organization>
148
- </owner>
149
- </copyright>
150
- <ext>
151
- <doctype>article</doctype>
152
- <horizontal>true</horizontal>
153
- <editorialgroup>
154
- <technical-committee number="1" type="A">TC</technical-committee>
155
- <technical-committee number="11" type="A1">TC1</technical-committee>
156
- <subcommittee number="2" type="B">SC</subcommittee>
157
- <subcommittee number="21" type="B1">SC1</subcommittee>
158
- <workgroup number="3" type="C">WG</workgroup>
159
- <workgroup number="31" type="C1">WG1</workgroup>
160
- <secretariat>SECRETARIAT</secretariat>
161
- </editorialgroup>
162
- <ics>
163
- <code>1</code>
164
- </ics>
165
- <ics>
166
- <code>2</code>
167
- </ics>
168
- <ics>
169
- <code>3</code>
170
- </ics>
171
- <structuredidentifier>
172
- <project-number part="1">ISO 1000</project-number>
173
- </structuredidentifier>
174
- <stagename>Third working draft</stagename>
175
- </ext>
176
- </bibdata>
177
- <sections/>
178
- </iso-standard>
179
- OUTPUT
180
- end
181
-
182
- it "processes complex metadata" do
183
- output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
184
- = Document title
185
- Author
186
- :docfile: test.adoc
187
- :nodoc:
188
- :novalid:
189
- :no-isobib:
190
- :docnumber: 1000
191
- :partnumber: 1-1
192
- :tc-docnumber: 2000, 2003
193
- :language: el
194
- :script: Grek
195
- :publisher: IEC;IETF;ISO
196
- :copyright-holder: ISO;IETF
197
- :copyright-year: 2001
198
- :doctype: technical-report
199
- :pub-address: 1 Infinity Loop + \
200
- California
201
- :pub-phone: 3333333
202
- :pub-fax: 4444444
203
- :pub-email: x@example.com
204
- :pub-uri: http://www.example.com
205
- INPUT
206
- expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
207
- <?xml version="1.0" encoding="UTF-8"?>
208
- <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
209
- <bibdata type="standard">
210
- <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
211
- <docidentifier type="iso-with-lang">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
212
- <docidentifier type="iso-reference">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
213
- <docidentifier type="iso-tc">2000</docidentifier>
214
- <docidentifier type="iso-tc">2003</docidentifier>
215
- <docnumber>1000</docnumber>
216
- <contributor>
217
- <role type="author"/>
218
- <organization>
219
- <name>International Electrotechnical Commission</name>
220
- <abbreviation>IEC</abbreviation>
221
- </organization>
222
- </contributor>
223
- <contributor>
224
- <role type="author"/>
225
- <organization>
226
- <name>IETF</name>
227
- </organization>
228
- </contributor>
229
- <contributor>
230
- <role type="author"/>
231
- <organization>
232
- <name>International Organization for Standardization</name>
233
- <abbreviation>ISO</abbreviation>
234
- </organization>
235
- </contributor>
236
- <contributor>
237
- <role type="publisher"/>
238
- <organization>
239
- <name>International Electrotechnical Commission</name>
240
- <abbreviation>IEC</abbreviation>
241
- </organization>
242
- </contributor>
243
- <contributor>
244
- <role type="publisher"/>
245
- <organization>
246
- <name>IETF</name>
247
- </organization>
248
- </contributor>
249
- <contributor>
250
- <role type="publisher"/>
251
- <organization>
252
- <name>International Organization for Standardization</name>
253
- <abbreviation>ISO</abbreviation>
254
- </organization>
255
- </contributor>
256
- <language>el</language>
257
- <script>Grek</script>
258
- <status>
259
- <stage abbreviation="IS">60</stage>
260
- <substage>60</substage>
261
- </status>
262
- <copyright>
263
- <from>2001</from>
264
- <owner>
265
- <organization>
266
- <name>International Organization for Standardization</name>
267
- <abbreviation>ISO</abbreviation>
268
- </organization>
269
- </owner>
270
- </copyright>
271
- <copyright>
272
- <from>2001</from>
273
- <owner>
274
- <organization>
275
- <name>IETF</name>
276
- </organization>
277
- </owner>
278
- </copyright>
279
- <ext>
280
- <doctype>technical-report</doctype>
281
- <editorialgroup>
282
- <technical-committee/>
283
- <subcommittee/>
284
- <workgroup/>
285
- </editorialgroup>
286
- <structuredidentifier>
287
- <project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
288
- </structuredidentifier>
289
- <stagename>International standard</stagename>
290
- </ext>
291
- </bibdata>
292
- <sections/>
293
- </iso-standard>
294
- OUTPUT
295
- end
296
-
297
- it "processes subdivisions" do
298
- output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
299
- = Document title
300
- Author
301
- :docfile: test.adoc
302
- :nodoc:
303
- :novalid:
304
- :revdate: 2000-01
305
- :published-date: 1000-01
306
- :docnumber: 1000
307
- :partnumber: 1-1
308
- :tc-docnumber: 2000
309
- :language: el
310
- :script: Grek
311
- :subdivision: Subdivision
312
- :subdivision-abbr: SD
313
- :doctype: This is a DocType
314
- :pub-address: 1 Infinity Loop + \\
315
- California
316
- :pub-phone: 3333333
317
- :pub-fax: 4444444
318
- :pub-email: x@example.com
319
- :pub-uri: http://www.example.com
320
- INPUT
321
- expect(xmlpp(strip_guid(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))))
322
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
323
- <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
324
- <bibdata type='standard'>
325
- <docidentifier type='ISO'>SD 1000-1-1</docidentifier>
326
- <docidentifier type='iso-with-lang'>SD 1000-1-1(X)</docidentifier>
327
- <docidentifier type='iso-reference'>SD 1000-1-1(X)</docidentifier>
328
- <docidentifier type='iso-tc'>2000</docidentifier>
329
- <docnumber>1000</docnumber>
330
- <date type='published'>
331
- <on>1000-01</on>
332
- </date>
333
- <contributor>
334
- <role type='author'/>
335
- <organization>
336
- <name>International Organization for Standardization</name>
337
- <subdivision>Subdivision</subdivision>
338
- <abbreviation>SD</abbreviation>
339
- <address>
340
- <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
341
- </address>
342
- <phone>3333333</phone>
343
- <phone type='fax'>4444444</phone>
344
- <email>x@example.com</email>
345
- <uri>http://www.example.com</uri>
346
- </organization>
347
- </contributor>
348
- <contributor>
349
- <role type='publisher'/>
350
- <organization>
351
- <name>International Organization for Standardization</name>
352
- <subdivision>Subdivision</subdivision>
353
- <abbreviation>SD</abbreviation>
354
- <address>
355
- <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
356
- </address>
357
- <phone>3333333</phone>
358
- <phone type='fax'>4444444</phone>
359
- <email>x@example.com</email>
360
- <uri>http://www.example.com</uri>
361
- </organization>
362
- </contributor>
363
- <version>
364
- <revision-date>2000-01</revision-date>
365
- </version>
366
- <language>el</language>
367
- <script>Grek</script>
368
- <status>
369
- <stage abbreviation='IS'>60</stage>
370
- <substage>60</substage>
371
- </status>
372
- <copyright>
373
- <from>#{Time.now.year}</from>
374
- <owner>
375
- <organization>
376
- <name>International Organization for Standardization</name>
377
- <subdivision>Subdivision</subdivision>
378
- <abbreviation>SD</abbreviation>
379
- <address>
380
- <formattedAddress>1 Infinity Loop
381
- <br/>
382
- California</formattedAddress>
383
- </address>
384
- <phone>3333333</phone>
385
- <phone type="fax">4444444</phone>
386
- <email>x@example.com</email>
387
- <uri>http://www.example.com</uri>
388
- </organization>
389
- </owner>
390
- </copyright>
391
- <ext>
392
- <doctype>this-is-a-doctype</doctype>
393
- <editorialgroup>
394
- <technical-committee/>
395
- <subcommittee/>
396
- <workgroup/>
397
- </editorialgroup>
398
- <structuredidentifier>
399
- <project-number part="1" subpart="1">SD 1000</project-number>
400
- </structuredidentifier>
401
- <stagename>International standard</stagename>
402
- </ext>
403
- </bibdata>
404
- <sections> </sections>
405
- </iso-standard>
406
- OUTPUT
407
- end
408
-
409
- it "defaults substage, defines iteration on stage 50, gives stage 50 on technical specification" do
410
- output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
411
- = Document title
412
- Author
413
- :docfile: test.adoc
414
- :nodoc:
415
- :novalid:
416
- :no-isobib:
417
- :docnumber: 1000
418
- :docstage: 50
419
- :language: fr
420
- :doctype: technical-specification
421
- :iteration: 2
422
- INPUT
423
- expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
424
- <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
425
- <bibdata type="standard">
426
- <docidentifier type="ISO">ISO/DTS 1000.2</docidentifier>
427
- <docidentifier type="iso-with-lang">ISO/DTS 1000.2(F)</docidentifier>
428
- <docidentifier type="iso-reference">ISO/DTS 1000.2(F)</docidentifier>
429
- <docnumber>1000</docnumber>
430
- <contributor>
431
- <role type="author"/>
432
- <organization>
433
- <name>International Organization for Standardization</name>
434
- <abbreviation>ISO</abbreviation>
435
- </organization>
436
- </contributor>
437
- <contributor>
438
- <role type="publisher"/>
439
- <organization>
440
- <name>International Organization for Standardization</name>
441
- <abbreviation>ISO</abbreviation>
442
- </organization>
443
- </contributor>
444
- <language>fr</language>
445
- <script>Latn</script>
446
- <status>
447
- <stage abbreviation="D">50</stage>
448
- <substage>00</substage>
449
- <iteration>2</iteration>
450
- </status>
451
- <copyright>
452
- <from>#{Date.today.year}</from>
453
- <owner>
454
- <organization>
455
- <name>International Organization for Standardization</name>
456
- <abbreviation>ISO</abbreviation>
457
- </organization>
458
- </owner>
459
- </copyright>
460
- <ext>
461
- <doctype>technical-specification</doctype>
462
- <editorialgroup>
463
- <technical-committee/>
464
- <subcommittee/>
465
- <workgroup/>
466
- </editorialgroup>
467
- <structuredidentifier>
468
- <project-number>ISO 1000</project-number>
469
- </structuredidentifier>
470
- <stagename>Final draft</stagename>
471
- </ext>
472
- </bibdata>
473
- <sections/>
474
- </iso-standard>
475
- OUTPUT
476
- end
477
-
478
- it "defaults substage for stage 60" do
479
- output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
480
- = Document title
481
- Author
482
- :docfile: test.adoc
483
- :nodoc:
484
- :novalid:
485
- :no-isobib:
486
- :docnumber: 1000
487
- :docstage: 60
488
- INPUT
489
-
490
- expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
491
- <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
492
- <bibdata type="standard">
493
- <docidentifier type="ISO">ISO 1000</docidentifier>
494
- <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
495
- <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
496
- <docnumber>1000</docnumber>
497
- <contributor>
498
- <role type="author"/>
499
- <organization>
500
- <name>International Organization for Standardization</name>
501
- <abbreviation>ISO</abbreviation>
502
- </organization>
503
- </contributor>
504
- <contributor>
505
- <role type="publisher"/>
506
- <organization>
507
- <name>International Organization for Standardization</name>
508
- <abbreviation>ISO</abbreviation>
509
- </organization>
510
- </contributor>
511
-
512
- <language>en</language>
513
- <script>Latn</script>
514
- <status>
515
- <stage abbreviation="IS">60</stage>
516
- <substage>60</substage>
517
- </status>
518
- <copyright>
519
- <from>#{Date.today.year}</from>
520
- <owner>
521
- <organization>
522
- <name>International Organization for Standardization</name>
523
- <abbreviation>ISO</abbreviation>
524
- </organization>
525
- </owner>
526
- </copyright>
527
- <ext>
528
- <doctype>article</doctype>
529
- <editorialgroup>
530
- <technical-committee/>
531
- <subcommittee/>
532
- <workgroup/>
533
- </editorialgroup>
534
- <structuredidentifier>
535
- <project-number>ISO 1000</project-number>
536
- </structuredidentifier>
537
- <stagename>International standard</stagename>
538
- </ext>
539
- </bibdata>
540
- <sections/>
541
- </iso-standard>
542
- OUTPUT
543
- end
544
-
545
- it "populates metadata for PRF" do
546
- output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
547
- = Document title
548
- Author
549
- :docfile: test.adoc
550
- :nodoc:
551
- :novalid:
552
- :no-isobib:
553
- :docnumber: 1000
554
- :docstage: 60
555
- :docsubstage: 00
556
- INPUT
557
- expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
558
- <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
559
- <bibdata type="standard">
560
- <docidentifier type="ISO">ISO 1000</docidentifier>
561
- <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
562
- <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
563
- <docnumber>1000</docnumber>
564
- <contributor>
565
- <role type="author"/>
566
- <organization>
567
- <name>International Organization for Standardization</name>
568
- <abbreviation>ISO</abbreviation>
569
- </organization>
570
- </contributor>
571
- <contributor>
572
- <role type="publisher"/>
573
- <organization>
574
- <name>International Organization for Standardization</name>
575
- <abbreviation>ISO</abbreviation>
576
- </organization>
577
- </contributor>
578
-
579
- <language>en</language>
580
- <script>Latn</script>
581
- <status>
582
- <stage abbreviation="PRF">60</stage>
583
- <substage>00</substage>
584
- </status>
585
- <copyright>
586
- <from>#{Date.today.year}</from>
587
- <owner>
588
- <organization>
589
- <name>International Organization for Standardization</name>
590
- <abbreviation>ISO</abbreviation>
591
- </organization>
592
- </owner>
593
- </copyright>
594
- <ext>
595
- <doctype>article</doctype>
596
- <editorialgroup>
597
- <technical-committee/>
598
- <subcommittee/>
599
- <workgroup/>
600
- </editorialgroup>
601
- <structuredidentifier>
602
- <project-number>ISO 1000</project-number>
603
- </structuredidentifier>
604
- <stagename>Proof</stagename>
605
- </ext>
606
- </bibdata>
607
- <sections/>
608
- </iso-standard>
609
- OUTPUT
610
- end
611
-
612
- it "reads scripts into blank HTML document" do
613
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
614
- = Document title
615
- Author
616
- :docfile: test.adoc
617
- :novalid:
618
- :no-isobib:
619
- :no-pdf:
620
- INPUT
621
- html = File.read("test.html", encoding: "utf-8")
622
- expect(html).to match(%r{<script>})
623
- end
624
-
625
- it "uses default fonts" do
626
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
627
- = Document title
628
- Author
629
- :docfile: test.adoc
630
- :novalid:
631
- :no-isobib:
632
- :no-pdf:
633
- INPUT
634
- html = File.read("test.html", encoding: "utf-8")
635
- expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
636
- expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Cambria", serif;]m)
637
- expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Cambria", serif;]m)
638
- end
639
-
640
- it "uses default fonts for alt doc" do
641
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
642
- = Document title
643
- Author
644
- :docfile: test.adoc
645
- :novalid:
646
- :no-isobib:
647
- :no-pdf:
648
- INPUT
649
- html = File.read("test_alt.html", encoding: "utf-8")
650
- expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Space Mono", monospace;]m)
651
- expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
652
- expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
653
- end
654
-
655
- it "uses Chinese fonts" do
656
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
657
- = Document title
658
- Author
659
- :docfile: test.adoc
660
- :novalid:
661
- :no-isobib:
662
- :script: Hans
663
- :no-pdf:
664
- INPUT
665
- html = File.read("test.html", encoding: "utf-8")
666
- expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
667
- expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
668
- expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
669
- end
670
-
671
- it "uses specified fonts" do
672
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
673
- = Document title
674
- Author
675
- :docfile: test.adoc
676
- :novalid:
677
- :no-isobib:
678
- :script: Hans
679
- :body-font: Zapf Chancery
680
- :header-font: Comic Sans
681
- :monospace-font: Andale Mono
682
- :no-pdf:
683
- INPUT
684
- html = File.read("test.html", encoding: "utf-8")
685
- expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: Andale Mono;]m)
686
- expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m)
687
- expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: Comic Sans;]m)
688
- end
689
-
690
- it "strips MS-specific CSS" do
691
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
692
- = Document title
693
- Author
694
- :docfile: test.adoc
695
- :novalid:
696
- :no-isobib:
697
- :no-pdf:
698
- INPUT
699
- word = File.read("test.doc", encoding: "utf-8")
700
- html = File.read("test.html", encoding: "utf-8")
701
- expect(word).to match(%r[mso-style-name: "Intro Title";]m)
702
- expect(html).not_to match(%r[mso-style-name: "Intro Title";]m)
703
- end
704
- end