asciidoctor-gb 0.2.4 → 0.2.5
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 -1
- data/Gemfile.lock +18 -14
- data/asciidoctor-gb.gemspec +1 -0
- data/lib/asciidoctor-gb.rb +1 -0
- data/lib/asciidoctor/gb/biblio.rng +19 -3
- data/lib/asciidoctor/gb/converter.rb +3 -2
- data/lib/asciidoctor/gb/gbstandard.rng +10 -3
- data/lib/asciidoctor/gb/isodoc.rng +1 -1
- data/lib/asciidoctor/gb/isostandard.rng +63 -14
- data/lib/asciidoctor/gb/section_input.rb +2 -0
- data/lib/asciidoctor/gb/validate.rb +1 -1
- data/lib/asciidoctor/gb/version.rb +1 -1
- data/lib/isodoc/gb/agencies.rb +16 -8
- data/lib/isodoc/gb/gbcleanup.rb +6 -3
- data/lib/isodoc/gb/gbconvert.rb +22 -112
- data/lib/isodoc/gb/gbhtmlconvert.rb +73 -0
- data/lib/isodoc/gb/gbhtmlrender.rb +206 -0
- data/lib/isodoc/gb/gbwordconvert.rb +69 -6
- data/lib/isodoc/gb/gbwordrender.rb +206 -0
- data/lib/isodoc/gb/html/htmlstyle.scss +1 -1
- data/lib/isodoc/gb/metadata.rb +57 -56
- metadata +21 -7
- data/lib/isodoc/gb/block_output.rb +0 -86
- data/lib/isodoc/gb/i18n.rb +0 -20
- data/lib/isodoc/gb/section_output.rb +0 -57
- data/lib/isodoc/gb/xref_gen.rb +0 -17
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-gb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
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-06-
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor-iso
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.7.9
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: isodoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.7.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.7.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: twitter_cldr
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,6 +208,7 @@ files:
|
|
194
208
|
- ".rubocop.ribose.yml"
|
195
209
|
- ".rubocop.tb.yml"
|
196
210
|
- ".rubocop.yml"
|
211
|
+
- ".travis.yml"
|
197
212
|
- CODE_OF_CONDUCT.md
|
198
213
|
- Gemfile
|
199
214
|
- Gemfile.lock
|
@@ -248,10 +263,12 @@ files:
|
|
248
263
|
- lib/asciidoctor/gb/validate.rb
|
249
264
|
- lib/asciidoctor/gb/version.rb
|
250
265
|
- lib/isodoc/gb/agencies.rb
|
251
|
-
- lib/isodoc/gb/block_output.rb
|
252
266
|
- lib/isodoc/gb/gbcleanup.rb
|
253
267
|
- lib/isodoc/gb/gbconvert.rb
|
268
|
+
- lib/isodoc/gb/gbhtmlconvert.rb
|
269
|
+
- lib/isodoc/gb/gbhtmlrender.rb
|
254
270
|
- lib/isodoc/gb/gbwordconvert.rb
|
271
|
+
- lib/isodoc/gb/gbwordrender.rb
|
255
272
|
- lib/isodoc/gb/html/blank.png
|
256
273
|
- lib/isodoc/gb/html/footer.png
|
257
274
|
- lib/isodoc/gb/html/gb-logos/gb-issuer-default.gif
|
@@ -287,10 +304,7 @@ files:
|
|
287
304
|
- lib/isodoc/gb/html/wordstyle.scss
|
288
305
|
- lib/isodoc/gb/i18n-en.yaml
|
289
306
|
- lib/isodoc/gb/i18n-zh-Hans.yaml
|
290
|
-
- lib/isodoc/gb/i18n.rb
|
291
307
|
- lib/isodoc/gb/metadata.rb
|
292
|
-
- lib/isodoc/gb/section_output.rb
|
293
|
-
- lib/isodoc/gb/xref_gen.rb
|
294
308
|
homepage: https://github.com/riboseinc/asciidoctor-gb
|
295
309
|
licenses:
|
296
310
|
- MIT
|
@@ -311,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
311
325
|
version: '0'
|
312
326
|
requirements: []
|
313
327
|
rubyforge_project:
|
314
|
-
rubygems_version: 2.6
|
328
|
+
rubygems_version: 2.7.6
|
315
329
|
signing_key:
|
316
330
|
specification_version: 4
|
317
331
|
summary: asciidoctor-gb lets you write GB standards in AsciiDoc.
|
@@ -1,86 +0,0 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
module Gb
|
3
|
-
# A {Converter} implementation that generates GB output, and a document
|
4
|
-
# schema encapsulation of the document for validation
|
5
|
-
class Convert < IsoDoc::Convert
|
6
|
-
def formula_parse(node, out)
|
7
|
-
out.div **attr_code(id: node["id"], class: "formula") do |div|
|
8
|
-
insert_tab(div, 1)
|
9
|
-
parse(node.at(ns("./stem")), out)
|
10
|
-
insert_tab(div, 1)
|
11
|
-
div << "(#{get_anchors[node['id']][:label]})"
|
12
|
-
end
|
13
|
-
formula_where(node.at(ns("./dl")), out)
|
14
|
-
end
|
15
|
-
|
16
|
-
def formula_where(dl, out)
|
17
|
-
return unless dl
|
18
|
-
out.p { |p| p << @where_lbl }
|
19
|
-
formula_dl_parse(dl, out)
|
20
|
-
end
|
21
|
-
|
22
|
-
def formula_dl_parse(node, out)
|
23
|
-
out.table **{ class: "dl" } do |v|
|
24
|
-
node.elements.each_slice(2) do |dt, dd|
|
25
|
-
v.tr do |tr|
|
26
|
-
tr.td **{ valign: "top", align: "left" } do |term|
|
27
|
-
dt_parse(dt, term)
|
28
|
-
end
|
29
|
-
tr.td **{ valign: "top" } { |td| td << "—" }
|
30
|
-
tr.td **{ valign: "top" } do |listitem|
|
31
|
-
dd.children.each { |n| parse(n, listitem) }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
EXAMPLE_TBL_ATTR =
|
39
|
-
{ valign: "top", class: "example_label",
|
40
|
-
style: "padding:2pt 2pt 2pt 2pt" }.freeze
|
41
|
-
|
42
|
-
def example_parse(node, out)
|
43
|
-
out.table **attr_code(id: node["id"], class: "example") do |t|
|
44
|
-
t.tr do |tr|
|
45
|
-
tr.td **EXAMPLE_TBL_ATTR do |td|
|
46
|
-
td << l10n(example_label(node) + ":")
|
47
|
-
end
|
48
|
-
tr.td **{ valign: "top", class: "example" } do |td|
|
49
|
-
node.children.each { |n| parse(n, td) }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def note_parse(node, out)
|
56
|
-
@note = true
|
57
|
-
out.table **attr_code(id: node["id"], class: "Note") do |t|
|
58
|
-
t.tr do |tr|
|
59
|
-
tr.td **EXAMPLE_TBL_ATTR do |td|
|
60
|
-
td << l10n(note_label(node) + ":")
|
61
|
-
end
|
62
|
-
tr.td **{ valign: "top", class: "Note" } do |td|
|
63
|
-
node.children.each { |n| parse(n, td) }
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
@note = false
|
68
|
-
end
|
69
|
-
|
70
|
-
def termnote_parse(node, out)
|
71
|
-
@note = true
|
72
|
-
out.table **attr_code(id: node["id"], class: "Note") do |t|
|
73
|
-
t.tr do |tr|
|
74
|
-
tr.td **EXAMPLE_TBL_ATTR do |td|
|
75
|
-
td << l10n("#{get_anchors[node['id']][:label]}:")
|
76
|
-
end
|
77
|
-
tr.td **{ valign: "top", class: "Note" } do |td|
|
78
|
-
node.children.each { |n| parse(n, td) }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
@note = false
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
data/lib/isodoc/gb/i18n.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require "yaml"
|
2
|
-
|
3
|
-
module IsoDoc
|
4
|
-
module Gb
|
5
|
-
class Convert < IsoDoc::Convert
|
6
|
-
def i18n_init(lang, script)
|
7
|
-
super
|
8
|
-
y = if lang == "en"
|
9
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
10
|
-
elsif lang == "zh" && script == "Hans"
|
11
|
-
YAML.load_file(File.join(File.dirname(__FILE__),
|
12
|
-
"i18n-zh-Hans.yaml"))
|
13
|
-
else
|
14
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-zh-Hans.yaml"))
|
15
|
-
end
|
16
|
-
@labels = @labels.merge(y)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
module Gb
|
3
|
-
class Convert < IsoDoc::Convert
|
4
|
-
# putting in tab so that ToC aligns
|
5
|
-
def foreword(isoxml, out)
|
6
|
-
f = isoxml.at(ns("//foreword")) || return
|
7
|
-
page_break(out)
|
8
|
-
out.div do |s|
|
9
|
-
s.h1 **{ class: "ForewordTitle" } do |h1|
|
10
|
-
h1 << "#{@foreword_lbl} "
|
11
|
-
# insert_tab(h1, 1)
|
12
|
-
end
|
13
|
-
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def clause_name(num, title, div, header_class)
|
18
|
-
header_class = {} if header_class.nil?
|
19
|
-
div.h1 **attr_code(header_class) do |h1|
|
20
|
-
if num
|
21
|
-
h1 << num
|
22
|
-
h1 << " "
|
23
|
-
end
|
24
|
-
h1 << title
|
25
|
-
end
|
26
|
-
div.parent.at(".//h1")
|
27
|
-
end
|
28
|
-
|
29
|
-
def clause_parse_title(node, div, c1, out)
|
30
|
-
if node["inline-header"] == "true"
|
31
|
-
inline_header_title(out, node, c1)
|
32
|
-
else
|
33
|
-
div.send "h#{get_anchors[node['id']][:level]}" do |h|
|
34
|
-
h << "#{get_anchors[node['id']][:label]}. "
|
35
|
-
c1.children.each { |c2| parse(c2, h) }
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def annex_name(annex, name, div)
|
41
|
-
div.h1 **{ class: "Annex" } do |t|
|
42
|
-
t << "#{get_anchors[annex['id']][:label]}<br/><br/>"
|
43
|
-
t << name.text
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def term_defs_boilerplate(div, source, term, preface)
|
48
|
-
if source.empty? && term.nil?
|
49
|
-
div << @no_terms_boilerplate
|
50
|
-
else
|
51
|
-
div << term_defs_boilerplate_cont(source, term)
|
52
|
-
end
|
53
|
-
div << @term_def_boilerplate unless preface
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/lib/isodoc/gb/xref_gen.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require "isodoc"
|
2
|
-
|
3
|
-
module Isodoc
|
4
|
-
module Gb
|
5
|
-
# A {Converter} implementation that generates GB output, and a document
|
6
|
-
# schema encapsulation of the document for validation
|
7
|
-
class Convert < IsoDoc::Convert
|
8
|
-
def reference_names(ref)
|
9
|
-
isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
|
10
|
-
docid = ref.at(ns("./docidentifier"))
|
11
|
-
date = ref.at(ns("./date[@type = 'published']"))
|
12
|
-
reference = format_ref(docid.text, isopub, date)
|
13
|
-
@anchors[ref["id"]] = { xref: reference }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|