metanorma-ribose 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/macos.yml +42 -0
  3. data/.github/workflows/ubuntu.yml +42 -0
  4. data/.github/workflows/windows.yml +44 -0
  5. data/.gitignore +1 -0
  6. data/.hound.yml +3 -0
  7. data/.rubocop.yml +10 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +11 -0
  10. data/LICENSE +25 -0
  11. data/README.adoc +70 -0
  12. data/Rakefile +6 -0
  13. data/bin/console +14 -0
  14. data/bin/rspec +18 -0
  15. data/bin/setup +8 -0
  16. data/lib/asciidoctor/ribose.rb +4 -0
  17. data/lib/asciidoctor/ribose/basicdoc.rng +1059 -0
  18. data/lib/asciidoctor/ribose/biblio.rng +1237 -0
  19. data/lib/asciidoctor/ribose/boilerplate.xml +47 -0
  20. data/lib/asciidoctor/ribose/converter.rb +76 -0
  21. data/lib/asciidoctor/ribose/isodoc.rng +1504 -0
  22. data/lib/asciidoctor/ribose/reqt.rng +194 -0
  23. data/lib/asciidoctor/ribose/rsd.rng +79 -0
  24. data/lib/isodoc/ribose/base_convert.rb +36 -0
  25. data/lib/isodoc/ribose/html/header.html +242 -0
  26. data/lib/isodoc/ribose/html/html_rsd_intro.html +8 -0
  27. data/lib/isodoc/ribose/html/html_rsd_titlepage.html +90 -0
  28. data/lib/isodoc/ribose/html/htmlstyle.scss +751 -0
  29. data/lib/isodoc/ribose/html/logo.png +0 -0
  30. data/lib/isodoc/ribose/html/logo.svg +1 -0
  31. data/lib/isodoc/ribose/html/rsd.scss +760 -0
  32. data/lib/isodoc/ribose/html/scripts.html +71 -0
  33. data/lib/isodoc/ribose/html/word_rsd_intro.html +8 -0
  34. data/lib/isodoc/ribose/html/word_rsd_titlepage.html +119 -0
  35. data/lib/isodoc/ribose/html/wordstyle.scss +1170 -0
  36. data/lib/isodoc/ribose/html_convert.rb +34 -0
  37. data/lib/isodoc/ribose/metadata.rb +18 -0
  38. data/lib/isodoc/ribose/pdf_convert.rb +20 -0
  39. data/lib/isodoc/ribose/presentation_xml_convert.rb +11 -0
  40. data/lib/isodoc/ribose/rsd.standard.xsl +7076 -0
  41. data/lib/isodoc/ribose/word_convert.rb +31 -0
  42. data/lib/isodoc/ribose/xref.rb +31 -0
  43. data/lib/metanorma-ribose.rb +14 -0
  44. data/lib/metanorma/ribose.rb +32 -0
  45. data/lib/metanorma/ribose/processor.rb +42 -0
  46. data/lib/metanorma/ribose/version.rb +5 -0
  47. data/metanorma-ribose.gemspec +46 -0
  48. data/metanorma.yml +36 -0
  49. metadata +277 -0
