asciidoctor-m3d 0.2.5 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +7 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +44 -29
- data/asciidoctor-m3d.gemspec +3 -2
- data/lib/asciidoctor-m3d.rb +2 -1
- data/lib/asciidoctor/m3d/biblio.rng +35 -6
- data/lib/asciidoctor/m3d/converter.rb +39 -24
- data/lib/asciidoctor/m3d/isodoc.rng +1 -1
- data/lib/asciidoctor/m3d/isostandard.rng +64 -15
- data/lib/asciidoctor/m3d/m3d.rng +43 -23
- data/lib/asciidoctor/m3d/version.rb +1 -1
- data/lib/isodoc/m3d/html/dots-w@2x.png +0 -0
- data/lib/isodoc/m3d/html/dots@2x.png +0 -0
- data/lib/isodoc/m3d/html/header.html +219 -0
- data/lib/isodoc/m3d/html/html_m3d_intro.html +14 -0
- data/lib/isodoc/m3d/html/html_m3d_titlepage.html +95 -0
- data/lib/isodoc/m3d/html/htmlstyle.scss +940 -0
- data/lib/isodoc/m3d/html/m3d.scss +697 -0
- data/lib/isodoc/m3d/html/scripts.html +82 -0
- data/lib/isodoc/m3d/html/word_m3d_intro.html +10 -0
- data/lib/isodoc/m3d/html/word_m3d_titlepage.html +58 -0
- data/lib/isodoc/m3d/html/wordstyle.scss +1003 -0
- data/lib/isodoc/m3d/m3dhtmlconvert.rb +142 -0
- data/lib/isodoc/m3d/m3dhtmlrender.rb +68 -0
- data/lib/isodoc/m3d/m3dwordconvert.rb +88 -0
- data/lib/isodoc/m3d/m3wordrender.rb +68 -0
- data/lib/isodoc/m3d/metadata.rb +82 -0
- metadata +24 -8
- data/lib/asciidoctor/m3d/m3dconvert.rb +0 -135
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-m3d
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -156,28 +156,28 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.
|
159
|
+
version: 0.8.0
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.
|
166
|
+
version: 0.8.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: isodoc
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 0.7.0
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 0.7.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: bundler
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -329,6 +329,7 @@ extensions: []
|
|
329
329
|
extra_rdoc_files: []
|
330
330
|
files:
|
331
331
|
- ".gitignore"
|
332
|
+
- ".travis.yml"
|
332
333
|
- CODE_OF_CONDUCT.md
|
333
334
|
- Gemfile
|
334
335
|
- Gemfile.lock
|
@@ -354,8 +355,23 @@ files:
|
|
354
355
|
- lib/asciidoctor/m3d/isodoc.rng
|
355
356
|
- lib/asciidoctor/m3d/isostandard.rng
|
356
357
|
- lib/asciidoctor/m3d/m3d.rng
|
357
|
-
- lib/asciidoctor/m3d/m3dconvert.rb
|
358
358
|
- lib/asciidoctor/m3d/version.rb
|
359
|
+
- lib/isodoc/m3d/html/dots-w@2x.png
|
360
|
+
- lib/isodoc/m3d/html/dots@2x.png
|
361
|
+
- lib/isodoc/m3d/html/header.html
|
362
|
+
- lib/isodoc/m3d/html/html_m3d_intro.html
|
363
|
+
- lib/isodoc/m3d/html/html_m3d_titlepage.html
|
364
|
+
- lib/isodoc/m3d/html/htmlstyle.scss
|
365
|
+
- lib/isodoc/m3d/html/m3d.scss
|
366
|
+
- lib/isodoc/m3d/html/scripts.html
|
367
|
+
- lib/isodoc/m3d/html/word_m3d_intro.html
|
368
|
+
- lib/isodoc/m3d/html/word_m3d_titlepage.html
|
369
|
+
- lib/isodoc/m3d/html/wordstyle.scss
|
370
|
+
- lib/isodoc/m3d/m3dhtmlconvert.rb
|
371
|
+
- lib/isodoc/m3d/m3dhtmlrender.rb
|
372
|
+
- lib/isodoc/m3d/m3dwordconvert.rb
|
373
|
+
- lib/isodoc/m3d/m3wordrender.rb
|
374
|
+
- lib/isodoc/m3d/metadata.rb
|
359
375
|
homepage: https://github.com/riboseinc/asciidoctor-m3d
|
360
376
|
licenses:
|
361
377
|
- MIT
|
@@ -376,7 +392,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
376
392
|
version: '0'
|
377
393
|
requirements: []
|
378
394
|
rubyforge_project:
|
379
|
-
rubygems_version: 2.6
|
395
|
+
rubygems_version: 2.7.6
|
380
396
|
signing_key:
|
381
397
|
specification_version: 4
|
382
398
|
summary: asciidoctor-m3d lets you write M3AAWG Documents (M3D) in AsciiDoc.
|
@@ -1,135 +0,0 @@
|
|
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(/</, "<").gsub(/>/, ">")
|
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
|
-
|