metanorma-rsd 1.3.11 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42a45132215438e659d5a94aeca1b994e2866dc25e4430fc1b4a2b234223c035
4
- data.tar.gz: c30c2134bef3717dbe33c25b71622478ff897f9f2d5a1b8fe5e40e03fbd6d1a2
3
+ metadata.gz: 7a09eca0d2e987fc30077408e32647ec19a660285c6e00eeb0d8c5e218cd56a5
4
+ data.tar.gz: 84102bb82fa88c5e721e15fe5cb78f6184161483bfcb6313325e20839d4c1c45
5
5
  SHA512:
6
- metadata.gz: db9637f124dcba7b544c9caeabade267c831b8335e3e5bf058e26be2840b314eca861398321641286809bda22acf4ccd6fc73ef60db74e2f90b4ba1bd662a400
7
- data.tar.gz: 9e5837db5f2ff899ca643eb3a8b63f220b3e5836431babfd8f360fbfffa55d190a18369655d61735905c6f6ec5c6c3157c42f0ce1341415e6c496988f7c12a50
6
+ metadata.gz: c63154090df0b256658929536b65153241d26fa01b2649d9eb0483ebdbe23f4d10d2269fabdb1e0a8fd17faf71a836f300d6104a14bb0d0c754c4a345f31a361
7
+ data.tar.gz: ab6f1c38cf3d4168ef8461de0bc3739419eba3e213ae3fe846584411d91c24b29b5dfb8b2194d58c1dc23462236acf375c88e1722e1a2314c09cab6198b9ed12
@@ -1,7 +1,4 @@
1
1
  module Asciidoctor
2
2
  module Rsd
3
-
4
- RSD_NAMESPACE = "https://open.ribose.com/standards/rsd"
5
-
6
3
  end
7
4
  end
@@ -1,83 +1,14 @@
1
- require "asciidoctor"
2
- require "asciidoctor/rsd"
3
1
  require "asciidoctor/standoc/converter"
4
- require "isodoc/rsd/html_convert"
5
- require "isodoc/rsd/word_convert"
6
- require "fileutils"
7
- require_relative "validate"
2
+ require 'asciidoctor/acme/converter'
8
3
 
9
4
  module Asciidoctor
10
5
  module Rsd
11
-
12
6
  # A {Converter} implementation that generates RSD output, and a document
13
7
  # schema encapsulation of the document for validation
14
8
  #
15
- class Converter < Standoc::Converter
16
-
9
+ class Converter < Asciidoctor::Acme::Converter
17
10
  register_for "rsd"
18
11
 
19
- def initialize(backend, opts)
20
- super
21
- @libdir = File.dirname(__FILE__)
22
- end
23
-
24
- def metadata_author(node, xml)
25
- xml.contributor do |c|
26
- c.role **{ type: "author" }
27
- c.organization do |a|
28
- a.name "Ribose"
29
- end
30
- end
31
- end
32
-
33
- def metadata_publisher(node, xml)
34
- xml.contributor do |c|
35
- c.role **{ type: "publisher" }
36
- c.organization do |a|
37
- a.name "Ribose"
38
- end
39
- end
40
- end
41
-
42
- def metadata_committee(node, xml)
43
- return unless node.attr("committee")
44
- xml.editorialgroup do |a|
45
- a.committee node.attr("committee"),
46
- **attr_code(type: node.attr("committee-type"))
47
- i = 2
48
- while node.attr("committee_#{i}") do
49
- a.committee node.attr("committee_#{i}"),
50
- **attr_code(type: node.attr("committee-type_#{i}"))
51
- i += 1
52
- end
53
- end
54
- end
55
-
56
- def metadata_id(node, xml)
57
- docstatus = node.attr("status")
58
- dn = node.attr("docnumber")
59
- if docstatus
60
- abbr = IsoDoc::Rsd::Metadata.new("en", "Latn", {}).
61
- status_abbr(docstatus)
62
- dn = "#{dn}(#{abbr})" unless abbr.empty?
63
- end
64
- node.attr("copyright-year") and dn += ":#{node.attr("copyright-year")}"
65
- xml.docidentifier dn, **{type: "rsd"}
66
- xml.docnumber { |i| i << node.attr("docnumber") }
67
- end
68
-
69
- def metadata_copyright(node, xml)
70
- from = node.attr("copyright-year") || Date.today.year
71
- xml.copyright do |c|
72
- c.from from
73
- c.owner do |owner|
74
- owner.organization do |o|
75
- o.name "Ribose"
76
- end
77
- end
78
- end
79
- end
80
-
81
12
  def metadata_security(node, xml)
