metanorma-rsd 1.1.4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -10
- data/appveyor.yml +7 -2
- data/lib/asciidoctor/rsd/biblio.rng +44 -15
- data/lib/asciidoctor/rsd/converter.rb +3 -5
- data/lib/asciidoctor/rsd/isodoc.rng +128 -71
- data/lib/asciidoctor/rsd/isostandard.rng +29 -304
- data/lib/asciidoctor/rsd/reqt.rng +5 -0
- data/lib/asciidoctor/rsd/rsd.rng +6 -83
- data/lib/asciidoctor/rsd/validate.rb +22 -0
- data/lib/isodoc/rsd/base_convert.rb +64 -0
- data/lib/isodoc/rsd/html/html_rsd_titlepage.html +4 -4
- data/lib/isodoc/rsd/html/word_rsd_titlepage.html +1 -1
- data/lib/isodoc/rsd/html_convert.rb +2 -57
- data/lib/isodoc/rsd/metadata.rb +2 -3
- data/lib/isodoc/rsd/pdf_convert.rb +2 -57
- data/lib/isodoc/rsd/word_convert.rb +2 -56
- data/lib/metanorma/rsd/version.rb +1 -1
- data/metanorma-rsd.gemspec +3 -2
- metadata +10 -8
@@ -0,0 +1,22 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module Rsd
|
3
|
+
class Converter < Standoc::Converter
|
4
|
+
def content_validate(doc)
|
5
|
+
super
|
6
|
+
bibdata_validate(doc.root)
|
7
|
+
end
|
8
|
+
|
9
|
+
def bibdata_validate(doc)
|
10
|
+
stage_validate(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
def stage_validate(xmldoc)
|
14
|
+
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
15
|
+
%w(proposal working-draft committee-draft draft-standard final-draft
|
16
|
+
published withdrawn).include? stage or
|
17
|
+
warn "Document Attributes: #{stage} is not a recognised status"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,64 @@
|
|
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 term_defs_boilerplate(div, source, term, preface)
|
28
|
+
if source.empty? && term.nil?
|
29
|
+
div << @no_terms_boilerplate
|
30
|
+
else
|
31
|
+
div << term_defs_boilerplate_cont(source, term)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def i18n_init(lang, script)
|
36
|
+
super
|
37
|
+
@annex_lbl = "Appendix"
|
38
|
+
end
|
39
|
+
|
40
|
+
def fileloc(loc)
|
41
|
+
File.join(File.dirname(__FILE__), loc)
|
42
|
+
end
|
43
|
+
|
44
|
+
def cleanup(docxml)
|
45
|
+
super
|
46
|
+
term_cleanup(docxml)
|
47
|
+
end
|
48
|
+
|
49
|
+
def term_cleanup(docxml)
|
50
|
+
docxml.xpath("//p[@class = 'Terms']").each do |d|
|
51
|
+
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
|
52
|
+
h2.add_child(" ")
|
53
|
+
h2.add_child(d.remove)
|
54
|
+
end
|
55
|
+
docxml
|
56
|
+
end
|
57
|
+
|
58
|
+
def info(isoxml, out)
|
59
|
+
@meta.security isoxml, out
|
60
|
+
super
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<div class="document-stage-band" id='{{
|
2
|
-
<p class="document-stage">{{
|
1
|
+
<div class="document-stage-band" id='{{ stage | downcase | replace: " ", "-" }}-band'>
|
2
|
+
<p class="document-stage">{{ stage }}</p>
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<div class="document-type-band" id='{{ doctype | downcase | replace: " ", "-" }}-band'>
|
@@ -45,9 +45,9 @@
|
|
45
45
|
</div>
|
46
46
|
|
47
47
|
<div class="coverpage-stage-block" >
|
48
|
-
<p><span class="coverpage-maturity" id="{{
|
48
|
+
<p><span class="coverpage-maturity" id="{{ stage | replace: ' ', '-' | downcase }}">
|
49
49
|
{%- if unpublished -%}
|
50
|
-
{{-
|
50
|
+
{{- stage -}}
|
51
51
|
{%- else -%}
|
52
52
|
{%- if publisheddate and publisheddate != "XXXX" -%}
|
53
53
|
Published {{ publisheddate -}}
|
@@ -18,7 +18,7 @@ margin-left:4.25pt;margin-right:4.25pt'>
|
|
18
18
|
<p class="MsoNormal" align="center" style='text-align:center;border:none;
|
19
19
|
mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span
|
20
20
|
lang="EN-GB" style='font-size:16.0pt'>{%- if unpublished -%}
|
21
|
-
{{-
|
21
|
+
{{- stage -}}
|
22
22
|
{%- else -%}
|
23
23
|
{%- if publisheddate and publisheddate != "XXXX" -%}
|
24
24
|
Published {{ publisheddate -}}
|
@@ -1,6 +1,5 @@
|
|
1
|
+
require_relative "base_convert"
|
1
2
|
require "isodoc"
|
2
|
-
require_relative "metadata"
|
3
|
-
require "fileutils"
|
4
3
|
|
5
4
|
module IsoDoc
|
6
5
|
module Rsd
|
@@ -14,12 +13,6 @@ module IsoDoc
|
|
14
13
|
super
|
15
14
|
end
|
16
15
|
|
17
|
-
def convert1(docxml, filename, dir)
|
18
|
-
FileUtils.cp html_doc_path('logo.svg'), File.join(@localdir, "logo.svg")
|
19
|
-
@files_to_delete << File.join(@localdir, "logo.svg")
|
20
|
-
super
|
21
|
-
end
|
22
|
-
|
23
16
|
def default_fonts(options)
|
24
17
|
{
|
25
18
|
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
|
@@ -37,10 +30,6 @@ module IsoDoc
|
|
37
30
|
}
|
38
31
|
end
|
39
32
|
|
40
|
-
def metadata_init(lang, script, labels)
|
41
|
-
@meta = Metadata.new(lang, script, labels)
|
42
|
-
end
|
43
|
-
|
44
33
|
def googlefonts
|
45
34
|
<<~HEAD.freeze
|
46
35
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
|
@@ -61,51 +50,7 @@ module IsoDoc
|
|
61
50
|
docxml
|
62
51
|
end
|
63
52
|
|
64
|
-
|
65
|
-
div.h1 **{ class: "Annex" } do |t|
|
66
|
-
t << "#{get_anchors[annex['id']][:label]} "
|
67
|
-
t.br
|
68
|
-
t.b do |b|
|
69
|
-
name&.children&.each { |c2| parse(c2, b) }
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def term_defs_boilerplate(div, source, term, preface)
|
75
|
-
if source.empty? && term.nil?
|
76
|
-
div << @no_terms_boilerplate
|
77
|
-
else
|
78
|
-
div << term_defs_boilerplate_cont(source, term)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def i18n_init(lang, script)
|
83
|
-
super
|
84
|
-
@annex_lbl = "Appendix"
|
85
|
-
end
|
86
|
-
|
87
|
-
def fileloc(loc)
|
88
|
-
File.join(File.dirname(__FILE__), loc)
|
89
|
-
end
|
90
|
-
|
91
|
-
def cleanup(docxml)
|
92
|
-
super
|
93
|
-
term_cleanup(docxml)
|
94
|
-
end
|
95
|
-
|
96
|
-
def term_cleanup(docxml)
|
97
|
-
docxml.xpath("//p[@class = 'Terms']").each do |d|
|
98
|
-
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
|
99
|
-
h2.add_child(" ")
|
100
|
-
h2.add_child(d.remove)
|
101
|
-
end
|
102
|
-
docxml
|
103
|
-
end
|
104
|
-
|
105
|
-
def info(isoxml, out)
|
106
|
-
@meta.security isoxml, out
|
107
|
-
super
|
108
|
-
end
|
53
|
+
include BaseConvert
|
109
54
|
end
|
110
55
|
end
|
111
56
|
end
|
data/lib/isodoc/rsd/metadata.rb
CHANGED
@@ -6,7 +6,6 @@ module IsoDoc
|
|
6
6
|
class Metadata < IsoDoc::Metadata
|
7
7
|
def initialize(lang, script, labels)
|
8
8
|
super
|
9
|
-
set(:status, "XXX")
|
10
9
|
end
|
11
10
|
|
12
11
|
def title(isoxml, _out)
|
@@ -19,7 +18,7 @@ module IsoDoc
|
|
19
18
|
end
|
20
19
|
|
21
20
|
def author(isoxml, _out)
|
22
|
-
tc = isoxml.at(ns("//bibdata/editorialgroup/committee"))
|
21
|
+
tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
|
23
22
|
set(:tc, tc.text) if tc
|
24
23
|
end
|
25
24
|
|
@@ -70,7 +69,7 @@ module IsoDoc
|
|
70
69
|
end
|
71
70
|
|
72
71
|
def security(isoxml, _out)
|
73
|
-
security = isoxml.at(ns("//bibdata/security")) || return
|
72
|
+
security = isoxml.at(ns("//bibdata/ext/security")) || return
|
74
73
|
set(:security, security.text)
|
75
74
|
end
|
76
75
|
end
|
@@ -1,6 +1,5 @@
|
|
1
|
+
require_relative "base_convert"
|
1
2
|
require "isodoc"
|
2
|
-
require_relative "metadata"
|
3
|
-
require "fileutils"
|
4
3
|
|
5
4
|
module IsoDoc
|
6
5
|
module Rsd
|
@@ -12,12 +11,6 @@ module IsoDoc
|
|
12
11
|
super
|
13
12
|
end
|
14
13
|
|
15
|
-
def convert1(docxml, filename, dir)
|
16
|
-
FileUtils.cp html_doc_path('logo.svg'), File.join(@localdir, "logo.svg")
|
17
|
-
@files_to_delete << File.join(@localdir, "logo.svg")
|
18
|
-
super
|
19
|
-
end
|
20
|
-
|
21
14
|
def default_fonts(options)
|
22
15
|
{
|
23
16
|
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
|
@@ -35,10 +28,6 @@ module IsoDoc
|
|
35
28
|
}
|
36
29
|
end
|
37
30
|
|
38
|
-
def metadata_init(lang, script, labels)
|
39
|
-
@meta = Metadata.new(lang, script, labels)
|
40
|
-
end
|
41
|
-
|
42
31
|
def googlefonts()
|
43
32
|
<<~HEAD.freeze
|
44
33
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
|
@@ -59,51 +48,7 @@ module IsoDoc
|
|
59
48
|
docxml
|
60
49
|
end
|
61
50
|
|
62
|
-
|
63
|
-
div.h1 **{ class: "Annex" } do |t|
|
64
|
-
t << "#{get_anchors[annex['id']][:label]} "
|
65
|
-
t.br
|
66
|
-
t.b do |b|
|
67
|
-
name&.children&.each { |c2| parse(c2, b) }
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def term_defs_boilerplate(div, source, term, preface)
|
73
|
-
if source.empty? && term.nil?
|
74
|
-
div << @no_terms_boilerplate
|
75
|
-
else
|
76
|
-
div << term_defs_boilerplate_cont(source, term)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def i18n_init(lang, script)
|
81
|
-
super
|
82
|
-
@annex_lbl = "Appendix"
|
83
|
-
end
|
84
|
-
|
85
|
-
def fileloc(loc)
|
86
|
-
File.join(File.dirname(__FILE__), loc)
|
87
|
-
end
|
88
|
-
|
89
|
-
def cleanup(docxml)
|
90
|
-
super
|
91
|
-
term_cleanup(docxml)
|
92
|
-
end
|
93
|
-
|
94
|
-
def term_cleanup(docxml)
|
95
|
-
docxml.xpath("//p[@class = 'Terms']").each do |d|
|
96
|
-
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
|
97
|
-
h2.add_child(" ")
|
98
|
-
h2.add_child(d.remove)
|
99
|
-
end
|
100
|
-
docxml
|
101
|
-
end
|
102
|
-
|
103
|
-
def info(isoxml, out)
|
104
|
-
@meta.security isoxml, out
|
105
|
-
super
|
106
|
-
end
|
51
|
+
include BaseConvert
|
107
52
|
end
|
108
53
|
end
|
109
54
|
end
|
@@ -1,6 +1,5 @@
|
|
1
|
+
require_relative "base_convert"
|
1
2
|
require "isodoc"
|
2
|
-
require_relative "metadata"
|
3
|
-
require "fileutils"
|
4
3
|
|
5
4
|
module IsoDoc
|
6
5
|
module Rsd
|
@@ -13,12 +12,6 @@ module IsoDoc
|
|
13
12
|
super
|
14
13
|
end
|
15
14
|
|
16
|
-
def convert1(docxml, filename, dir)
|
17
|
-
FileUtils.cp html_doc_path('logo.svg'), File.join(@localdir, "logo.svg")
|
18
|
-
@files_to_delete << File.join(@localdir, "logo.svg")
|
19
|
-
super
|
20
|
-
end
|
21
|
-
|
22
15
|
def default_fonts(options)
|
23
16
|
{
|
24
17
|
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Arial",sans-serif'),
|
@@ -39,9 +32,6 @@ module IsoDoc
|
|
39
32
|
}
|
40
33
|
end
|
41
34
|
|
42
|
-
def metadata_init(lang, script, labels)
|
43
|
-
@meta = Metadata.new(lang, script, labels)
|
44
|
-
end
|
45
35
|
|
46
36
|
def make_body(xml, docxml)
|
47
37
|
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
|
@@ -52,51 +42,7 @@ module IsoDoc
|
|
52
42
|
end
|
53
43
|
end
|
54
44
|
|
55
|
-
|
56
|
-
@meta.security isoxml, out
|
57
|
-
super
|
58
|
-
end
|
59
|
-
|
60
|
-
def annex_name(annex, name, div)
|
61
|
-
div.h1 **{ class: "Annex" } do |t|
|
62
|
-
t << "#{get_anchors[annex['id']][:label]} "
|
63
|
-
t.br
|
64
|
-
t.b do |b|
|
65
|
-
name&.children&.each { |c2| parse(c2, b) }
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def term_defs_boilerplate(div, source, term, preface)
|
71
|
-
if source.empty? && term.nil?
|
72
|
-
div << @no_terms_boilerplate
|
73
|
-
else
|
74
|
-
div << term_defs_boilerplate_cont(source, term)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def i18n_init(lang, script)
|
79
|
-
super
|
80
|
-
@annex_lbl = "Appendix"
|
81
|
-
end
|
82
|
-
|
83
|
-
def fileloc(loc)
|
84
|
-
File.join(File.dirname(__FILE__), loc)
|
85
|
-
end
|
86
|
-
|
87
|
-
def cleanup(docxml)
|
88
|
-
super
|
89
|
-
term_cleanup(docxml)
|
90
|
-
end
|
91
|
-
|
92
|
-
def term_cleanup(docxml)
|
93
|
-
docxml.xpath("//p[@class = 'Terms']").each do |d|
|
94
|
-
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
|
95
|
-
h2.add_child(" ")
|
96
|
-
h2.add_child(d.remove)
|
97
|
-
end
|
98
|
-
docxml
|
99
|
-
end
|
45
|
+
include BaseConvert
|
100
46
|
end
|
101
47
|
end
|
102
48
|
end
|
data/metanorma-rsd.gemspec
CHANGED
@@ -26,12 +26,13 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.bindir = "exe"
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
29
30
|
|
30
31
|
spec.add_dependency "asciidoctor", "~> 1.5.7"
|
31
32
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
32
33
|
spec.add_dependency "nokogiri"
|
33
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
34
|
-
spec.add_dependency "isodoc", "~> 0.
|
34
|
+
spec.add_dependency "metanorma-standoc", "~> 1.2.0"
|
35
|
+
spec.add_dependency "isodoc", "~> 0.10.0"
|
35
36
|
|
36
37
|
spec.add_development_dependency "byebug", "~> 9.1"
|
37
38
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
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.
|
4
|
+
version: 1.2.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: 2019-
|
11
|
+
date: 2019-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.2.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.2.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: isodoc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.10.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.10.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: byebug
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,6 +252,8 @@ files:
|
|
252
252
|
- lib/asciidoctor/rsd/isostandard.rng
|
253
253
|
- lib/asciidoctor/rsd/reqt.rng
|
254
254
|
- lib/asciidoctor/rsd/rsd.rng
|
255
|
+
- lib/asciidoctor/rsd/validate.rb
|
256
|
+
- lib/isodoc/rsd/base_convert.rb
|
255
257
|
- lib/isodoc/rsd/html/header.html
|
256
258
|
- lib/isodoc/rsd/html/html_rsd_intro.html
|
257
259
|
- lib/isodoc/rsd/html/html_rsd_titlepage.html
|
@@ -284,7 +286,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
284
286
|
requirements:
|
285
287
|
- - ">="
|
286
288
|
- !ruby/object:Gem::Version
|
287
|
-
version:
|
289
|
+
version: 2.4.0
|
288
290
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
289
291
|
requirements:
|
290
292
|
- - ">="
|
@@ -292,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
294
|
version: '0'
|
293
295
|
requirements: []
|
294
296
|
rubyforge_project:
|
295
|
-
rubygems_version: 2.7.
|
297
|
+
rubygems_version: 2.7.7
|
296
298
|
signing_key:
|
297
299
|
specification_version: 4
|
298
300
|
summary: metanorma-rsd lets you write RSD in AsciiDoc.
|