metanorma-generic 1.4.5

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 +39 -0
  3. data/.github/workflows/ubuntu.yml +39 -0
  4. data/.github/workflows/windows.yml +42 -0
  5. data/.gitignore +1 -0
  6. data/.hound.yml +3 -0
  7. data/.rubocop.ribose.yml +66 -0
  8. data/.rubocop.tb.yml +650 -0
  9. data/.rubocop.yml +10 -0
  10. data/CODE_OF_CONDUCT.md +74 -0
  11. data/Gemfile +11 -0
  12. data/LICENSE +25 -0
  13. data/README.adoc +52 -0
  14. data/Rakefile +6 -0
  15. data/bin/console +14 -0
  16. data/bin/rspec +17 -0
  17. data/bin/setup +8 -0
  18. data/lib/asciidoctor/generic.rb +7 -0
  19. data/lib/asciidoctor/generic/basicdoc.rng +1059 -0
  20. data/lib/asciidoctor/generic/biblio.rng +1142 -0
  21. data/lib/asciidoctor/generic/converter.rb +172 -0
  22. data/lib/asciidoctor/generic/generic.rng +79 -0
  23. data/lib/asciidoctor/generic/isodoc.rng +1033 -0
  24. data/lib/asciidoctor/generic/reqt.rng +171 -0
  25. data/lib/asciidoctor/generic/rsd.rng +225 -0
  26. data/lib/isodoc/generic.rb +10 -0
  27. data/lib/isodoc/generic/base_convert.rb +59 -0
  28. data/lib/isodoc/generic/html/generic.scss +766 -0
  29. data/lib/isodoc/generic/html/header.html +253 -0
  30. data/lib/isodoc/generic/html/html_generic_intro.html +8 -0
  31. data/lib/isodoc/generic/html/html_generic_titlepage.html +106 -0
  32. data/lib/isodoc/generic/html/htmlstyle.scss +710 -0
  33. data/lib/isodoc/generic/html/logo.jpg +0 -0
  34. data/lib/isodoc/generic/html/scripts.html +84 -0
  35. data/lib/isodoc/generic/html/scripts.pdf.html +72 -0
  36. data/lib/isodoc/generic/html/word_generic_intro.html +72 -0
  37. data/lib/isodoc/generic/html/word_generic_titlepage.html +75 -0
  38. data/lib/isodoc/generic/html/wordstyle.scss +1157 -0
  39. data/lib/isodoc/generic/html_convert.rb +63 -0
  40. data/lib/isodoc/generic/metadata.rb +48 -0
  41. data/lib/isodoc/generic/pdf_convert.rb +64 -0
  42. data/lib/isodoc/generic/word_convert.rb +56 -0
  43. data/lib/metanorma-generic.rb +8 -0
  44. data/lib/metanorma/generic.rb +88 -0
  45. data/lib/metanorma/generic/processor.rb +71 -0
  46. data/lib/metanorma/generic/version.rb +5 -0
  47. data/metanorma-generic.gemspec +43 -0
  48. data/metanorma.yml.example +19 -0
  49. metadata +276 -0