82
13
  security = node.attr("security") || return
83
14
  xml.security security
@@ -88,68 +19,8 @@ module Asciidoctor
88
19
  metadata_security(node, xml)
89
20
  end
90
21
 
91
- def title_validate(root)
92
- nil
93
- end
94
-
95
- def makexml(node)
96
- result = ["<?xml version='1.0' encoding='UTF-8'?>\n<rsd-standard>"]
97
- @draft = node.attributes.has_key?("draft")
98
- result << noko { |ixml| front node, ixml }
99
- result << noko { |ixml| middle node, ixml }
100
- result << "</rsd-standard>"
101
- result = textcleanup(result)
102
- ret1 = cleanup(Nokogiri::XML(result))
103
- validate(ret1) unless @novalid
104
- ret1.root.add_namespace(nil, RSD_NAMESPACE)
105
- ret1
106
- end
107
-
108
- def doctype(node)
109
- d = node.attr("doctype")
110
- unless %w{policy-and-procedures best-practices supporting-document
111
- report legal directives proposal standard}.include? d
112
- warn "#{d} is not a legal document type: reverting to 'standard'"
113
- d = "standard"
114
- end
115
- d
116
- end
117
-
118
- def document(node)
119
- init(node)
120
- ret1 = makexml(node)
121
- ret = ret1.to_xml(indent: 2)
122
- unless node.attr("nodoc") || !node.attr("docfile")
123
- filename = node.attr("docfile").gsub(/\.adoc/, ".xml").
124
- gsub(%r{^.*/}, "")
125
- File.open(filename, "w") { |f| f.write(ret) }
126
- html_converter(node).convert filename unless node.attr("nodoc")
127
- pdf_converter(node).convert filename unless node.attr("nodoc")
128
- word_converter(node).convert filename unless node.attr("nodoc")
129
- end
130
- @files_to_delete.each { |f| FileUtils.rm f }
131
- ret
132
- end
133
-
134
- def validate(doc)
135
- content_validate(doc)
136
- schema_validate(formattedstr_strip(doc.dup),
137
- File.join(File.dirname(__FILE__), "rsd.rng"))
138
- end
139
-
140
- def rsd_html_path(file)
141
- File.join(File.dirname(__FILE__), File.join("html", file))
142
- end
143
-
144
- def sections_cleanup(x)
145
- super
146
- x.xpath("//*[@inline-header]").each do |h|
147
- h.delete("inline-header")
148
- end
149
- end
150
-
151
- def style(n, t)
152
- return
22
+ def configuration
23
+ Metanorma::Rsd.configuration
153
24
  end
154
25
 
155
26
  def html_converter(node)
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar xmlns="http://relaxng.org/ns/structure/1.0">
2
+ <grammar ns="https://www.metanorma.org/ns/rsd" xmlns="http://relaxng.org/ns/structure/1.0">
3
3
  <!--
4
4
  Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
5
5
  we cannot have a new default namespace: we will end up with a grammar with two different
@@ -98,21 +98,26 @@ Ribose Group Inc.&nbsp;{{ docyear }}&nbsp;– All rights reserved<o:p></o:p></sp
98
98
  </div>
99
99
 
100
100
  <div style='mso-element:header' id=eh2>
101
-
102
101
  <p class=MsoHeader align=left style='text-align:left;line-height:12.0pt;
103
102
  mso-line-height-rule:exactly'><span lang=EN-GB>Ribose {{ doctype }}&nbsp;{{ docnumber }}:{{ docyear }}</span></p>
103
+ </div>
104
104
 
105
+ <div style='mso-element:header' id=eh2l>
106
+ <p class=MsoHeaderLandscape align=left style='text-align:left;line-height:12.0pt;
107
+ mso-line-height-rule:exactly'><span lang=EN-GB>Ribose {{ doctype }}&nbsp;{{ docnumber }}:{{ docyear }}</span></p>
105
108
  </div>
