metanorma-standoc 1.9.3 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -13
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -6
- data/lib/asciidoctor/standoc/base.rb +3 -1
- data/lib/asciidoctor/standoc/blocks.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup.rb +1 -2
- data/lib/asciidoctor/standoc/cleanup_block.rb +0 -1
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -2
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +0 -1
- data/lib/asciidoctor/standoc/cleanup_inline.rb +117 -77
- data/lib/asciidoctor/standoc/cleanup_maths.rb +0 -1
- data/lib/asciidoctor/standoc/cleanup_ref.rb +7 -0
- data/lib/asciidoctor/standoc/cleanup_section.rb +13 -81
- data/lib/asciidoctor/standoc/cleanup_section_names.rb +75 -0
- data/lib/asciidoctor/standoc/cleanup_terms.rb +19 -18
- data/lib/asciidoctor/standoc/converter.rb +1 -0
- data/lib/asciidoctor/standoc/front.rb +0 -1
- data/lib/asciidoctor/standoc/front_contributor.rb +66 -42
- data/lib/asciidoctor/standoc/inline.rb +45 -34
- data/lib/asciidoctor/standoc/isodoc.rng +65 -7
- data/lib/asciidoctor/standoc/macros.rb +7 -5
- data/lib/asciidoctor/standoc/macros_plantuml.rb +21 -23
- data/lib/asciidoctor/standoc/macros_terms.rb +60 -23
- data/lib/asciidoctor/standoc/section.rb +19 -12
- data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +69 -30
- data/lib/asciidoctor/standoc/terms.rb +1 -1
- data/lib/asciidoctor/standoc/utils.rb +0 -1
- data/lib/asciidoctor/standoc/validate.rb +22 -8
- data/lib/isodoc/html/html_titlepage.html +81 -0
- data/lib/isodoc/html/htmlstyle.css +983 -0
- data/lib/isodoc/html/htmlstyle.scss +714 -0
- data/lib/isodoc/html/scripts.html +71 -0
- data/lib/metanorma/standoc/processor.rb +16 -7
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +2 -2
- data/spec/asciidoctor/base_spec.rb +693 -553
- data/spec/asciidoctor/blocks_spec.rb +6 -6
- data/spec/asciidoctor/cleanup_spec.rb +899 -688
- data/spec/asciidoctor/inline_spec.rb +62 -14
- data/spec/asciidoctor/isobib_cache_spec.rb +4 -6
- data/spec/asciidoctor/lists_spec.rb +147 -135
- data/spec/asciidoctor/macros_json2text_spec.rb +1 -1
- data/spec/asciidoctor/macros_spec.rb +714 -168
- data/spec/asciidoctor/refs_spec.rb +1527 -1532
- data/spec/asciidoctor/validate_spec.rb +352 -304
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +51 -51
- data/spec/vcr_cassettes/isobib_get_123.yml +14 -14
- data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -27
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +36 -36
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
- metadata +10 -5
@@ -0,0 +1,71 @@
|
|
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
|
+
$('.container').animate({ 'padding-left': '31px' }, 'slow');
|
16
|
+
}
|
17
|
+
else {
|
18
|
+
$('nav').show();
|
19
|
+
$('nav').animate({ 'left': '0px' }, 'slow');
|
20
|
+
$('.container').animate({ 'padding-left': '360px' }, '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
|
+
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
46
|
+
//
|
47
|
+
// AnchorJS - v4.2.2 - 2020-04-20
|
48
|
+
// https://www.bryanbraun.com/anchorjs/
|
49
|
+
// Copyright (c) 2020 Bryan Braun; Licensed MIT
|
50
|
+
//
|
51
|
+
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
52
|
+
!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}}});
|
53
|
+
// @license-end
|
54
|
+
</script>
|
55
|
+
<script>
|
56
|
+
/*
|
57
|
+
$(document).ready(function() {
|
58
|
+
$('[id^=toc]').each(function ()
|
59
|
+
{
|
60
|
+
var currentToc = $(this);
|
61
|
+
var url = window.location.href;
|
62
|
+
currentToc.wrap("<a href='" + url + "#" + currentToc.attr("id") + "' </a>");
|
63
|
+
});
|
64
|
+
});
|
65
|
+
*/
|
66
|
+
anchors.options = {
|
67
|
+
placement: 'left'
|
68
|
+
};
|
69
|
+
anchors.add('h1, h2, h3, h4');
|
70
|
+
</script>
|
71
|
+
|
@@ -3,8 +3,7 @@ require "metanorma/processor"
|
|
3
3
|
module Metanorma
|
4
4
|
module Standoc
|
5
5
|
class Processor < Metanorma::Processor
|
6
|
-
|
7
|
-
def initialize
|
6
|
+
def initialize # rubocop:disable Lint/MissingSuper
|
8
7
|
@short = :standoc
|
9
8
|
@input_format = :asciidoc
|
10
9
|
@asciidoctor_backend = :standoc
|
@@ -13,7 +12,7 @@ module Metanorma
|
|
13
12
|
def output_formats
|
14
13
|
super.merge(
|
15
14
|
html: "html",
|
16
|
-
doc: "doc"
|
15
|
+
doc: "doc",
|
17
16
|
)
|
18
17
|
end
|
19
18
|
|
@@ -21,14 +20,24 @@ module Metanorma
|
|
21
20
|
"Metanorma::Standoc #{Metanorma::Standoc::VERSION}/IsoDoc #{IsoDoc::VERSION}"
|
22
21
|
end
|
23
22
|
|
24
|
-
def
|
23
|
+
def html_path(file)
|
24
|
+
File.join(File.dirname(__FILE__), "..", "..", "isodoc", "html", file)
|
25
|
+
end
|
26
|
+
|
27
|
+
def output(isodoc_node, inname, outname, format, options = {})
|
25
28
|
case format
|
26
29
|
when :html
|
27
|
-
|
30
|
+
options = options
|
31
|
+
.merge(htmlstylesheet: html_path("htmlstyle.scss"),
|
32
|
+
htmlcoverpage: html_path("html_titlepage.html"))
|
33
|
+
IsoDoc::HtmlConvert.new(options)
|
34
|
+
.convert(inname, isodoc_node, nil, outname)
|
28
35
|
when :doc
|
29
|
-
IsoDoc::WordConvert.new(options)
|
36
|
+
IsoDoc::WordConvert.new(options)
|
37
|
+
.convert(inname, isodoc_node, nil, outname)
|
30
38
|
when :presentation
|
31
|
-
IsoDoc::PresentationXMLConvert.new(options)
|
39
|
+
IsoDoc::PresentationXMLConvert.new(options)
|
40
|
+
.convert(inname, isodoc_node, nil, outname)
|
32
41
|
else
|
33
42
|
super
|
34
43
|
end
|
data/metanorma-standoc.gemspec
CHANGED
@@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
spec.files = `git ls-files`.split("\n")
|
26
26
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
27
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
27
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
28
28
|
|
29
29
|
spec.add_dependency "asciidoctor", "~> 2.0.0"
|
30
30
|
spec.add_dependency "iev", "~> 0.2.1"
|
31
|
-
spec.add_dependency "isodoc", "~> 1.
|
31
|
+
spec.add_dependency "isodoc", "~> 1.7.0"
|
32
32
|
spec.add_dependency "metanorma-plugin-datastruct"
|
33
33
|
spec.add_dependency "metanorma-plugin-lutaml"
|
34
34
|
spec.add_dependency "ruby-jing"
|
@@ -7,155 +7,167 @@ RSpec.describe Asciidoctor::Standoc do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it "processes a blank document" do
|
10
|
-
|
11
|
-
|
10
|
+
input = <<~INPUT
|
11
|
+
#{ASCIIDOC_BLANK_HDR}
|
12
12
|
INPUT
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
output = <<~OUTPUT
|
14
|
+
#{BLANK_HDR}
|
15
|
+
<sections/>
|
16
|
+
</standard-document>
|
16
17
|
OUTPUT
|
18
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
19
|
+
.to be_equivalent_to xmlpp(output)
|
17
20
|
end
|
18
21
|
|
19
22
|
it "converts a blank document" do
|
20
23
|
FileUtils.rm_f "test.doc"
|
21
|
-
|
24
|
+
input = <<~INPUT
|
22
25
|
= Document title
|
23
26
|
Author
|
24
27
|
:docfile: test.adoc
|
25
28
|
:novalid:
|
26
29
|
INPUT
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
output = <<~OUTPUT
|
31
|
+
#{BLANK_HDR}
|
32
|
+
<sections/>
|
33
|
+
</standard-document>
|
30
34
|
OUTPUT
|
35
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
36
|
+
.to be_equivalent_to xmlpp(output)
|
31
37
|
expect(File.exist?("test.doc")).to be true
|
32
38
|
expect(File.exist?("htmlstyle.css")).to be false
|
33
39
|
end
|
34
40
|
|
35
|
-
|
41
|
+
it "assigns default scripts to major languages" do
|
36
42
|
FileUtils.rm_f "test.doc"
|
37
|
-
|
43
|
+
input = <<~INPUT
|
38
44
|
= Document title
|
39
45
|
Author
|
40
46
|
:docfile: test.adoc
|
41
47
|
:novalid:
|
42
48
|
:language: ar
|
43
49
|
INPUT
|
44
|
-
|
45
|
-
|
46
|
-
<
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
<
|
51
|
-
|
52
|
-
|
53
|
-
<
|
54
|
-
|
55
|
-
|
56
|
-
<
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
50
|
+
output = <<~OUTPUT
|
51
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
|
52
|
+
<bibdata type='standard'>
|
53
|
+
<title language='en' format='text/plain'>Document title</title>
|
54
|
+
<language>ar</language>
|
55
|
+
<script>Arab</script>
|
56
|
+
<status>
|
57
|
+
<stage>published</stage>
|
58
|
+
</status>
|
59
|
+
<copyright>
|
60
|
+
<from>2021</from>
|
61
|
+
</copyright>
|
62
|
+
<ext>
|
63
|
+
<doctype>article</doctype>
|
64
|
+
</ext>
|
65
|
+
</bibdata>
|
66
|
+
<sections> </sections>
|
67
|
+
</standard-document>
|
61
68
|
OUTPUT
|
69
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
70
|
+
.to be_equivalent_to xmlpp(output)
|
62
71
|
end
|
63
72
|
|
64
73
|
it "processes publisher abbreviations" do
|
65
74
|
mock_org_abbrevs
|
66
|
-
|
75
|
+
input = <<~INPUT
|
67
76
|
= Document title
|
68
77
|
Author
|
69
78
|
:docfile: test.adoc
|
70
79
|
:nodoc:
|
71
80
|
:novalid:
|
72
81
|
:publisher: International Electrotechnical Commission;IETF;ISO
|
73
|
-
INPUT
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
</
|
154
|
-
|
82
|
+
INPUT
|
83
|
+
output = <<~OUTPUT
|
84
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
|
85
|
+
<bibdata type='standard'>
|
86
|
+
<title language='en' format='text/plain'>Document title</title>
|
87
|
+
<contributor>
|
88
|
+
<role type='author'/>
|
89
|
+
<organization>
|
90
|
+
<name>International Electrotechnical Commission</name>
|
91
|
+
<abbreviation>IEC</abbreviation>
|
92
|
+
</organization>
|
93
|
+
</contributor>
|
94
|
+
<contributor>
|
95
|
+
<role type='author'/>
|
96
|
+
<organization>
|
97
|
+
<name>IETF</name>
|
98
|
+
</organization>
|
99
|
+
</contributor>
|
100
|
+
<contributor>
|
101
|
+
<role type='author'/>
|
102
|
+
<organization>
|
103
|
+
<name>International Standards Organization</name>
|
104
|
+
<abbreviation>ISO</abbreviation>
|
105
|
+
</organization>
|
106
|
+
</contributor>
|
107
|
+
<contributor>
|
108
|
+
<role type='publisher'/>
|
109
|
+
<organization>
|
110
|
+
<name>International Electrotechnical Commission</name>
|
111
|
+
<abbreviation>IEC</abbreviation>
|
112
|
+
</organization>
|
113
|
+
</contributor>
|
114
|
+
<contributor>
|
115
|
+
<role type='publisher'/>
|
116
|
+
<organization>
|
117
|
+
<name>IETF</name>
|
118
|
+
</organization>
|
119
|
+
</contributor>
|
120
|
+
<contributor>
|
121
|
+
<role type='publisher'/>
|
122
|
+
<organization>
|
123
|
+
<name>International Standards Organization</name>
|
124
|
+
<abbreviation>ISO</abbreviation>
|
125
|
+
</organization>
|
126
|
+
</contributor>
|
127
|
+
<language>en</language>
|
128
|
+
<script>Latn</script>
|
129
|
+
<status>
|
130
|
+
<stage>published</stage>
|
131
|
+
</status>
|
132
|
+
<copyright>
|
133
|
+
<from>#{Time.now.year}</from>
|
134
|
+
<owner>
|
135
|
+
<organization>
|
136
|
+
<name>International Electrotechnical Commission</name>
|
137
|
+
<abbreviation>IEC</abbreviation>
|
138
|
+
</organization>
|
139
|
+
</owner>
|
140
|
+
</copyright>
|
141
|
+
<copyright>
|
142
|
+
<from>#{Time.now.year}</from>
|
143
|
+
<owner>
|
144
|
+
<organization>
|
145
|
+
<name>IETF</name>
|
146
|
+
</organization>
|
147
|
+
</owner>
|
148
|
+
</copyright>
|
149
|
+
<copyright>
|
150
|
+
<from>#{Time.now.year}</from>
|
151
|
+
<owner>
|
152
|
+
<organization>
|
153
|
+
<name>International Standards Organization</name>
|
154
|
+
<abbreviation>ISO</abbreviation>
|
155
|
+
</organization>
|
156
|
+
</owner>
|
157
|
+
</copyright>
|
158
|
+
<ext>
|
159
|
+
<doctype>article</doctype>
|
160
|
+
</ext>
|
161
|
+
</bibdata>
|
162
|
+
<sections> </sections>
|
163
|
+
</standard-document>
|
164
|
+
OUTPUT
|
165
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
166
|
+
.to be_equivalent_to xmlpp(output)
|
155
167
|
end
|
156
168
|
|
157
169
|
it "processes default metadata" do
|
158
|
-
|
170
|
+
input = <<~INPUT
|
159
171
|
= Document title
|
160
172
|
Author
|
161
173
|
:docfile: test.adoc
|
@@ -242,270 +254,273 @@ OUTPUT
|
|
242
254
|
:isbn10: ISBN-10
|
243
255
|
:classification: a:b, c
|
244
256
|
INPUT
|
245
|
-
|
246
|
-
|
247
|
-
<
|
248
|
-
<
|
249
|
-
|
250
|
-
|
251
|
-
<docidentifier type='
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
</
|
256
|
-
|
257
|
-
|
258
|
-
</
|
259
|
-
|
260
|
-
|
261
|
-
</
|
262
|
-
|
263
|
-
|
264
|
-
</
|
265
|
-
|
266
|
-
|
267
|
-
</
|
268
|
-
|
269
|
-
|
270
|
-
</
|
271
|
-
|
272
|
-
|
273
|
-
</
|
274
|
-
|
275
|
-
|
276
|
-
</
|
277
|
-
|
278
|
-
|
279
|
-
</
|
280
|
-
|
281
|
-
|
282
|
-
</
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
</
|
292
|
-
|
293
|
-
|
294
|
-
</
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
</
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
</
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
</
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
<subdivision>
|
325
|
-
|
326
|
-
<formattedAddress>
|
327
|
-
6 Rubble Way, Bedrock
|
328
|
-
</formattedAddress>
|
329
|
-
</address>
|
330
|
-
</organization>
|
331
|
-
</affiliation>
|
332
|
-
<phone>123</phone>
|
333
|
-
<phone type='fax'>456</phone>
|
334
|
-
<uri>http://slate.example.com</uri>
|
335
|
-
</person>
|
336
|
-
</contributor>
|
337
|
-
<contributor>
|
338
|
-
<role type="editor"/>
|
339
|
-
<person>
|
340
|
-
<name>
|
341
|
-
<forename>Barney</forename>
|
342
|
-
<initial>B. X.</initial>
|
343
|
-
<surname>Rubble</surname>
|
344
|
-
</name>
|
345
|
-
<affiliation>
|
346
|
-
<organization>
|
347
|
-
<name>Rockhead and Quarry Cave Construction Company</name>
|
348
|
-
<abbreviation>RQCCC</abbreviation>
|
349
|
-
<subdivision>Hermeneutics Unit</subdivision>
|
350
|
-
<subdivision>Exegetical Subunit</subdivision>
|
351
|
-
<address>
|
352
|
-
<formattedAddress>6A Rubble Way, <br/>Bedrock</formattedAddress>
|
353
|
-
</address>
|
354
|
-
</organization>
|
355
|
-
</affiliation>
|
356
|
-
<phone>789</phone>
|
357
|
-
<phone type='fax'>012</phone>
|
358
|
-
<email>barney@rockhead.example.com</email>
|
359
|
-
</person>
|
360
|
-
</contributor>
|
361
|
-
<contributor>
|
362
|
-
<role type="publisher"/>
|
363
|
-
<organization>
|
364
|
-
<name>Hanna Barbera</name>
|
365
|
-
<address>
|
366
|
-
<formattedAddress>
|
367
|
-
1 Infinity Loop
|
368
|
-
<br/>
|
369
|
-
California
|
370
|
-
</formattedAddress>
|
371
|
-
</address>
|
372
|
-
<phone>3333333</phone>
|
373
|
-
<phone type='fax'>4444444</phone>
|
374
|
-
<email>x@example.com</email>
|
375
|
-
<uri>http://www.example.com</uri>
|
376
|
-
</organization>
|
377
|
-
</contributor>
|
378
|
-
<contributor>
|
379
|
-
<role type="publisher"/>
|
380
|
-
<organization>
|
381
|
-
<name>Cartoon Network</name>
|
382
|
-
<address>
|
383
|
-
<formattedAddress>
|
384
|
-
1 Infinity Loop
|
385
|
-
<br/>
|
386
|
-
California
|
387
|
-
</formattedAddress>
|
388
|
-
</address>
|
389
|
-
<phone>3333333</phone>
|
390
|
-
<phone type='fax'>4444444</phone>
|
391
|
-
<email>x@example.com</email>
|
392
|
-
<uri>http://www.example.com</uri>
|
393
|
-
</organization>
|
394
|
-
</contributor>
|
395
|
-
<contributor>
|
396
|
-
<role type="publisher"/>
|
397
|
-
<organization>
|
398
|
-
<name>Ribose, Inc.</name>
|
399
|
-
<address>
|
400
|
-
<formattedAddress>
|
401
|
-
1 Infinity Loop
|
402
|
-
<br/>
|
403
|
-
California
|
404
|
-
</formattedAddress>
|
405
|
-
</address>
|
406
|
-
<phone>3333333</phone>
|
407
|
-
<phone type='fax'>4444444</phone>
|
408
|
-
<email>x@example.com</email>
|
409
|
-
<uri>http://www.example.com</uri>
|
410
|
-
</organization>
|
411
|
-
</contributor>
|
412
|
-
<edition>2</edition>
|
413
|
-
<version>
|
414
|
-
<revision-date>2000-01-01</revision-date>
|
415
|
-
<draft>3.4</draft>
|
416
|
-
</version>
|
417
|
-
<language>en</language>
|
418
|
-
<script>Latn</script>
|
419
|
-
<status>
|
420
|
-
<stage>10</stage>
|
421
|
-
<substage>20</substage>
|
422
|
-
<iteration>3</iteration>
|
423
|
-
</status>
|
424
|
-
<copyright>
|
425
|
-
<from>2001</from>
|
426
|
-
<owner>
|
427
|
-
<organization>
|
428
|
-
<name>Ribose, Inc.</name>
|
257
|
+
output = <<~OUTPUT
|
258
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
259
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
260
|
+
<bibdata type="standard">
|
261
|
+
<title language="en" format="text/plain">Main Title — Title</title>
|
262
|
+
<docidentifier>1000-1</docidentifier>
|
263
|
+
<docidentifier type='ISBN'>ISBN-13</docidentifier>
|
264
|
+
<docidentifier type='ISBN10'>ISBN-10</docidentifier>
|
265
|
+
<docnumber>1000</docnumber>
|
266
|
+
<date type="published">
|
267
|
+
<on>1000-01-01</on>
|
268
|
+
</date>
|
269
|
+
<date type="accessed">
|
270
|
+
<on>1001-01-01</on>
|
271
|
+
</date>
|
272
|
+
<date type="created">
|
273
|
+
<on>1002-01-01</on>
|
274
|
+
</date>
|
275
|
+
<date type="implemented">
|
276
|
+
<on>1003-01-01</on>
|
277
|
+
</date>
|
278
|
+
<date type="obsoleted">
|
279
|
+
<on>1004-01-01</on>
|
280
|
+
</date>
|
281
|
+
<date type="confirmed">
|
282
|
+
<on>1005-01-01</on>
|
283
|
+
</date>
|
284
|
+
<date type="updated">
|
285
|
+
<on>1006-01-01</on>
|
286
|
+
</date>
|
287
|
+
<date type="issued">
|
288
|
+
<on>1007-01-01</on>
|
289
|
+
</date>
|
290
|
+
<date type="circulated">
|
291
|
+
<on>1008-01-01</on>
|
292
|
+
</date>
|
293
|
+
<date type="unchanged">
|
294
|
+
<on>1009-01-01</on>
|
295
|
+
</date>
|
296
|
+
<date type='vote-started'>
|
297
|
+
<on>1011-01-01</on>
|
298
|
+
</date>
|
299
|
+
<date type='vote-ended'>
|
300
|
+
<on>1012-01-01</on>
|
301
|
+
</date>
|
302
|
+
<date type="Fred">
|
303
|
+
<on>1010-01-01</on>
|
304
|
+
</date>
|
305
|
+
<date type="Jack">
|
306
|
+
<on>1010-01-01</on>
|
307
|
+
</date>
|
308
|
+
<contributor>
|
309
|
+
<role type="author"/>
|
310
|
+
<organization>
|
311
|
+
<name>Hanna Barbera</name>
|
312
|
+
</organization>
|
313
|
+
</contributor>
|
314
|
+
<contributor>
|
315
|
+
<role type="author"/>
|
316
|
+
<organization>
|
317
|
+
<name>Cartoon Network</name>
|
318
|
+
</organization>
|
319
|
+
</contributor>
|
320
|
+
<contributor>
|
321
|
+
<role type="author"/>
|
322
|
+
<organization>
|
323
|
+
<name>Ribose, Inc.</name>
|
324
|
+
</organization>
|
325
|
+
</contributor>
|
326
|
+
<contributor>
|
327
|
+
<role type="author"/>
|
328
|
+
<person>
|
329
|
+
<name>
|
330
|
+
<completename>Fred Flintstone</completename>
|
331
|
+
</name>
|
332
|
+
<affiliation>
|
333
|
+
<organization>
|
334
|
+
<name>Slate Rock and Gravel Company</name>
|
335
|
+
<abbreviation>SRG</abbreviation>
|
336
|
+
<subdivision>Hermeneutics Unit</subdivision>
|
337
|
+
<subdivision>Exegetical Subunit</subdivision>
|
429
338
|
<address>
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
339
|
+
<formattedAddress>
|
340
|
+
6 Rubble Way, Bedrock
|
341
|
+
</formattedAddress>
|
342
|
+
</address>
|
343
|
+
</organization>
|
344
|
+
</affiliation>
|
345
|
+
<phone>123</phone>
|
346
|
+
<phone type='fax'>456</phone>
|
347
|
+
<uri>http://slate.example.com</uri>
|
348
|
+
</person>
|
349
|
+
</contributor>
|
350
|
+
<contributor>
|
351
|
+
<role type="editor"/>
|
352
|
+
<person>
|
353
|
+
<name>
|
354
|
+
<forename>Barney</forename>
|
355
|
+
<initial>B. X.</initial>
|
356
|
+
<surname>Rubble</surname>
|
357
|
+
</name>
|
358
|
+
<affiliation>
|
359
|
+
<organization>
|
360
|
+
<name>Rockhead and Quarry Cave Construction Company</name>
|
361
|
+
<abbreviation>RQCCC</abbreviation>
|
362
|
+
<subdivision>Hermeneutics Unit</subdivision>
|
363
|
+
<subdivision>Exegetical Subunit</subdivision>
|
448
364
|
<address>
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
</
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
</
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
<
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
<
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
</
|
502
|
-
|
503
|
-
</
|
365
|
+
<formattedAddress>6A Rubble Way, <br/>Bedrock</formattedAddress>
|
366
|
+
</address>
|
367
|
+
</organization>
|
368
|
+
</affiliation>
|
369
|
+
<phone>789</phone>
|
370
|
+
<phone type='fax'>012</phone>
|
371
|
+
<email>barney@rockhead.example.com</email>
|
372
|
+
</person>
|
373
|
+
</contributor>
|
374
|
+
<contributor>
|
375
|
+
<role type="publisher"/>
|
376
|
+
<organization>
|
377
|
+
<name>Hanna Barbera</name>
|
378
|
+
<address>
|
379
|
+
<formattedAddress>
|
380
|
+
1 Infinity Loop
|
381
|
+
<br/>
|
382
|
+
California
|
383
|
+
</formattedAddress>
|
384
|
+
</address>
|
385
|
+
<phone>3333333</phone>
|
386
|
+
<phone type='fax'>4444444</phone>
|
387
|
+
<email>x@example.com</email>
|
388
|
+
<uri>http://www.example.com</uri>
|
389
|
+
</organization>
|
390
|
+
</contributor>
|
391
|
+
<contributor>
|
392
|
+
<role type="publisher"/>
|
393
|
+
<organization>
|
394
|
+
<name>Cartoon Network</name>
|
395
|
+
<address>
|
396
|
+
<formattedAddress>
|
397
|
+
1 Infinity Loop
|
398
|
+
<br/>
|
399
|
+
California
|
400
|
+
</formattedAddress>
|
401
|
+
</address>
|
402
|
+
<phone>3333333</phone>
|
403
|
+
<phone type='fax'>4444444</phone>
|
404
|
+
<email>x@example.com</email>
|
405
|
+
<uri>http://www.example.com</uri>
|
406
|
+
</organization>
|
407
|
+
</contributor>
|
408
|
+
<contributor>
|
409
|
+
<role type="publisher"/>
|
410
|
+
<organization>
|
411
|
+
<name>Ribose, Inc.</name>
|
412
|
+
<address>
|
413
|
+
<formattedAddress>
|
414
|
+
1 Infinity Loop
|
415
|
+
<br/>
|
416
|
+
California
|
417
|
+
</formattedAddress>
|
418
|
+
</address>
|
419
|
+
<phone>3333333</phone>
|
420
|
+
<phone type='fax'>4444444</phone>
|
421
|
+
<email>x@example.com</email>
|
422
|
+
<uri>http://www.example.com</uri>
|
423
|
+
</organization>
|
424
|
+
</contributor>
|
425
|
+
<edition>2</edition>
|
426
|
+
<version>
|
427
|
+
<revision-date>2000-01-01</revision-date>
|
428
|
+
<draft>3.4</draft>
|
429
|
+
</version>
|
430
|
+
<language>en</language>
|
431
|
+
<script>Latn</script>
|
432
|
+
<status>
|
433
|
+
<stage>10</stage>
|
434
|
+
<substage>20</substage>
|
435
|
+
<iteration>3</iteration>
|
436
|
+
</status>
|
437
|
+
<copyright>
|
438
|
+
<from>2001</from>
|
439
|
+
<owner>
|
440
|
+
<organization>
|
441
|
+
<name>Ribose, Inc.</name>
|
442
|
+
<address>
|
443
|
+
<formattedAddress>
|
444
|
+
1 Infinity Loop
|
445
|
+
<br/>
|
446
|
+
California
|
447
|
+
</formattedAddress>
|
448
|
+
</address>
|
449
|
+
<phone>3333333</phone>
|
450
|
+
<phone type='fax'>4444444</phone>
|
451
|
+
<email>x@example.com</email>
|
452
|
+
<uri>http://www.example.com</uri>
|
453
|
+
</organization>
|
454
|
+
</owner>
|
455
|
+
</copyright>
|
456
|
+
<copyright>
|
457
|
+
<from>2001</from>
|
458
|
+
<owner>
|
459
|
+
<organization>
|
460
|
+
<name>Hanna Barbera</name>
|
461
|
+
<address>
|
462
|
+
<formattedAddress>
|
463
|
+
1 Infinity Loop
|
464
|
+
<br/>
|
465
|
+
California
|
466
|
+
</formattedAddress>
|
467
|
+
</address>
|
468
|
+
<phone>3333333</phone>
|
469
|
+
<phone type='fax'>4444444</phone>
|
470
|
+
<email>x@example.com</email>
|
471
|
+
<uri>http://www.example.com</uri>
|
472
|
+
</organization>
|
473
|
+
</owner>
|
474
|
+
</copyright>
|
475
|
+
<relation type="partOf">
|
476
|
+
<bibitem>
|
477
|
+
<title>--</title>
|
478
|
+
<docidentifier>ABC</docidentifier>
|
479
|
+
</bibitem>
|
480
|
+
</relation>
|
481
|
+
<relation type="translatedFrom">
|
482
|
+
<bibitem>
|
483
|
+
<title>GHI</title>
|
484
|
+
<docidentifier>DEF</docidentifier>
|
485
|
+
</bibitem>
|
486
|
+
</relation>
|
487
|
+
<relation type="translatedFrom">
|
488
|
+
<bibitem>
|
489
|
+
<title>PQR</title>
|
490
|
+
<docidentifier>JKL MNO</docidentifier>
|
491
|
+
</bibitem>
|
492
|
+
</relation>
|
493
|
+
<classification type='a'>b</classification>
|
494
|
+
<classification type='default'>c</classification>
|
495
|
+
<keyword>a</keyword>
|
496
|
+
<keyword>b</keyword>
|
497
|
+
<keyword>c</keyword>
|
498
|
+
<ext>
|
499
|
+
<doctype>article</doctype>
|
500
|
+
<editorialgroup>
|
501
|
+
<technical-committee number="1" type="A">TC</technical-committee>
|
502
|
+
<technical-committee number="11" type="A1">TC1</technical-committee>
|
503
|
+
</editorialgroup>
|
504
|
+
<ics>
|
505
|
+
<code>1</code>
|
506
|
+
</ics>
|
507
|
+
<ics>
|
508
|
+
<code>2</code>
|
509
|
+
</ics>
|
510
|
+
<ics>
|
511
|
+
<code>3</code>
|
512
|
+
</ics>
|
513
|
+
</ext>
|
514
|
+
</bibdata>
|
515
|
+
<sections/>
|
516
|
+
</standard-document>
|
504
517
|
OUTPUT
|
518
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
519
|
+
.to be_equivalent_to xmlpp(output)
|
505
520
|
end
|
506
521
|
|
507
522
|
it "processes complex metadata" do
|
508
|
-
|
523
|
+
input = <<~INPUT
|
509
524
|
= Document title
|
510
525
|
Author
|
511
526
|
:docfile: test.adoc
|
@@ -530,6 +545,19 @@ OUTPUT
|
|
530
545
|
:docsubtype: This is a DocSubType
|
531
546
|
:subdivision: Subdivision
|
532
547
|
:subdivision-abbr: SD
|
548
|
+
:fullname: Fred Flintstone
|
549
|
+
:affiliation: Slate Rock and Gravel Company
|
550
|
+
:street: 1 Infinity Loop
|
551
|
+
:city: Cupertino
|
552
|
+
:state: CA
|
553
|
+
:country: USA
|
554
|
+
:postcode: 95014
|
555
|
+
:fullname_2: Barney Rubble
|
556
|
+
:affiliation_2: Slate Rock and Gravel Company
|
557
|
+
:street_2: Pavillon de Breteuil
|
558
|
+
:city_2: Sèvres CEDEX
|
559
|
+
:country_2: France
|
560
|
+
:postcode_2: F-92312
|
533
561
|
|
534
562
|
[abstract]
|
535
563
|
== Abstract
|
@@ -540,114 +568,227 @@ OUTPUT
|
|
540
568
|
[language=en]
|
541
569
|
== Clause 1
|
542
570
|
INPUT
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
</
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
</
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
<
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
</
|
571
|
+
output = <<~OUTPUT
|
572
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
573
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
574
|
+
<bibdata type="standard">
|
575
|
+
<title language="en" format="text/plain">Document title</title>
|
576
|
+
<title language="eo" format="text/plain">Dokumenttitolo</title>
|
577
|
+
<uri>A</uri>
|
578
|
+
<uri type="xml">B</uri>
|
579
|
+
<uri type="html">C</uri>
|
580
|
+
<uri type="pdf">D</uri>
|
581
|
+
<uri type="doc">E</uri>
|
582
|
+
<uri type="relaton">F</uri>
|
583
|
+
<docidentifier>1000-1-1</docidentifier>
|
584
|
+
<docnumber>1000</docnumber>
|
585
|
+
<date type='published'>
|
586
|
+
<on>1000-01</on>
|
587
|
+
</date>
|
588
|
+
<contributor>
|
589
|
+
<role type="author"/>
|
590
|
+
<organization>
|
591
|
+
<name>IEC</name>
|
592
|
+
</organization>
|
593
|
+
</contributor>
|
594
|
+
<contributor>
|
595
|
+
<role type="author"/>
|
596
|
+
<organization>
|
597
|
+
<name>IETF</name>
|
598
|
+
</organization>
|
599
|
+
</contributor>
|
600
|
+
<contributor>
|
601
|
+
<role type="author"/>
|
602
|
+
<organization>
|
603
|
+
<name>ISO</name>
|
604
|
+
</organization>
|
605
|
+
</contributor>
|
606
|
+
<contributor>
|
607
|
+
<role type='author'/>
|
608
|
+
<person>
|
609
|
+
<name>
|
610
|
+
<completename>Fred Flintstone</completename>
|
611
|
+
</name>
|
612
|
+
<affiliation>
|
613
|
+
<organization>
|
614
|
+
<name>Slate Rock and Gravel Company</name>
|
615
|
+
<address>
|
616
|
+
<street>1 Infinity Loop</street>
|
617
|
+
<city>Cupertino</city>
|
618
|
+
<state>CA</state>
|
619
|
+
<country>USA</country>
|
620
|
+
<postcode>95014</postcode>
|
621
|
+
</address>
|
622
|
+
</organization>
|
623
|
+
</affiliation>
|
624
|
+
</person>
|
625
|
+
</contributor>
|
626
|
+
<contributor>
|
627
|
+
<role type='author'/>
|
628
|
+
<person>
|
629
|
+
<name>
|
630
|
+
<completename>Barney Rubble</completename>
|
631
|
+
</name>
|
632
|
+
<affiliation>
|
633
|
+
<organization>
|
634
|
+
<name>Slate Rock and Gravel Company</name>
|
635
|
+
<address>
|
636
|
+
<street>Pavillon de Breteuil</street>
|
637
|
+
<city>Sèvres CEDEX</city>
|
638
|
+
<country>France</country>
|
639
|
+
<postcode>F-92312</postcode>
|
640
|
+
</address>
|
641
|
+
</organization>
|
642
|
+
</affiliation>
|
643
|
+
</person>
|
644
|
+
</contributor>
|
645
|
+
<contributor>
|
646
|
+
<role type="publisher"/>
|
647
|
+
<organization>
|
648
|
+
<name>IEC</name>
|
649
|
+
</organization>
|
650
|
+
</contributor>
|
651
|
+
<contributor>
|
652
|
+
<role type="publisher"/>
|
653
|
+
<organization>
|
654
|
+
<name>IETF</name>
|
655
|
+
</organization>
|
656
|
+
</contributor>
|
657
|
+
<contributor>
|
658
|
+
<role type="publisher"/>
|
659
|
+
<organization>
|
660
|
+
<name>ISO</name>
|
661
|
+
</organization>
|
662
|
+
</contributor>
|
663
|
+
<version>
|
664
|
+
<revision-date>2000-01</revision-date>
|
665
|
+
</version>
|
666
|
+
<language>el</language>
|
667
|
+
<script>Grek</script>
|
668
|
+
<abstract><p>This is the abstract of the document</p>
|
669
|
+
<p>This is the second paragraph of the abstract of the document.</p></abstract>
|
670
|
+
<status><stage>published</stage></status>
|
671
|
+
<copyright>
|
672
|
+
<from>#{Date.today.year}</from>
|
673
|
+
<owner>
|
674
|
+
<organization>
|
675
|
+
<name>IEC</name>
|
676
|
+
</organization>
|
677
|
+
</owner>
|
678
|
+
</copyright>
|
679
|
+
<copyright>
|
680
|
+
<from>#{Date.today.year}</from>
|
681
|
+
<owner>
|
682
|
+
<organization>
|
683
|
+
<name>IETF</name>
|
684
|
+
</organization>
|
685
|
+
</owner>
|
686
|
+
</copyright>
|
687
|
+
<copyright>
|
688
|
+
<from>#{Date.today.year}</from>
|
689
|
+
<owner>
|
690
|
+
<organization>
|
691
|
+
<name>ISO</name>
|
692
|
+
</organization>
|
693
|
+
</owner>
|
694
|
+
</copyright>
|
695
|
+
<ext>
|
696
|
+
<doctype>this-is-a-doctype</doctype>
|
697
|
+
<subdoctype>This is a DocSubType</subdoctype>
|
698
|
+
</ext>
|
699
|
+
</bibdata>
|
700
|
+
<preface>
|
701
|
+
<abstract id='_'>
|
702
|
+
<title>Abstract</title>
|
703
|
+
<p id='_'>This is the abstract of the document</p>
|
704
|
+
<p id='_'>This is the second paragraph of the abstract of the document.</p>
|
705
|
+
</abstract>
|
706
|
+
</preface>
|
707
|
+
<sections>
|
708
|
+
<clause id='_' language='en' inline-header='false' obligation='normative'>
|
709
|
+
<title>Clause 1</title>
|
710
|
+
</clause>
|
711
|
+
</sections>
|
712
|
+
</standard-document>
|
713
|
+
OUTPUT
|
714
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
715
|
+
.to be_equivalent_to xmlpp(output)
|
716
|
+
end
|
717
|
+
|
718
|
+
it "processes formatted address overridding address components" do
|
719
|
+
input = <<~INPUT
|
720
|
+
= Document title
|
721
|
+
Author
|
722
|
+
:docfile: test.adoc
|
723
|
+
:nodoc:
|
724
|
+
:novalid:
|
725
|
+
:fullname: Fred Flintstone
|
726
|
+
:affiliation: Slate Rock and Gravel Company
|
727
|
+
:address: Address
|
728
|
+
:city: Utopia
|
729
|
+
:fullname_2: Barney Rubble
|
730
|
+
:affiliation_2: Slate Rock and Gravel Company
|
731
|
+
:city_2: Utopia
|
732
|
+
|
733
|
+
INPUT
|
734
|
+
output = <<~OUTPUT
|
735
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
736
|
+
<bibdata type='standard'>
|
737
|
+
<title language='en' format='text/plain'>Document title</title>
|
738
|
+
<contributor>
|
739
|
+
<role type='author'/>
|
740
|
+
<person>
|
741
|
+
<name>
|
742
|
+
<completename>Fred Flintstone</completename>
|
743
|
+
</name>
|
744
|
+
<affiliation>
|
745
|
+
<organization>
|
746
|
+
<name>Slate Rock and Gravel Company</name>
|
747
|
+
<address>
|
748
|
+
<formattedAddress>Address</formattedAddress>
|
749
|
+
</address>
|
750
|
+
</organization>
|
751
|
+
</affiliation>
|
752
|
+
</person>
|
753
|
+
</contributor>
|
754
|
+
<contributor>
|
755
|
+
<role type='author'/>
|
756
|
+
<person>
|
757
|
+
<name>
|
758
|
+
<completename>Barney Rubble</completename>
|
759
|
+
</name>
|
760
|
+
<affiliation>
|
761
|
+
<organization>
|
762
|
+
<name>Slate Rock and Gravel Company</name>
|
763
|
+
<address>
|
764
|
+
<city>Utopia</city>
|
765
|
+
</address>
|
766
|
+
</organization>
|
767
|
+
</affiliation>
|
768
|
+
</person>
|
769
|
+
</contributor>
|
770
|
+
<language>en</language>
|
771
|
+
<script>Latn</script>
|
772
|
+
<status>
|
773
|
+
<stage>published</stage>
|
774
|
+
</status>
|
775
|
+
<copyright>
|
776
|
+
<from>2021</from>
|
777
|
+
</copyright>
|
778
|
+
<ext>
|
779
|
+
<doctype>article</doctype>
|
780
|
+
</ext>
|
781
|
+
</bibdata>
|
782
|
+
<sections> </sections>
|
783
|
+
</standard-document>
|
645
784
|
OUTPUT
|
785
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
786
|
+
.to be_equivalent_to xmlpp(output)
|
646
787
|
end
|
647
788
|
|
648
|
-
|
649
|
-
|
650
|
-
|
789
|
+
it "processes subdivisions" do
|
790
|
+
mock_default_publisher
|
791
|
+
input = <<~INPUT
|
651
792
|
= Document title
|
652
793
|
Author
|
653
794
|
:docfile: test.adoc
|
@@ -671,71 +812,73 @@ OUTPUT
|
|
671
812
|
:pub-uri: http://www.example.com
|
672
813
|
|
673
814
|
INPUT
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
</
|
699
|
-
|
700
|
-
<phone
|
701
|
-
<
|
702
|
-
<
|
703
|
-
</
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
</
|
723
|
-
|
724
|
-
<phone
|
725
|
-
<
|
726
|
-
<
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
</
|
736
|
-
|
737
|
-
OUTPUT
|
738
|
-
|
815
|
+
output = <<~OUTPUT
|
816
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
817
|
+
<bibdata type='standard'>
|
818
|
+
<title language='en' format='text/plain'>Document title</title>
|
819
|
+
<docidentifier>1000-1-1</docidentifier>
|
820
|
+
<docnumber>1000</docnumber>
|
821
|
+
<date type='published'>
|
822
|
+
<on>1000-01</on>
|
823
|
+
</date>
|
824
|
+
<contributor>
|
825
|
+
<role type='author'/>
|
826
|
+
<organization>
|
827
|
+
<name>International Standards Organization</name>
|
828
|
+
<subdivision>Subdivision</subdivision>
|
829
|
+
<abbreviation>SD</abbreviation>
|
830
|
+
</organization>
|
831
|
+
</contributor>
|
832
|
+
<contributor>
|
833
|
+
<role type='publisher'/>
|
834
|
+
<organization>
|
835
|
+
<name>International Standards Organization</name>
|
836
|
+
<subdivision>Subdivision</subdivision>
|
837
|
+
<abbreviation>SD</abbreviation>
|
838
|
+
<address>
|
839
|
+
<formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
|
840
|
+
</address>
|
841
|
+
<phone>3333333</phone>
|
842
|
+
<phone type='fax'>4444444</phone>
|
843
|
+
<email>x@example.com</email>
|
844
|
+
<uri>http://www.example.com</uri>
|
845
|
+
</organization>
|
846
|
+
</contributor>
|
847
|
+
<version>
|
848
|
+
<revision-date>2000-01</revision-date>
|
849
|
+
</version>
|
850
|
+
<language>el</language>
|
851
|
+
<script>Grek</script>
|
852
|
+
<status>
|
853
|
+
<stage>published</stage>
|
854
|
+
</status>
|
855
|
+
<copyright>
|
856
|
+
<from>#{Time.now.year}</from>
|
857
|
+
<owner>
|
858
|
+
<organization>
|
859
|
+
<name>International Standards Organization</name>
|
860
|
+
<subdivision>Subdivision</subdivision>
|
861
|
+
<abbreviation>SD</abbreviation>
|
862
|
+
<address>
|
863
|
+
<formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
|
864
|
+
</address>
|
865
|
+
<phone>3333333</phone>
|
866
|
+
<phone type='fax'>4444444</phone>
|
867
|
+
<email>x@example.com</email>
|
868
|
+
<uri>http://www.example.com</uri>
|
869
|
+
</organization>
|
870
|
+
</owner>
|
871
|
+
</copyright>
|
872
|
+
<ext>
|
873
|
+
<doctype>this-is-a-doctype</doctype>
|
874
|
+
</ext>
|
875
|
+
</bibdata>
|
876
|
+
<sections> </sections>
|
877
|
+
</standard-document>
|
878
|
+
OUTPUT
|
879
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
880
|
+
.to be_equivalent_to xmlpp(output)
|
881
|
+
end
|
739
882
|
|
740
883
|
it "reads scripts into blank HTML document" do
|
741
884
|
FileUtils.rm_f "test.html"
|
@@ -856,20 +999,17 @@ QU1FOiB0ZXN0Cgo=
|
|
856
999
|
private
|
857
1000
|
|
858
1001
|
def mock_org_abbrevs
|
859
|
-
allow_any_instance_of(::Asciidoctor::Standoc::Front)
|
860
|
-
|
861
|
-
"International
|
862
|
-
|
1002
|
+
allow_any_instance_of(::Asciidoctor::Standoc::Front)
|
1003
|
+
.to receive(:org_abbrev).and_return(
|
1004
|
+
{ "International Standards Organization" => "ISO",
|
1005
|
+
"International Electrotechnical Commission" => "IEC" },
|
1006
|
+
)
|
863
1007
|
end
|
864
1008
|
|
865
|
-
|
866
|
-
allow_any_instance_of(::Asciidoctor::Standoc::Front)
|
867
|
-
|
868
|
-
|
1009
|
+
def mock_default_publisher
|
1010
|
+
allow_any_instance_of(::Asciidoctor::Standoc::Front)
|
1011
|
+
.to receive(:default_publisher).and_return(
|
1012
|
+
"International Standards Organization",
|
1013
|
+
)
|
869
1014
|
end
|
870
|
-
|
871
|
-
|
872
1015
|
end
|
873
|
-
|
874
|
-
|
875
|
-
|