asciidoctor-m3d 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,134 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <!--
4
+ default namespace = "https://open.ribose.com/standards/m3d"
5
+ Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
6
+ we cannot have a new default namespace: we will end up with a grammar with two different
7
+ namespaces, one for isostandard and one for m3d additions. And we do not want that.
8
+ -->
9
+ <include href="isostandard.rng">
10
+ <start>
11
+ <ref name="m3d-standard"/>
12
+ </start>
13
+ <define name="language">
14
+ <element name="language">
15
+ <value>en</value>
16
+ </element>
17
+ </define>
18
+ <define name="docidentifier">
19
+ <element name="docidentifier">
20
+ <text/>
21
+ </element>
22
+ </define>
23
+ <define name="btitle">
24
+ <element name="title">
25
+ <ref name="FormattedString"/>
26
+ </element>
27
+ </define>
28
+ <define name="status">
29
+ <element name="status">
30
+ <choice>
31
+ <value>proposal</value>
32
+ <value>working-draft</value>
33
+ <value>committee-draft</value>
34
+ <value>draft-standard</value>
35
+ <value>final-draft</value>
36
+ <value>published</value>
37
+ <value>withdrawn</value>
38
+ </choice>
39
+ </element>
40
+ </define>
41
+ <define name="figure">
42
+ <element name="figure">
43
+ <attribute name="id">
44
+ <data type="ID"/>
45
+ </attribute>
46
+ <optional>
47
+ <ref name="source"/>
48
+ </optional>
49
+ <optional>
50
+ <ref name="tname"/>
51
+ </optional>
52
+ <choice>
53
+ <oneOrMore>
54
+ <ref name="figure"/>
55
+ </oneOrMore>
56
+ <group>
57
+ <choice>
58
+ <zeroOrMore>
59
+ <ref name="TextElement"/>
60
+ </zeroOrMore>
61
+ <ref name="pre"/>
62
+ </choice>
63
+ <zeroOrMore>
64
+ <ref name="note"/>
65
+ </zeroOrMore>
66
+ <optional>
67
+ <ref name="dl"/>
68
+ </optional>
69
+ </group>
70
+ </choice>
71
+ </element>
72
+ </define>
73
+ <!-- TextElement |= keyword -->
74
+ <define name="TextElement">
75
+ <choice>
76
+ <text/>
77
+ <ref name="em"/>
78
+ <ref name="eref"/>
79
+ <ref name="strong"/>
80
+ <ref name="stem"/>
81
+ <ref name="sub"/>
82
+ <ref name="sup"/>
83
+ <ref name="tt"/>
84
+ <ref name="strike"/>
85
+ <ref name="smallcap"/>
86
+ <ref name="xref"/>
87
+ <ref name="br"/>
88
+ <ref name="hyperlink"/>
89
+ <ref name="hr"/>
90
+ <ref name="pagebreak"/>
91
+ <ref name="bookmark"/>
92
+ <ref name="keyword"/>
93
+ </choice>
94
+ </define>
95
+ </include>
96
+ <define name="BibItemType" combine="choice">
97
+ <choice>
98
+ <value>code</value>
99
+ <value>presentation</value>
100
+ <value>proposal</value>
101
+ <value>standard</value>
102
+ <value>report</value>
103
+ </choice>
104
+ </define>
105
+ <define name="pre">
106
+ <element name="pre">
107
+ <text/>
108
+ </element>
109
+ </define>
110
+ <define name="keyword">
111
+ <element name="keyword">
112
+ <text/>
113
+ </element>
114
+ </define>
115
+ <define name="m3d-standard">
116
+ <element name="m3d-standard">
117
+ <ref name="bibdata"/>
118
+ <optional>
119
+ <ref name="version"/>
120
+ </optional>
121
+ <zeroOrMore>
122
+ <ref name="termdocsource"/>
123
+ </zeroOrMore>
124
+ <ref name="preface"/>
125
+ <oneOrMore>
126
+ <ref name="sections"/>
127
+ </oneOrMore>
128
+ <zeroOrMore>
129
+ <ref name="annex"/>
130
+ </zeroOrMore>
131
+ <ref name="bibliography"/>
132
+ </element>
133
+ </define>
134
+ </grammar>
@@ -0,0 +1,135 @@
1
+ require "isodoc"
2
+
3
+ module Asciidoctor
4
+ module M3d
5
+ # A {Converter} implementation that generates M3D output, and a document
6
+ # schema encapsulation of the document for validation
7
+ class M3dConvert < IsoDoc::Convert
8
+ def initialize(options)
9
+ super
10
+ set_metadata(:status, "XXX")
11
+ end
12
+
13
+ def init_metadata
14
+ super
15
+ end
16
+
17
+ def title(isoxml, _out)
18
+ main = isoxml&.at(ns("//title[@language='en']"))&.text
19
+ set_metadata(:doctitle, main)
20
+ end
21
+
22
+ def subtitle(_isoxml, _out)
23
+ nil
24
+ end
25
+
26
+ def author(isoxml, _out)
27
+ set_metadata(:tc, "XXXX")
28
+ tc = isoxml.at(ns("//editorialgroup/technical-committee"))
29
+ set_metadata(:tc, tc.text) if tc
30
+ end
31
+
32
+
33
+ def docid(isoxml, _out)
34
+ docnumber = isoxml.at(ns("//bibdata/docidentifier"))
35
+ docstatus = isoxml.at(ns("//bibdata/status"))
36
+ dn = docnumber&.text
37
+ if docstatus
38
+ set_metadata(:status, status_print(docstatus.text))
39
+ abbr = status_abbr(docstatus.text)
40
+ dn = "#{dn}(#{abbr})" unless abbr.empty?
41
+ end
42
+ set_metadata(:docnumber, dn)
43
+ end
44
+
45
+ def status_print(status)
46
+ status.split(/-/).map{ |w| w.capitalize }.join(" ")
47
+ end
48
+
49
+ def status_abbr(status)
50
+ case status
51
+ when "working-draft" then "wd"
52
+ when "committee-draft" then "cd"
53
+ when "draft-standard" then "d"
54
+ else
55
+ ""
56
+ end
57
+ end
58
+
59
+ def pre_parse(node, out)
60
+ out.pre node.text # content.gsub(/</, "&lt;").gsub(/>/, "&gt;")
61
+ end
62
+
63
+ def term_defs_boilerplate(div, source, term)
64
+ if source.empty? && term.nil?
65
+ div << @no_terms_boilerplate
66
+ else
67
+ div << term_defs_boilerplate_cont(source, term)
68
+ end
69
+ end
70
+
71
+ def i18n_init(lang, script)
72
+ super
73
+ @annex_lbl = "Appendix"
74
+ end
75
+
76
+ def error_parse(node, out)
77
+ # catch elements not defined in ISO
78
+ case node.name
79
+ when "pre"
80
+ pre_parse(node, out)
81
+ when "keyword"
82
+ out.span node.text, **{ class: "keyword" }
83
+ else
84
+ super
85
+ end
86
+ end
87
+
88
+ HEAD = <<~HEAD.freeze
89
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
90
+
91
+ <!--TOC script import-->
92
+ <script type="text/javascript" src="https://cdn.rawgit.com/jgallen23/toc/0.3.2/dist/toc.min.js"></script>
93
+
94
+ <!--Google fonts-->
95
+ <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
96
+ <link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
97
+ <!--Font awesome import for the link icon-->
98
+ <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous">
99
+ <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous">
100
+ HEAD
101
+
102
+ BUTTON = '<button onclick="topFunction()" id="myBtn" '\
103
+ 'title="Go to top">Top</button>'.freeze
104
+
105
+
106
+ def html_main(docxml)
107
+ d = docxml.at('//div[@class="WordSection3"]')
108
+ s = d.replace("<main></main>")
109
+ s.first.children = d
110
+ s.first.children.first.previous = BUTTON
111
+ end
112
+
113
+ def html_preface(docxml)
114
+ super
115
+ docxml.at("//head").add_child(HEAD)
116
+ html_main(docxml)
117
+ docxml
118
+ end
119
+
120
+ def make_body(xml, docxml)
121
+ body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
122
+ xml.body **body_attr do |body|
123
+ make_body1(body, docxml)
124
+ make_body2(body, docxml)
125
+ make_body3(body, docxml)
126
+ end
127
+ end
128
+
129
+ def html_toc(docxml)
130
+ docxml
131
+ end
132
+ end
133
+ end
134
+ end
135
+
@@ -0,0 +1,5 @@
1
+ module Asciidoctor
2
+ module M3d
3
+ VERSION = "0.2.5"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,383 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asciidoctor-m3d
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.5
5
+ platform: ruby
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-05-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: asciidoctor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.5.7
27
+ - !ruby/object:Gem::Dependency
28
+ name: asciimath
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: htmlentities
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 4.3.4
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 4.3.4
55
+ - !ruby/object:Gem::Dependency
56
+ name: image_size
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mime-types
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: ruby-jing
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: ruby-xslt
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: thread_safe
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: uuidtools
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: asciidoctor-iso
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: 0.7.5
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: 0.7.5
167
+ - !ruby/object:Gem::Dependency
168
+ name: isodoc
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: bundler
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1.15'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.15'
195
+ - !ruby/object:Gem::Dependency
196
+ name: byebug
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '9.1'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '9.1'
209
+ - !ruby/object:Gem::Dependency
210
+ name: equivalent-xml
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '0.6'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '0.6'
223
+ - !ruby/object:Gem::Dependency
224
+ name: guard
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '2.14'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: '2.14'
237
+ - !ruby/object:Gem::Dependency
238
+ name: guard-rspec
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: '4.7'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: '4.7'
251
+ - !ruby/object:Gem::Dependency
252
+ name: rake
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - "~>"
256
+ - !ruby/object:Gem::Version
257
+ version: '12.0'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - "~>"
263
+ - !ruby/object:Gem::Version
264
+ version: '12.0'
265
+ - !ruby/object:Gem::Dependency
266
+ name: rspec
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - "~>"
270
+ - !ruby/object:Gem::Version
271
+ version: '3.6'
272
+ type: :development
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - "~>"
277
+ - !ruby/object:Gem::Version
278
+ version: '3.6'
279
+ - !ruby/object:Gem::Dependency
280
+ name: rubocop
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - "~>"
284
+ - !ruby/object:Gem::Version
285
+ version: '0.50'
286
+ type: :development
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - "~>"
291
+ - !ruby/object:Gem::Version
292
+ version: '0.50'
293
+ - !ruby/object:Gem::Dependency
294
+ name: simplecov
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - "~>"
298
+ - !ruby/object:Gem::Version
299
+ version: '0.15'
300
+ type: :development
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - "~>"
305
+ - !ruby/object:Gem::Version
306
+ version: '0.15'
307
+ - !ruby/object:Gem::Dependency
308
+ name: timecop
309
+ requirement: !ruby/object:Gem::Requirement
310
+ requirements:
311
+ - - "~>"
312
+ - !ruby/object:Gem::Version
313
+ version: '0.9'
314
+ type: :development
315
+ prerelease: false
316
+ version_requirements: !ruby/object:Gem::Requirement
317
+ requirements:
318
+ - - "~>"
319
+ - !ruby/object:Gem::Version
320
+ version: '0.9'
321
+ description: |
322
+ asciidoctor-m3d lets you write M3AAWG Documents (M3D) in AsciiDoc syntax.
323
+
324
+ This gem is in active development.
325
+ email:
326
+ - open.source@ribose.com
327
+ executables: []
328
+ extensions: []
329
+ extra_rdoc_files: []
330
+ files:
331
+ - ".gitignore"
332
+ - CODE_OF_CONDUCT.md
333
+ - Gemfile
334
+ - Gemfile.lock
335
+ - LICENSE
336
+ - README.adoc
337
+ - Rakefile
338
+ - asciidoctor-m3d.gemspec
339
+ - bin/console
340
+ - bin/rspec
341
+ - bin/setup
342
+ - lib/asciidoctor-m3d.rb
343
+ - lib/asciidoctor/m3d.rb
344
+ - lib/asciidoctor/m3d/biblio.rng
345
+ - lib/asciidoctor/m3d/converter.rb
346
+ - lib/asciidoctor/m3d/html/dots-w@2x.png
347
+ - lib/asciidoctor/m3d/html/dots@2x.png
348
+ - lib/asciidoctor/m3d/html/header.html
349
+ - lib/asciidoctor/m3d/html/html_m3d_intro.html
350
+ - lib/asciidoctor/m3d/html/html_m3d_titlepage.html
351
+ - lib/asciidoctor/m3d/html/htmlstyle.scss
352
+ - lib/asciidoctor/m3d/html/m3d.scss
353
+ - lib/asciidoctor/m3d/html/scripts.html
354
+ - lib/asciidoctor/m3d/isodoc.rng
355
+ - lib/asciidoctor/m3d/isostandard.rng
356
+ - lib/asciidoctor/m3d/m3d.rng
357
+ - lib/asciidoctor/m3d/m3dconvert.rb
358
+ - lib/asciidoctor/m3d/version.rb
359
+ homepage: https://github.com/riboseinc/asciidoctor-m3d
360
+ licenses:
361
+ - MIT
362
+ metadata: {}
363
+ post_install_message:
364
+ rdoc_options: []
365
+ require_paths:
366
+ - lib
367
+ required_ruby_version: !ruby/object:Gem::Requirement
368
+ requirements:
369
+ - - ">="
370
+ - !ruby/object:Gem::Version
371
+ version: '0'
372
+ required_rubygems_version: !ruby/object:Gem::Requirement
373
+ requirements:
374
+ - - ">="
375
+ - !ruby/object:Gem::Version
376
+ version: '0'
377
+ requirements: []
378
+ rubyforge_project:
379
+ rubygems_version: 2.6.14
380
+ signing_key:
381
+ specification_version: 4
382
+ summary: asciidoctor-m3d lets you write M3AAWG Documents (M3D) in AsciiDoc.
383
+ test_files: []