106
109
 
107
110
  <div style='mso-element:header' id=h2>
108
-
109
111
  <p class=MsoHeader align=right style='text-align:right;line-height:12.0pt;
110
112
  mso-line-height-rule:exactly'><span lang=EN-GB>Ribose {{ doctype }}&nbsp;{{ docnumber }}:{{ docyear }}</span></p>
113
+ </div>
111
114
 
115
+ <div style='mso-element:header' id=h2l>
116
+ <p class=MsoHeaderLandscape align=right style='text-align:right;line-height:12.0pt;
117
+ mso-line-height-rule:exactly'><span lang=EN-GB>Ribose {{ doctype }}&nbsp;{{ docnumber }}:{{ docyear }}</span></p>
112
118
  </div>
113
119
 
114
120
  <div style='mso-element:footer' id=ef2>
115
-
116
121
  <p class=MsoFooter style='line-height:12.0pt;mso-line-height-rule:exactly'><!--[if supportFields]><span
117
122
  lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
118
123
  style='mso-element:field-begin'></span><span
@@ -125,11 +130,24 @@ style='mso-element:field-end'></span></span><![endif]--><span lang=EN-GB
125
130
  style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span style='mso-tab-count:
126
131
  1'>                                                                                                                                                                           </span>©
127
132
  Ribose Group Inc.&nbsp;{{ docyear }}&nbsp;– All rights reserved<o:p></o:p></span></p>
133
+ </div>
128
134
 
135
+ <div style='mso-element:footer' id=ef2l>
136
+ <p class=MsoFooterLandscape style='line-height:12.0pt;mso-line-height-rule:exactly'><!--[if supportFields]><span
137
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
138
+ style='mso-element:field-begin'></span><span
139
+ style='mso-spacerun:yes'> </span>PAGE<span style='mso-spacerun:yes'>  
140
+ </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span></span><![endif]--><span
141
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
142
+ style='mso-no-proof:yes'>ii</span></span><!--[if supportFields]><span
143
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
144
+ style='mso-element:field-end'></span></span><![endif]--><span lang=EN-GB
145
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span style='mso-tab-count:
146
+ 1'>                                                                                                                                                                           </span>©
147
+ Ribose Group Inc.&nbsp;{{ docyear }}&nbsp;– All rights reserved<o:p></o:p></span></p>
129
148
  </div>
130
149
 
131
150
  <div style='mso-element:footer' id=f2>
132
-
133
151
  <p class=MsoFooter style='line-height:12.0pt'><span lang=EN-GB
134
152
  style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© Ribose Group Inc.&nbsp;{{ docyear }}&nbsp;– All
135
153
  rights reserved<span style='mso-tab-count:1'>                                                                                                                                                                          </span></span><!--[if supportFields]><span
@@ -141,11 +159,23 @@ style='mso-no-proof:yes'>iii</span></span><!--[if supportFields]><span
141
159
  lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
142
160
  style='mso-element:field-end'></span></span><![endif]--><span lang=EN-GB
143
161
  style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><o:p></o:p></span></p>
162
+ </div>
144
163
 
164
+ <div style='mso-element:footer' id=f2l>
165
+ <p class=MsoFooterLandscape style='line-height:12.0pt'><span lang=EN-GB
166
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© Ribose Group Inc.&nbsp;{{ docyear }}&nbsp;– All
167
+ rights reserved<span style='mso-tab-count:1'>                                                                                                                                                                          </span></span><!--[if supportFields]><span
168
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
169
+ style='mso-element:field-begin'></span> PAGE<span style='mso-spacerun:yes'>  
170
+ </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span></span><![endif]--><span
171
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
172
+ style='mso-no-proof:yes'>iii</span></span><!--[if supportFields]><span
173
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
174
+ style='mso-element:field-end'></span></span><![endif]--><span lang=EN-GB
175
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><o:p></o:p></span></p>
145
176
  </div>
146
177
 
147
178
  <div style='mso-element:footer' id=ef3>
148
-
149
179
  <p class=MsoFooter style='margin-top:12.0pt;line-height:12.0pt;mso-line-height-rule:
150
180
  exactly'><!--[if supportFields]><b style='mso-bidi-font-weight:normal'><span
151
181
  lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
@@ -159,11 +189,25 @@ mso-bidi-font-size:11.0pt'><span style='mso-element:field-end'></span></span></b
159
189
  lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
160
190
  style='mso-tab-count:1'>                                                                                                                                                                           </span>©
161
191
  Ribose Group Inc.&nbsp;{{ docyear }}&nbsp;– All rights reserved<o:p></o:p></span></p>
192
+ </div>
162
193
 
194
+ <div style='mso-element:footer' id=ef3l>
195
+ <p class=MsoFooterLandscape style='margin-top:12.0pt;line-height:12.0pt;mso-line-height-rule:
196
+ exactly'><!--[if supportFields]><b style='mso-bidi-font-weight:normal'><span
197
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
198
+ style='mso-element:field-begin'></span><span
199
+ style='mso-spacerun:yes'> </span>PAGE<span style='mso-spacerun:yes'>  
200
+ </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span></span></b><![endif]--><b
201
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
202
+ mso-bidi-font-size:11.0pt'><span style='mso-no-proof:yes'>2</span></span></b><!--[if supportFields]><b
203
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
204
+ mso-bidi-font-size:11.0pt'><span style='mso-element:field-end'></span></span></b><![endif]--><span
205
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
206
+ style='mso-tab-count:1'>                                                                                                                                                                           </span>©
207
+ Ribose Group Inc.&nbsp;{{ docyear }}&nbsp;– All rights reserved<o:p></o:p></span></p>
163
208
  </div>
164
209
 
165
210
  <div style='mso-element:footer' id=f3>
166
-
167
211
  <p class=MsoFooter style='line-height:12.0pt'><span lang=EN-GB
168
212
  style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© Ribose Group Inc.&nbsp;{{ docyear }}&nbsp;– All
169
213
  rights reserved<span style='mso-tab-count:1'>                                                                                                                                                                           </span></span><!--[if supportFields]><b
@@ -176,7 +220,21 @@ mso-bidi-font-size:11.0pt'><span style='mso-no-proof:yes'>3</span></span></b><!-
176
220
  style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
177
221
  mso-bidi-font-size:11.0pt'><span style='mso-element:field-end'></span></span></b><![endif]--><span
178
222
  lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><o:p></o:p></span></p>
223
+ </div>
179
224
 
225
+ <div style='mso-element:footer' id=f3l>
226
+ <p class=MsoFooterLandscape style='line-height:12.0pt'><span lang=EN-GB
227
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© Ribose Group Inc.&nbsp;{{ docyear }}&nbsp;– All
228
+ rights reserved<span style='mso-tab-count:1'>                                                                                                                                                                           </span></span><!--[if supportFields]><b
229
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
230
+ mso-bidi-font-size:11.0pt'><span style='mso-element:field-begin'></span>
231
+ PAGE<span style='mso-spacerun:yes'>   </span>\* MERGEFORMAT <span
232
+ style='mso-element:field-separator'></span></span></b><![endif]--><b
233
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
234
+ mso-bidi-font-size:11.0pt'><span style='mso-no-proof:yes'>3</span></span></b><!--[if supportFields]><b
235
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
236
+ mso-bidi-font-size:11.0pt'><span style='mso-element:field-end'></span></span></b><![endif]--><span
237
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><o:p></o:p></span></p>
180
238
  </div>
181
239
 
182
240
  </body>
@@ -583,10 +583,10 @@ div.WordSection1
583
583
  margin:39.7pt 53.85pt 1.0cm 53.85pt;
584
584
  mso-header-margin:50pt;
585
585
  mso-footer-margin:50pt;
586
- mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html") eh2;
587
- mso-header:url("file:///C:/Doc/FILENAME_files/header.html") h2;
588
- mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html") ef2;
589
- mso-footer:url("file:///C:/Doc/FILENAME_files/header.html") f2;
586
+ mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html") eh2l;
587
+ mso-header:url("file:///C:/Doc/FILENAME_files/header.html") h2l;
588
+ mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html") ef2l;
589
+ mso-footer:url("file:///C:/Doc/FILENAME_files/header.html") f2l;
590
590
  mso-paper-source:0;}