@@ -0,0 +1,31 @@
1
+ require "isodoc"
2
+ require "isodoc/generic/word_convert"
3
+ require "isodoc/ribose/metadata"
4
+
5
+ module IsoDoc
6
+ module Ribose
7
+ # A {Converter} implementation that generates Word output, and a document
8
+ # schema encapsulation of the document for validation
9
+ class WordConvert < IsoDoc::Generic::WordConvert
10
+ def configuration
11
+ Metanorma::Ribose.configuration
12
+ end
13
+
14
+ def make_body2(body, docxml)
15
+ body.div **{ class: "WordSection2" } do |div2|
16
+ boilerplate docxml, div2
17
+ abstract docxml, div2
18
+ foreword docxml, div2
19
+ executivesummary docxml, div2
20
+ introduction docxml, div2
21
+ preface docxml, div2
22
+ acknowledgements docxml, div2
23
+ div2.p { |p| p << "&nbsp;" } # placeholder
24
+ end
25
+ section_break(body)
26
+ end
27
+
28
+ include BaseConvert
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ require "metanorma-generic"
2
+
3
+ module IsoDoc
4
+ module Ribose
5
+ class Xref < IsoDoc::Generic::Xref
6
+ def annex_name_lbl(clause, num)
7
+ obl = l10n("(#{@labels['inform_annex']})")
8
+ obl = l10n("(#{@labels['norm_annex']})") if clause["obligation"] == "normative"
9
+ l10n("#{@labels['annex']} #{num}<br/>#{obl}")
10
+ end
11
+
12
+ def initial_anchor_names(d)
13
+ preface_names(d.at(ns("//executivesummary")))
14
+ super
15
+ sequential_asset_names(
16
+ d.xpath(ns("//preface/abstract | //foreword | //introduction | "\
17
+ "//preface/clause | //acknowledgements | //executivesummary")))
18
+ end
19
+
20
+ def section_names1(clause, num, level)
21
+ @anchors[clause["id"]] =
22
+ { label: num, level: level, xref: num }
23
+ # subclauses are not prefixed with "Clause"
24
+ clause.xpath(ns("./clause | ./terms | ./term | ./definitions | ./references")).
25
+ each_with_index do |c, i|
26
+ section_names1(c, "#{num}.#{i + 1}", level + 1)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,14 @@
1
+ require "asciidoctor" unless defined? Asciidoctor::Converter
2
+ require_relative "asciidoctor/ribose/converter"
3
+ require_relative "isodoc/ribose/base_convert"
4
+ require_relative "isodoc/ribose/html_convert"
5
+ require_relative "isodoc/ribose/word_convert"
6
+ require_relative "isodoc/ribose/pdf_convert"
7
+ require_relative "isodoc/ribose/presentation_xml_convert"
8
+ require_relative "isodoc/ribose/xref"
9
+ require_relative "metanorma/ribose/version"
10
+
11
+ if defined? Metanorma
12
+ require_relative "metanorma/ribose"
13
+ Metanorma::Registry.instance.register(Metanorma::Ribose::Processor)
14
+ end
@@ -0,0 +1,32 @@
1
+ require "metanorma"
2
+ require "metanorma-generic"
3
+ require "metanorma/ribose/processor"
4
+
5
+ module Metanorma
6
+ module Ribose
7
+
8
+ class Configuration < Metanorma::Generic::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 {}
30
+ end
31
+ end
32
+ Metanorma::Registry.instance.register(Metanorma::Ribose::Processor)
@@ -0,0 +1,42 @@
1
+ require "metanorma/processor"
2
+
3
+ module Metanorma
4
+ module Ribose
5
+ class Processor < Metanorma::Generic::Processor
6
+ def configuration
7
+ Metanorma::Ribose.configuration
8
+ end
9
+
10
+ def output_formats
11
+ super.merge(
12
+ html: "html",
13
+ doc: "doc",
14
+ pdf: "pdf"
15
+ )
16
+ end
17
+
18
+ def version
19
+ "Metanorma::Ribose #{Metanorma::Ribose::VERSION}"
20
+ end
21
+
22
+ def input_to_isodoc(file, filename)
23
+ Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
24
+ end
25
+
26
+ def output(isodoc_node, inname, outname, format, options={})
27
+ case format
28
+ when :html
29
+ IsoDoc::Ribose::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
30
+ when :doc
31
+ IsoDoc::Ribose::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
32
+ when :pdf
33
+ IsoDoc::Ribose::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
34
+ when :presentation
35
+ IsoDoc::Ribose::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
36
+ else
37
+ super
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,5 @@
1
+ module Metanorma
2
+ module Ribose
3
+ VERSION = "1.5.0"
4
+ end
5
+ end
@@ -0,0 +1,46 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "metanorma/ribose/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "metanorma-ribose"
7
+ spec.version = Metanorma::Ribose::VERSION
8
+ spec.authors = ["Ribose Inc."]
9
+ spec.email = ["open.source@ribose.com"]
10
+
11
+ spec.summary = "metanorma-ribose lets you write Ribose standards in AsciiDoc."
12
+ spec.description = <<~DESCRIPTION
13
+ metanorma-ribose lets you write Ribose standards in AsciiDoc syntax.
14
+
15
+ This gem is in active development.
16
+
17
+ Formerly known as asciidoctor-rsd, metanorma-rsd.
18
+ DESCRIPTION
19
+
20
+ spec.homepage = "https://github.com/metanorma/metanorma-ribose"
21
+ spec.license = "BSD-2-Clause"
22
+
23
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
24
+ f.match(%r{^(test|spec|features)/})
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
30
+
31
+ spec.add_dependency "htmlentities", "~> 4.3.4"
32
+ #spec.add_dependency "nokogiri"
33
+ spec.add_dependency "metanorma-standoc", "~> 1.4.0"
34
+ spec.add_dependency "isodoc", "~> 1.1.0"
35
+ spec.add_dependency 'metanorma-generic', '~> 1.5.0'
36
+
37
+ spec.add_development_dependency "byebug", "~> 9.1"
38
+ spec.add_development_dependency "equivalent-xml", "~> 0.6"
39
+ spec.add_development_dependency "guard", "~> 2.14"
40
+ spec.add_development_dependency "guard-rspec", "~> 4.7"
41
+ spec.add_development_dependency "rake", "~> 12.0"
42
+ spec.add_development_dependency "rspec", "~> 3.6"
43
+ spec.add_development_dependency "rubocop", "= 0.54.0"
44
+ spec.add_development_dependency "simplecov", "~> 0.15"
45
+ spec.add_development_dependency "timecop", "~> 0.9"
46
+ end
@@ -0,0 +1,36 @@
1
+ metanorma_name: ribose
2
+ organization_name_short: Ribose
3
+ organization_name_long: Ribose
4
+ document_namespace: https://www.metanorma.org/ns/rsd
5
+ xml_root_tag: 'rsd-standard'
6
+ logo_path: lib/isodoc/ribose/html/logo.png
7
+ validate_rng_file: lib/asciidoctor/ribose/rsd.rng
8
+ htmlcoverpage: lib/isodoc/ribose/html/html_rsd_titlepage.html
9
+ htmlintropage: lib/isodoc/ribose/html/html_rsd_intro.html
10
+ htmlstylesheet: lib/isodoc/ribose/html/htmlstyle.scss
11
+ html_bodyfont: '"Source Sans Pro",sans-serif'
12
+ html_headerfont: '"Source Sans Pro",sans-serif'
13
+ html_monospacefont: '"Source Code Pro",monospace'
14
+ scripts: lib/isodoc/ribose/html/scripts.html
15
+ scripts_pdf: lib/isodoc/ribose/html/scripts.pdf.html
16
+ standardstylesheet: lib/isodoc/ribose/html/rsd.scss
17
+ header: lib/isodoc/ribose/html/header.html
18
+ wordcoverpage: lib/isodoc/ribose/html/word_rsd_titlepage.html
19
+ wordintropage: lib/isodoc/ribose/html/word_rsd_intro.html
20
+ wordstylesheet: lib/isodoc/ribose/html/wordstyle.scss
21
+ word_bodyfont: '"Source Sans Pro","Arial",sans-serif'
22
+ word_headerfont: '"Source Sans Pro","Arial",sans-serif'
23
+ word_monospacefont: '"Source Code Pro",monospace'
24
+ docid_template: "{{ docnumeric }}{% if stageabbr %}({{ stageabbr }}){%endif%}"
25
+ published_stages:
26
+ - published
27
+ stage_abbreviations:
28
+ working-draft: wd
29
+ committee-draft: cd
30
+ draft-standard: d
31
+ metadata_extensions:
32
+ - security
33
+ - recipient
34
+ webfont:
35
+ - "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,600,600i&display=swap"
36
+ - "https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,300;0,600;1,300;1,600&display=swap"
metadata ADDED
@@ -0,0 +1,277 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: metanorma-ribose
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-06-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: htmlentities
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.3.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.3.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: metanorma-standoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.4.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: isodoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: metanorma-generic
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.5.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.5.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '9.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '9.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: equivalent-xml
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.14'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.14'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '4.7'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '4.7'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '12.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '12.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '3.6'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3.6'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '='
158
+ - !ruby/object:Gem::Version
159
+ version: 0.54.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '='
165
+ - !ruby/object:Gem::Version
166
+ version: 0.54.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.15'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.15'
181
+ - !ruby/object:Gem::Dependency
182
+ name: timecop
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '0.9'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '0.9'
195
+ description: |
196
+ metanorma-ribose lets you write Ribose standards in AsciiDoc syntax.
197
+
198
+ This gem is in active development.
199
+
200
+ Formerly known as asciidoctor-rsd, metanorma-rsd.
201
+ email:
202
+ - open.source@ribose.com
203
+ executables: []
204
+ extensions: []
205
+ extra_rdoc_files: []
206
+ files:
207
+ - ".github/workflows/macos.yml"
208
+ - ".github/workflows/ubuntu.yml"
209
+ - ".github/workflows/windows.yml"
210
+ - ".gitignore"
211
+ - ".hound.yml"
212
+ - ".rubocop.yml"
213
+ - CODE_OF_CONDUCT.md
214
+ - Gemfile
215
+ - LICENSE
216
+ - README.adoc
217
+ - Rakefile
218
+ - bin/console
219
+ - bin/rspec
220
+ - bin/setup
221
+ - lib/asciidoctor/ribose.rb
222
+ - lib/asciidoctor/ribose/basicdoc.rng
223
+ - lib/asciidoctor/ribose/biblio.rng
224
+ - lib/asciidoctor/ribose/boilerplate.xml
225
+ - lib/asciidoctor/ribose/converter.rb
226
+ - lib/asciidoctor/ribose/isodoc.rng
227
+ - lib/asciidoctor/ribose/reqt.rng
228
+ - lib/asciidoctor/ribose/rsd.rng
229
+ - lib/isodoc/ribose/base_convert.rb
230
+ - lib/isodoc/ribose/html/header.html
231
+ - lib/isodoc/ribose/html/html_rsd_intro.html
232
+ - lib/isodoc/ribose/html/html_rsd_titlepage.html
233
+ - lib/isodoc/ribose/html/htmlstyle.scss
234
+ - lib/isodoc/ribose/html/logo.png
235
+ - lib/isodoc/ribose/html/logo.svg
236
+ - lib/isodoc/ribose/html/rsd.scss
237
+ - lib/isodoc/ribose/html/scripts.html
238
+ - lib/isodoc/ribose/html/word_rsd_intro.html
239
+ - lib/isodoc/ribose/html/word_rsd_titlepage.html
240
+ - lib/isodoc/ribose/html/wordstyle.scss
241
+ - lib/isodoc/ribose/html_convert.rb
242
+ - lib/isodoc/ribose/metadata.rb
243
+ - lib/isodoc/ribose/pdf_convert.rb
244
+ - lib/isodoc/ribose/presentation_xml_convert.rb
245
+ - lib/isodoc/ribose/rsd.standard.xsl
246
+ - lib/isodoc/ribose/word_convert.rb
247
+ - lib/isodoc/ribose/xref.rb
248
+ - lib/metanorma-ribose.rb
249
+ - lib/metanorma/ribose.rb
250
+ - lib/metanorma/ribose/processor.rb
251
+ - lib/metanorma/ribose/version.rb
252
+ - metanorma-ribose.gemspec
253
+ - metanorma.yml
254
+ homepage: https://github.com/metanorma/metanorma-ribose
255
+ licenses:
256
+ - BSD-2-Clause
257
+ metadata: {}
258
+ post_install_message:
259
+ rdoc_options: []
260
+ require_paths:
261
+ - lib
262
+ required_ruby_version: !ruby/object:Gem::Requirement
263
+ requirements:
264
+ - - ">="
265
+ - !ruby/object:Gem::Version
266
+ version: 2.4.0
267
+ required_rubygems_version: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ requirements: []
273
+ rubygems_version: 3.0.3
274
+ signing_key:
275
+ specification_version: 4
276
+ summary: metanorma-ribose lets you write Ribose standards in AsciiDoc.
277
+ test_files: []