@@ -0,0 +1,171 @@
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
+ Presupposes isodoc.rnc, is included in it
5
+ include "isodoc.rnc" { }
6
+ -->
7
+ <define name="requirement">
8
+ <element name="requirement">
9
+ <ref name="RequirementType"/>
10
+ </element>
11
+ </define>
12
+ <define name="recommendation">
13
+ <element name="recommendation">
14
+ <ref name="RequirementType"/>
15
+ </element>
16
+ </define>
17
+ <define name="permission">
18
+ <element name="permission">
19
+ <ref name="RequirementType"/>
20
+ </element>
21
+ </define>
22
+ <define name="RequirementType">
23
+ <optional>
24
+ <attribute name="obligation">
25
+ <ref name="ObligationType"/>
26
+ </attribute>
27
+ </optional>
28
+ <optional>
29
+ <attribute name="unnumbered">
30
+ <data type="boolean"/>
31
+ </attribute>
32
+ </optional>
33
+ <optional>
34
+ <attribute name="subsequence"/>
35
+ </optional>
36
+ <attribute name="id">
37
+ <data type="ID"/>
38
+ </attribute>
39
+ <optional>
40
+ <attribute name="filename"/>
41
+ </optional>
42
+ <optional>
43
+ <attribute name="model"/>
44
+ </optional>
45
+ <optional>
46
+ <attribute name="type"/>
47
+ </optional>
48
+ <optional>
49
+ <ref name="reqtitle"/>
50
+ </optional>
51
+ <optional>
52
+ <ref name="label"/>
53
+ </optional>
54
+ <optional>
55
+ <ref name="subject"/>
56
+ </optional>
57
+ <zeroOrMore>
58
+ <ref name="reqinherit"/>
59
+ </zeroOrMore>
60
+ <zeroOrMore>
61
+ <ref name="classification"/>
62
+ </zeroOrMore>
63
+ <zeroOrMore>
64
+ <choice>
65
+ <ref name="measurementtarget"/>
66
+ <ref name="specification"/>
67
+ <ref name="verification"/>
68
+ <ref name="import"/>
69
+ <ref name="description"/>
70
+ </choice>
71
+ </zeroOrMore>
72
+ <optional>
73
+ <ref name="reqt_references"/>
74
+ </optional>
75
+ <zeroOrMore>
76
+ <choice>
77
+ <ref name="requirement"/>
78
+ <ref name="recommendation"/>
79
+ <ref name="permission"/>
80
+ </choice>
81
+ </zeroOrMore>
82
+ </define>
83
+ <define name="reqtitle">
84
+ <element name="title">
85
+ <ref name="FormattedString"/>
86
+ </element>
87
+ </define>
88
+ <define name="label">
89
+ <element name="label">
90
+ <text/>
91
+ </element>
92
+ </define>
93
+ <define name="subject">
94
+ <element name="subject">
95
+ <text/>
96
+ </element>
97
+ </define>
98
+ <define name="reqinherit">
99
+ <element name="inherit">
100
+ <text/>
101
+ </element>
102
+ </define>
103
+ <define name="measurementtarget">
104
+ <element name="measurement-target">
105
+ <ref name="RequirementSubpart"/>
106
+ </element>
107
+ </define>
108
+ <define name="specification">
109
+ <element name="specification">
110
+ <ref name="RequirementSubpart"/>
111
+ </element>
112
+ </define>
113
+ <define name="verification">
114
+ <element name="verification">
115
+ <ref name="RequirementSubpart"/>
116
+ </element>
117
+ </define>
118
+ <define name="import">
119
+ <element name="import">
120
+ <ref name="RequirementSubpart"/>
121
+ </element>
122
+ </define>
123
+ <define name="description">
124
+ <element name="description">
125
+ <ref name="RequirementSubpart"/>
126
+ </element>
127
+ </define>
128
+ <define name="reqt_references">
129
+ <element name="references">
130
+ <oneOrMore>
131
+ <ref name="bibitem"/>
132
+ </oneOrMore>
133
+ </element>
134
+ </define>
135
+ <define name="RequirementSubpart">
136
+ <optional>
137
+ <attribute name="type"/>
138
+ </optional>
139
+ <optional>
140
+ <attribute name="exclude">
141
+ <data type="boolean"/>
142
+ </attribute>
143
+ </optional>
144
+ <oneOrMore>
145
+ <ref name="BasicBlock"/>
146
+ </oneOrMore>
147
+ </define>
148
+ <define name="ObligationType">
149
+ <choice>
150
+ <value>requirement</value>
151
+ <value>recommendation</value>
152
+ <value>permission</value>
153
+ </choice>
154
+ </define>
155
+ <define name="classification">
156
+ <element name="classification">
157
+ <ref name="classification_tag"/>
158
+ <ref name="classification_value"/>
159
+ </element>
160
+ </define>
161
+ <define name="classification_tag">
162
+ <element name="tag">
163
+ <text/>
164
+ </element>
165
+ </define>
166
+ <define name="classification_value">
167
+ <element name="value">
168
+ <text/>
169
+ </element>
170
+ </define>
171
+ </grammar>
@@ -0,0 +1,225 @@
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
+ Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
5
+ we cannot have a new default namespace: we will end up with a grammar with two different
6
+ namespaces, one for isostandard and one for csand additions. And we do not want that.
7
+ -->
8
+ <include href="isostandard.rng">
9
+ <start>
10
+ <ref name="rsd-standard"/>
11
+ </start>
12
+ <define name="language">
13
+ <element name="language">
14
+ <value>en</value>
15
+ </element>
16
+ </define>
17
+ <define name="docidentifier">
18
+ <element name="docidentifier">
19
+ <optional>
20
+ <attribute name="type"/>
21
+ </optional>
22
+ <text/>
23
+ </element>
24
+ </define>
25
+ <define name="btitle">
26
+ <element name="title">
27
+ <ref name="FormattedString"/>
28
+ </element>
29
+ </define>
30
+ <define name="figure">
31
+ <element name="figure">
32
+ <attribute name="id">
33
+ <data type="ID"/>
34
+ </attribute>
35
+ <optional>
36
+ <ref name="tname"/>
37
+ </optional>
38
+ <choice>
39
+ <ref name="image"/>
40
+ <ref name="pre"/>
41
+ <oneOrMore>
42
+ <ref name="subfigure"/>
43
+ </oneOrMore>
44
+ </choice>
45
+ <zeroOrMore>
46
+ <ref name="fn"/>
47
+ </zeroOrMore>
48
+ <optional>
49
+ <ref name="dl"/>
50
+ </optional>
51
+ <zeroOrMore>
52
+ <ref name="note"/>
53
+ </zeroOrMore>
54
+ </element>
55
+ </define>
56
+ <define name="subfigure">
57
+ <element name="figure">
58
+ <attribute name="id">
59
+ <data type="ID"/>
60
+ </attribute>
61
+ <optional>
62
+ <ref name="tname"/>
63
+ </optional>
64
+ <choice>
65
+ <ref name="image"/>
66
+ <ref name="pre"/>
67
+ </choice>
68
+ </element>
69
+ </define>
70
+ <define name="status">
71
+ <element name="status">
72
+ <choice>
73
+ <value>proposal</value>
74
+ <value>working-draft</value>
75
+ <value>committee-draft</value>
76
+ <value>draft-standard</value>
77
+ <value>final-draft</value>
78
+ <value>published</value>
79
+ <value>withdrawn</value>
80
+ <ref name="LocalizedString"/>
81
+ </choice>
82
+ </element>
83
+ </define>
84
+ <!-- TextElement |= keyword -->
85
+ <define name="TextElement">
86
+ <choice>
87
+ <text/>
88
+ <ref name="em"/>
89
+ <ref name="eref"/>
90
+ <ref name="strong"/>
91
+ <ref name="stem"/>
92
+ <ref name="sub"/>
93
+ <ref name="sup"/>
94
+ <ref name="tt"/>
95
+ <ref name="strike"/>
96
+ <ref name="smallcap"/>
97
+ <ref name="xref"/>
98
+ <ref name="br"/>
99
+ <ref name="hyperlink"/>
100
+ <ref name="hr"/>
101
+ <ref name="pagebreak"/>
102
+ <ref name="bookmark"/>
103
+ <ref name="keyword"/>
104
+ </choice>
105
+ </define>
106
+ <define name="BibItemType" combine="choice">
107
+ <choice>
108
+ <value>policy-and-procedures</value>
109
+ <value>best-practices</value>
110
+ <value>supporting-document</value>
111
+ <value>report</value>
112
+ <value>legal</value>
113
+ <value>directives</value>
114
+ <value>proposal</value>
115
+ <value>standard</value>
116
+ </choice>
117
+ </define>
118
+ <define name="editorialgroup">
119
+ <element name="editorialgroup">
120
+ <oneOrMore>
121
+ <ref name="committee"/>
122
+ </oneOrMore>
123
+ </element>
124
+ </define>
125
+ <define name="BibData">
126
+ <optional>
127
+ <attribute name="type">
128
+ <ref name="BibItemType"/>
129
+ </attribute>
130
+ </optional>
131
+ <oneOrMore>
132
+ <ref name="btitle"/>
133
+ </oneOrMore>
134
+ <optional>
135
+ <ref name="formattedref"/>
136
+ </optional>
137
+ <zeroOrMore>
138
+ <ref name="bsource"/>
139
+ </zeroOrMore>
140
+ <zeroOrMore>
141
+ <ref name="docidentifier"/>
142
+ </zeroOrMore>
143
+ <zeroOrMore>
144
+ <ref name="bdate"/>
145
+ </zeroOrMore>
146
+ <zeroOrMore>
147
+ <ref name="contributor"/>
148
+ </zeroOrMore>
149
+ <optional>
150
+ <ref name="edition"/>
151
+ </optional>
152
+ <zeroOrMore>
153
+ <ref name="biblionote"/>
154
+ </zeroOrMore>
155
+ <zeroOrMore>
156
+ <ref name="language"/>
157
+ </zeroOrMore>
158
+ <zeroOrMore>
159
+ <ref name="script"/>
160
+ </zeroOrMore>
161
+ <zeroOrMore>
162
+ <ref name="abstract"/>
163
+ </zeroOrMore>
164
+ <optional>
165
+ <ref name="status"/>
166
+ </optional>
167
+ <ref name="copyright"/>
168
+ <zeroOrMore>
169
+ <ref name="docrelation"/>
170
+ </zeroOrMore>
171
+ <ref name="editorialgroup"/>
172
+ <zeroOrMore>
173
+ <ref name="ics"/>
174
+ </zeroOrMore>
175
+ <optional>
176
+ <ref name="security"/>
177
+ </optional>
178
+ </define>
179
+ </include>
180
+ <define name="committee">
181
+ <element name="committee">
182
+ <attribute name="type">
183
+ <choice>
184
+ <value>technical</value>
185
+ <value>provisional</value>
186
+ </choice>
187
+ </attribute>
188
+ <text/>
189
+ </element>
190
+ </define>
191
+ <define name="pre">
192
+ <element name="pre">
193
+ <text/>
194
+ </element>
195
+ </define>
196
+ <define name="keyword">
197
+ <element name="keyword">
198
+ <text/>
199
+ </element>
200
+ </define>
201
+ <define name="security">
202
+ <element name="security">
203
+ <text/>
204
+ </element>
205
+ </define>
206
+ <define name="rsd-standard">
207
+ <element name="rsd-standard">
208
+ <ref name="bibdata"/>
209
+ <optional>
210
+ <ref name="version"/>
211
+ </optional>
212
+ <zeroOrMore>
213
+ <ref name="termdocsource"/>
214
+ </zeroOrMore>
215
+ <ref name="preface"/>
216
+ <oneOrMore>
217
+ <ref name="sections"/>
218
+ </oneOrMore>
219
+ <zeroOrMore>
220
+ <ref name="annex"/>
221
+ </zeroOrMore>
222
+ <ref name="bibliography"/>
223
+ </element>
224
+ </define>
225
+ </grammar>
@@ -0,0 +1,10 @@
1
+ require "isodoc/generic/metadata"
2
+ require "isodoc/generic/html_convert"
3
+ require "isodoc/generic/pdf_convert"
4
+ require "isodoc/generic/word_convert"
5
+
6
+ module IsoDoc
7
+ module Generic
8
+
9
+ end
10
+ end
@@ -0,0 +1,59 @@
1
+ require "isodoc"
2
+ require_relative "metadata"
3
+ require "fileutils"
4
+
5
+ module IsoDoc
6
+ module Generic
7
+ module BaseConvert
8
+ def metadata_init(lang, script, labels)
9
+ @meta = Metadata.new(lang, script, labels)
10
+ end
11
+
12
+ def baselocation(loc)
13
+ return nil if loc.nil?
14
+ File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
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 i18n_init(lang, script)
28
+ super
29
+ end
30
+
31
+ def fileloc(loc)
32
+ File.join(File.dirname(__FILE__), loc)
33
+ end
34
+
35
+ def cleanup(docxml)
36
+ super
37
+ term_cleanup(docxml)
38
+ end
39
+
40
+ def term_cleanup(docxml)
41
+ docxml.xpath("//p[@class = 'Terms']").each do |d|
42
+ h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
43
+ h2.add_child("&nbsp;")
44
+ h2.add_child(d.remove)
45
+ end
46
+ docxml
47
+ end
48
+
49
+ def make_body(xml, docxml)
50
+ body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
51
+ xml.body **body_attr do |body|
52
+ make_body1(body, docxml)
53
+ make_body2(body, docxml)
54
+ make_body3(body, docxml)
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end