591
591
  @page WordSection2P
592
592
  {size:595.3pt 841.9pt;
@@ -616,10 +616,10 @@ div.WordSection2
616
616
  margin:39.7pt 53.85pt 1.0cm 53.85pt;
617
617
  mso-header-margin:50pt;
618
618
  mso-footer-margin:50pt;
619
- mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html") eh2;
620
- mso-header:url("file:///C:/Doc/FILENAME_files/header.html") h2;
621
- mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html") ef3;
622
- mso-footer:url("file:///C:/Doc/FILENAME_files/header.html") f3;
619
+ mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html") eh2l;
620
+ mso-header:url("file:///C:/Doc/FILENAME_files/header.html") h2l;
621
+ mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html") ef3l;
622
+ mso-footer:url("file:///C:/Doc/FILENAME_files/header.html") f3l;
623
623
  mso-paper-source:0;}
624
624
  @page WordSection3P
625
625
  {size:595.3pt 841.9pt;
@@ -158,6 +158,17 @@ p.MsoHeader, li.MsoHeader, div.MsoHeader
158
158
  mso-fareast-font-family:"Times New Roman";
159
159
  mso-ansi-language:EN-US;
160
160
  mso-fareast-language:EN-US;}
161
+ p.MsoHeaderLandscape, li.MsoHeaderLandscape, div.MsoHeaderLandscape
162
+ {mso-style-unhide:no;
163
+ margin:0cm;
164
+ margin-bottom:.0001pt;
165
+ mso-pagination:widow-orphan;
166
+ tab-stops:center 367.0pt right 734.0pt;
167
+ font-size:10.5pt;
168
+ font-family:$bodyfont;
169
+ mso-fareast-font-family:"Times New Roman";
170
+ mso-ansi-language:EN-US;
171
+ mso-fareast-language:EN-US;}
161
172
  p.MsoFooter, li.MsoFooter, div.MsoFooter
162
173
  {mso-style-unhide:no;
163
174
  margin:0cm;
@@ -169,6 +180,17 @@ p.MsoFooter, li.MsoFooter, div.MsoFooter
169
180
  mso-fareast-font-family:"Times New Roman";
170
181
  mso-ansi-language:EN-US;
171
182
  mso-fareast-language:EN-US;}
183
+ p.MsoFooterLandscape, li.MsoFooterLandscape, div.MsoFooterLandscape
184
+ {mso-style-unhide:no;
185
+ margin:0cm;
186
+ margin-bottom:.0001pt;
187
+ mso-pagination:widow-orphan;
188
+ tab-stops:right 734.0pt;
189
+ font-size:10.5pt;
190
+ font-family:$bodyfont;
191
+ mso-fareast-font-family:"Times New Roman";
192
+ mso-ansi-language:EN-US;
193
+ mso-fareast-language:EN-US;}
172
194
  span.MsoCommentReference
173
195
  {mso-style-noshow:yes;
174
196
  mso-style-unhide:no;
@@ -1,52 +1,25 @@
1
- require_relative "base_convert"
2
1
  require "isodoc"
2
+ require "isodoc/acme/html_convert"
3
+ require "isodoc/rsd/metadata"
3
4
 
4
5
  module IsoDoc
5
6
  module Rsd
6
-
7
7
  # A {Converter} implementation that generates HTML output, and a document
8
8
  # schema encapsulation of the document for validation
9
9
  #
10
- class HtmlConvert < IsoDoc::HtmlConvert
11
- def initialize(options)
12
- @libdir = File.dirname(__FILE__)
13
- super
14
- end
15
-
16
- def default_fonts(options)
17
- {
18
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
19
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Overpass",sans-serif'),
20
- monospacefont: '"Space Mono",monospace'
21
- }
10
+ class HtmlConvert < IsoDoc::Acme::HtmlConvert
11
+ def configuration
12
+ Metanorma::Rsd.configuration
22
13
  end
23
14
 
24
- def default_file_locations(_options)
25
- {
26
- htmlstylesheet: html_doc_path("htmlstyle.scss"),
27
- htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
28
- htmlintropage: html_doc_path("html_rsd_intro.html"),
29
- scripts: html_doc_path("scripts.html"),
30
- }
15
+ def metadata_init(lang, script, labels)
16
+ @meta = Metadata.new(lang, script, labels)
31
17
  end
32
18
 
33
- def googlefonts
34
- <<~HEAD.freeze
35
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
36
- <link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
37
- HEAD
38
- end
39
-
40
- def make_body(xml, docxml)
41
- body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
42
- xml.body **body_attr do |body|
43
- make_body1(body, docxml)
44
- make_body2(body, docxml)
45
- make_body3(body, docxml)
46
- end
19
+ def info(isoxml, out)
20
+ @meta.security isoxml, out
21
+ super
47
22
  end
48
-
49
- include BaseConvert
50
23
  end
51
24
  end
52
25
  end
@@ -3,45 +3,14 @@ require "isodoc"
3
3
  module IsoDoc
4
4
  module Rsd
5
5
 
6
- class Metadata < IsoDoc::Metadata
7
- def initialize(lang, script, labels)
8
- super
9
- here = File.dirname(__FILE__)
10
- set(:logo_svg,
11
- File.expand_path(File.join(here, "html", "logo.svg")))
12
- end
13
-
14
- def title(isoxml, _out)
15
- main = isoxml&.at(ns("//bibdata/title[@language='en']"))&.text
16
- set(:doctitle, main)
17
- end
18
-
19
- def subtitle(_isoxml, _out)
20
- nil
6
+ class Metadata < IsoDoc::Acme::Metadata
7
+ def configuration
8
+ Metanorma::Rsd.configuration
21
9
  end
22
10
 
23
- def author(isoxml, _out)
24
- tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
25
- set(:tc, tc.text) if tc
26
- end
27
-
28
- def docid(isoxml, _out)
29
- docnumber = isoxml.at(ns("//bibdata/docidentifier"))
30
- set(:docnumber, docnumber&.text)
31
- end
32
-
33
- def status_abbr(status)
34
- case status
35
- when "working-draft" then "wd"
36
- when "committee-draft" then "cd"
37
- when "draft-standard" then "d"
38
- else
39
- ""
40
- end
41
- end
42
-
43
- def unpublished(status)
44
- !%w(published withdrawn).include? status.downcase
11
+ def security(isoxml, _out)
12
+ security = isoxml.at(ns("//bibdata/ext/security")) || return
13
+ set(:security, security.text)
45
14
  end
46
15
 
47
16
  def version(isoxml, _out)
@@ -70,11 +39,6 @@ module IsoDoc
70
39
  return isodate unless m && m[:yr] && m[:mo]
71
40
  return "#{MONTHS[m[:mo].to_sym]} #{m[:yr]}"
72
41
  end
73
-
74
- def security(isoxml, _out)
75
- security = isoxml.at(ns("//bibdata/ext/security")) || return
76
- set(:security, security.text)
77
- end
78
42
  end
79
43
  end
80
44
  end
@@ -1,54 +1,24 @@
1
- require_relative "base_convert"
2
1
  require "isodoc"
2
+ require "isodoc/acme/pdf_convert"
3
+ require "isodoc/rsd/metadata"
3
4
 
4
5
  module IsoDoc
5
6
  module Rsd
6
7
  # A {Converter} implementation that generates PDF HTML output, and a
7
8
  # document schema encapsulation of the document for validation
8
- class PdfConvert < IsoDoc::PdfConvert
9
- def initialize(options)
10
- @libdir = File.dirname(__FILE__)
11
- super
12
- end
13
-
14
- def default_fonts(options)
15
- {
16
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
17
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Overpass",sans-serif'),
18
- monospacefont: '"Space Mono",monospace'
19
- }
20
- end
21
-
22
- def default_file_locations(options)
23
- {
24
- htmlstylesheet: html_doc_path("htmlstyle.scss"),
25
- htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
26
- htmlintropage: html_doc_path("html_rsd_intro.html"),
27
- scripts_pdf: html_doc_path("scripts.pdf.html"),
28
- }
9
+ class PdfConvert < IsoDoc::Acme::PdfConvert
10
+ def configuration
11
+ Metanorma::Rsd.configuration
29
12
  end
30
13
 
31
- def googlefonts()
32
- <<~HEAD.freeze
33
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
34
- <link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
35
- HEAD
14
+ def metadata_init(lang, script, labels)
15
+ @meta = Metadata.new(lang, script, labels)
36
16
  end
37
17
 
38
- def make_body(xml, docxml)
39
- body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
40
- xml.body **body_attr do |body|
41
- make_body1(body, docxml)
42
- make_body2(body, docxml)
43
- make_body3(body, docxml)
44
- end
45
- end
46
-
47
- def html_toc(docxml)
48
- docxml
18
+ def info(isoxml, out)
19
+ @meta.security isoxml, out
20
+ super
49
21
  end
50
-
51
- include BaseConvert
52
22
  end
53
23
  end
54
24
  end
@@ -1,48 +1,24 @@
1
- require_relative "base_convert"
2
1
  require "isodoc"
2
+ require "isodoc/acme/word_convert"
3
+ require "isodoc/rsd/metadata"
3
4
 
4
5
  module IsoDoc
5
6
  module Rsd
6
7
  # A {Converter} implementation that generates Word output, and a document
7
8
  # schema encapsulation of the document for validation
8
-
9
- class WordConvert < IsoDoc::WordConvert
10
- def initialize(options)
11
- @libdir = File.dirname(__FILE__)
12
- super
13
- end
14
-
15
- def default_fonts(options)
16
- {
17
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Arial",sans-serif'),
18
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Arial",sans-serif'),
19
- monospacefont: '"Courier New",monospace'
20
- }
9
+ class WordConvert < IsoDoc::Acme::WordConvert
10
+ def configuration
11
+ Metanorma::Rsd.configuration
21
12
  end
22
13
 
23
- def default_file_locations(options)
24
- {
25
- wordstylesheet: html_doc_path("wordstyle.scss"),
26
- standardstylesheet: html_doc_path("rsd.scss"),
27
- header: html_doc_path("header.html"),
28
- wordcoverpage: html_doc_path("word_rsd_titlepage.html"),
29
- wordintropage: html_doc_path("word_rsd_intro.html"),
30
- ulstyle: "l3",
31
- olstyle: "l2",
32
- }
14
+ def metadata_init(lang, script, labels)
15
+ @meta = Metadata.new(lang, script, labels)
33
16
  end
34
17
 
35
-
36
- def make_body(xml, docxml)
37
- body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
38
- xml.body **body_attr do |body|
39
- make_body1(body, docxml)
40
- make_body2(body, docxml)
41
- make_body3(body, docxml)
42
- end
18
+ def info(isoxml, out)
19
+ @meta.security isoxml, out
20
+ super
43
21
  end
44
-
45
- include BaseConvert
46
22
  end
47
23
  end
48
24
  end
data/lib/metanorma/rsd.rb CHANGED
@@ -1,7 +1,32 @@
1
- require_relative "./rsd/processor"
1
+ require "metanorma"
2
+ require "metanorma-acme"
3
+ require "metanorma/rsd/processor"
2
4
 
3
5
  module Metanorma
4
6
  module Rsd
5
7
 
8
+ class Configuration < Metanorma::Acme::Configuration
9
+ def initialize(*args)
10
+ super
11
+ end
12
+ end
13
+
14
+ class << self
15
+ extend Forwardable
16
+
17
+ attr_accessor :configuration
18
+
19
+ Configuration::CONFIG_ATTRS.each do |attr_name|
20
+ def_delegator :@configuration, attr_name
21
+ end
22
+
23
+ def configure
24
+ self.configuration ||= Configuration.new
25
+ yield(configuration)
26
+ end
27
+ end
28
+
29
+ configure {}
6
30
  end
7
31
  end
32
+ Metanorma::Registry.instance.register(Metanorma::Rsd::Processor)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Rsd
3
- VERSION = "1.3.11"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  #spec.add_dependency "nokogiri"
33
33
  spec.add_dependency "metanorma-standoc", "~> 1.3.0"
34
34
  spec.add_dependency "isodoc", "~> 1.0.0"
35
+ spec.add_dependency 'metanorma-acme', '~> 1.4.0'
35
36
 
36
37
  spec.add_development_dependency "byebug", "~> 9.1"
37
38
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
data/metanorma.yml ADDED
@@ -0,0 +1,23 @@
1
+ organization_name_short: Ribose
2
+ organization_name_long: Ribose
3
+ document_namespace: https://www.metanorma.org/ns/rsd
4
+ xml_root_tag: 'rsd-standard'
5
+ logo_path: lib/isodoc/rsd/html/logo.svg
6
+ validate_rng_file: lib/asciidoctor/rsd/rsd.rng
7
+ htmlcoverpage: lib/isodoc/rsd/html/html_rsd_titlepage.html
8
+ htmlintropage: lib/isodoc/rsd/html/html_rsd_intro.html
9
+ htmlstylesheet: lib/isodoc/rsd/html/htmlstyle.scss
10
+ scripts: lib/isodoc/rsd/html/scripts.html
11
+ scripts_pdf: lib/isodoc/rsd/html/scripts.pdf.html
12
+ standardstylesheet: lib/isodoc/rsd/html/rsd.scss
13
+ header: lib/isodoc/rsd/html/header.html
14
+ wordcoverpage: lib/isodoc/rsd/html/word_rsd_titlepage.html
15
+ wordintropage: lib/isodoc/rsd/html/word_rsd_intro.html
16
+ wordstylesheet: lib/isodoc/rsd/html/wordstyle.scss
17
+ docid_template: "{{ docnumeric }}{% if stageabbr %}({{ stageabbr }}){%endif%}"
18
+ published_stages:
19
+ - published
20
+ stage_abbreviations:
21
+ working-draft: wd
22
+ committee-draft: cd
23
+ draft-standard: d
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-rsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.11
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-30 00:00:00.000000000 Z
11
+ date: 2020-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: metanorma-acme
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.4.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.4.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: byebug
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -227,7 +241,6 @@ files:
227
241
  - lib/asciidoctor/rsd/reqt.rng
228
242
  - lib/asciidoctor/rsd/rsd.rng
229
243
  - lib/asciidoctor/rsd/validate.rb
230
- - lib/isodoc/rsd/base_convert.rb
231
244
  - lib/isodoc/rsd/html/header.html
232
245
  - lib/isodoc/rsd/html/html_rsd_intro.html
233
246
  - lib/isodoc/rsd/html/html_rsd_titlepage.html
@@ -248,6 +261,7 @@ files:
248
261
  - lib/metanorma/rsd/processor.rb
249
262
  - lib/metanorma/rsd/version.rb
250
263
  - metanorma-rsd.gemspec
264
+ - metanorma.yml
251
265
  homepage: https://github.com/metanorma/metanorma-rsd
252
266
  licenses:
253
267
  - BSD-2-Clause
@@ -1,56 +0,0 @@
1
- require_relative "metadata"
2
- require "fileutils"
3
-
4
- module IsoDoc
5
- module Rsd
6
- module BaseConvert
7
- #def convert1(docxml, filename, dir)
8
- #FileUtils.cp html_doc_path('logo.svg'), File.join(@localdir, "logo.svg")
9
- #@files_to_delete << File.join(@localdir, "logo.svg")
10
- #super
11
- #end
12
-
13
- def metadata_init(lang, script, labels)
14
- @meta = Metadata.new(lang, script, labels)
15
- end
16
-
17
- def annex_name(annex, name, div)
18
- div.h1 **{ class: "Annex" } do |t|
19
- t << "#{anchor(annex['id'], :label)} "
20
- t.br
21
- t.b do |b|
22
- name&.children&.each { |c2| parse(c2, b) }
23
- end
24
- end
25
- end
26
-
27
- def i18n_init(lang, script)
28
- super
29
- @annex_lbl = "Appendix"
30
- end
31
-
32
- def fileloc(loc)
33
- File.join(File.dirname(__FILE__), loc)
34
- end
35
-
36
- def cleanup(docxml)
37
- super
38
- term_cleanup(docxml)
39
- end
40
-
41
- def term_cleanup(docxml)
42
- docxml.xpath("//p[@class = 'Terms']").each do |d|
43
- h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
44
- h2.add_child("&nbsp;")
45
- h2.add_child(d.remove)
46
- end
47
- docxml
48
- end
49
-
50
- def info(isoxml, out)
51
- @meta.security isoxml, out
52
- super
53
- end
54
- end
55
- end
56
- end