metanorma-unece 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -7
- data/README.adoc +80 -23
- data/lib/asciidoctor/unece/biblio.rng +10 -0
- data/lib/asciidoctor/unece/converter.rb +10 -2
- data/lib/asciidoctor/unece/isodoc.rng +3 -0
- data/lib/asciidoctor/unece/isostandard.rng +6 -0
- data/lib/asciidoctor/unece/unece.rng +8 -5
- data/lib/isodoc/unece/html/htmlstyle.scss +4 -0
- data/lib/isodoc/unece/html/word_unece_intro.html +4 -0
- data/lib/isodoc/unece/html_convert.rb +13 -14
- data/lib/isodoc/unece/word_convert.rb +15 -36
- data/lib/metanorma/unece.rb +1 -0
- data/lib/metanorma/unece/input.rb +18 -0
- data/lib/metanorma/unece/processor.rb +1 -1
- data/lib/metanorma/unece/version.rb +1 -1
- data/metanorma-unece.gemspec +1 -1
- metadata +6 -7
- data/.rubocop.ribose.yml +0 -66
- data/.rubocop.tb.yml +0 -650
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f07f87e086397434004ac02295c0831da0583e8f6f8ff485206c0d4deaaa1a46
|
4
|
+
data.tar.gz: c186fbf4c55bc0d60a7bc5238de13a979d1694b51876459f28b4f8d5f513544f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce40c58219498fce0223818014ffe4c942dbd4747a7967585ba7de42f445ad051eae28b650311913dd4f753aa38148745fb069dab621f78411626064631cafd5
|
7
|
+
data.tar.gz: 6d824abd450b6f1d4a0061a674fdbaceee7910a44e23397f9aecfc0fe09040b42051db18e69ebde6bb30f80b8d4e288bf8924371cf6f4843ee8774679760598a
|
data/.rubocop.yml
CHANGED
@@ -3,13 +3,8 @@
|
|
3
3
|
# All project-specific additions and overrides should be specified in this file.
|
4
4
|
|
5
5
|
inherit_from:
|
6
|
-
|
7
|
-
- ".rubocop.tb.yml"
|
8
|
-
# Overrides from Ribose
|
9
|
-
- ".rubocop.ribose.yml"
|
6
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
10
7
|
AllCops:
|
11
|
-
|
12
|
-
StyleGuideCopsOnly: false
|
13
|
-
TargetRubyVersion: 2.5
|
8
|
+
TargetRubyVersion: 2.3
|
14
9
|
Rails:
|
15
10
|
Enabled: true
|
data/README.adoc
CHANGED
@@ -18,23 +18,18 @@ for guidance, including https://github.com/riboseinc/metanorma-iso/wiki/Guidance
|
|
18
18
|
|
19
19
|
The following outputs are generated.
|
20
20
|
|
21
|
-
* (Optional) An HTML preview generated directly from the Asciidoctor document,
|
22
|
-
using native AsciiDoc formatting.
|
23
|
-
** http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
|
24
|
-
The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
|
25
|
-
which is syntactically stricter than the common MathJax processor;
|
26
|
-
if you do not get expected results, try bracketing terms your in AsciiMathML
|
27
|
-
expressions.
|
28
|
-
|
29
21
|
* an XML representation of the document, intended as a document model for UNECE
|
30
22
|
International Standards.
|
31
|
-
|
32
23
|
* The XML representation is processed in turn to generate the following outputs
|
33
24
|
as end deliverable UNECE standard drafts.
|
34
25
|
** HTML
|
35
26
|
** Word
|
36
27
|
|
37
|
-
|
28
|
+
NOTE: http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
|
29
|
+
The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
|
30
|
+
which is syntactically stricter than the common MathJax processor;
|
31
|
+
if you do not get expected results, try bracketing terms your in AsciiMathML
|
32
|
+
expressions.
|
38
33
|
|
39
34
|
== Usage
|
40
35
|
|
@@ -81,24 +76,44 @@ scripts such as this one. You need only run the following in a Terminal console:
|
|
81
76
|
----
|
82
77
|
$ bash <(curl -s https://raw.githubusercontent.com/riboseinc/metanorma-macos-setup/master/metanorma-setup)
|
83
78
|
$ gem install metanorma-unece
|
79
|
+
$ gem install metanorma-cli
|
84
80
|
----
|
85
81
|
|
86
|
-
===
|
82
|
+
=== Testing
|
83
|
+
|
84
|
+
Since this software is still in development it is not yet as mature as the other standards we support. We plan to fully complete support if there is interest.
|
87
85
|
|
88
|
-
|
89
|
-
within the gem, using
|
90
|
-
https://developers.google.com/web/updates/2017/04/headless-chrome[Headless Chrome],
|
91
|
-
via the https://github.com/GoogleChrome/puppeteer[Puppeteer] Node library.
|
86
|
+
The easiest way to try out is using a Mac. It takes a little bit more work on a Windows machine through the platform-independent Docker container (see the https://www.metanorma.com/overview/getting-started/#docker-setup[Metanorma Quickstart guide]) , but it is doable.
|
92
87
|
|
93
|
-
|
88
|
+
The current examples of UNECE documents encoded using Metanorma is provided in https://github.com/riboseinc/unece-docs/
|
94
89
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
90
|
+
(Please run the 2-line macOS setup script prior to the following)
|
91
|
+
|
92
|
+
First, use Git to clone the code and documents:
|
93
|
+
|
94
|
+
[source,console]
|
95
|
+
--
|
96
|
+
git clone https://github.com/riboseinc/unece-docs/
|
97
|
+
--
|
98
|
+
|
99
|
+
Then, install all dependencies with this command:
|
100
|
+
|
101
|
+
[source,console]
|
102
|
+
--
|
103
|
+
bundle
|
104
|
+
--
|
105
|
+
|
106
|
+
Next, run the compilation toolchain:
|
107
|
+
|
108
|
+
[source,console]
|
109
|
+
--
|
110
|
+
make all
|
111
|
+
--
|
112
|
+
|
113
|
+
Then you will see the files generated, including HTML and Word Doc.
|
114
|
+
|
115
|
+
The easiest way to start a new document is to copy one of the two samples and modify them.
|
99
116
|
|
100
|
-
NOTE: The https://github.com/riboseinc/metanorma-macos-setup script already
|
101
|
-
includes Puppeteer installation.
|
102
117
|
|
103
118
|
|
104
119
|
== Approach
|
@@ -146,7 +161,7 @@ introduced with `=`, is ignored)
|
|
146
161
|
|
147
162
|
`:doctype:`:: The document type (see _UNECE deliverables: The different types of
|
148
163
|
UNECE publications_) (mandatory). Note that the document types are reflected in the
|
149
|
-
document identifier. The permitted types are:
|
164
|
+
document identifier. The permitted types for UNECE are:
|
150
165
|
+
|
151
166
|
--
|
152
167
|
recommendation:: UNECE Recommendation
|
@@ -163,6 +178,9 @@ plenary:: UNECE Plenary document
|
|
163
178
|
`:language:` :: The language of the document (only `en` for now) (mandatory)
|
164
179
|
`:script:` :: The language of the document (only `Latn` for now) (mandatory)
|
165
180
|
|
181
|
+
`:toc:` :: Include table of contents in Word output. (Table of contents is always included in
|
182
|
+
HTML output.)
|
183
|
+
|
166
184
|
NOTE: The attribute `:draft:`, if present, includes review notes in the XML output;
|
167
185
|
these are otherwise suppressed.
|
168
186
|
|
@@ -184,6 +202,45 @@ these are otherwise suppressed.
|
|
184
202
|
|
185
203
|
`:distribution:`:: Extent of distribution allowed. e.g. `General`
|
186
204
|
|
205
|
+
[[model_additions]]
|
206
|
+
== Asciidoctor model additions
|
207
|
+
|
208
|
+
Refer also to https://github.com/riboseinc/metanorma-standoc/blob/master/README.adoc; this section lists additions specific only to metanorma-unece
|
209
|
+
|
210
|
+
=== Abstract
|
211
|
+
|
212
|
+
A clause is recognised as an abstract if it is prefixed with the `[abstract]` style attribute:
|
213
|
+
|
214
|
+
[source,asciidoctor]
|
215
|
+
--
|
216
|
+
[abstract]
|
217
|
+
== Summary
|
218
|
+
In 2017, the World Economic Forum approached UN/CEFACT in order to create a guide on Paperless Trade which might help countries to understand and implement specific provisions of the World Trade Organization?~@~Ys Trade Facilitation Agreement, specifically article 10 on Formalities connected with importation and exportation (10.2, 10.3 and 10.4) as well as article 7 on Release and clearance of goods (7.1 and 7.2).
|
219
|
+
--
|
220
|
+
|
221
|
+
Abstracts are moved to the front page in plenary documents. In recommendation documents, they appear in the document preface, before the foreword and introduction.
|
222
|
+
|
223
|
+
=== Paragraph numbering
|
224
|
+
|
225
|
+
Paragraphs are automatically numbered in this gem, and paragraph numbers should not be entered in the Asciidoctor
|
226
|
+
source. Paragraphs are numbered by treating each paragraph in the Metanorma XML as a separate clause; all terminal
|
227
|
+
clauses in UNECE Metanorma XML are rendered as a numbered paragraph. Non-paragraph blocks (tables, figures, admonitions,
|
228
|
+
lists) are not numbered; nor are paragraphs in prefatory material (introduction, foreword, abstract).
|
229
|
+
|
230
|
+
=== Admonitions
|
231
|
+
|
232
|
+
The admonition container "IMPORTANT" is used to render UNECE document boxes. Unlike normal Metanorma admonitions,
|
233
|
+
UNECE admonitions can have titles:
|
234
|
+
|
235
|
+
[source,asciidoctor]
|
236
|
+
--
|
237
|
+
[IMPORTANT]
|
238
|
+
.Business Process Analysis Plus (BPA+) (<==== This is the box title)
|
239
|
+
====
|
240
|
+
Business Process Analysis was initially designed to document and evaluate an import/export process at a given point time and its relative simplicity. It also specifically includes a measurement of the time and cost of the complete range of procedures as one of the main outputs of the analysis. This combination makes it suitable as the basis/core of a trade facilitation monitoring and improvement system.
|
241
|
+
====
|
242
|
+
--
|
243
|
+
|
187
244
|
|
188
245
|
== Data Models
|
189
246
|
|
@@ -476,6 +476,9 @@
|
|
476
476
|
<zeroOrMore>
|
477
477
|
<ref name="docidentifier"/>
|
478
478
|
</zeroOrMore>
|
479
|
+
<optional>
|
480
|
+
<ref name="docnumber"/>
|
481
|
+
</optional>
|
479
482
|
<zeroOrMore>
|
480
483
|
<ref name="bdate"/>
|
481
484
|
</zeroOrMore>
|
@@ -637,6 +640,8 @@
|
|
637
640
|
<value>transmitted</value>
|
638
641
|
<value>copied</value>
|
639
642
|
<value>unchanged</value>
|
643
|
+
<value>circulated</value>
|
644
|
+
<text/>
|
640
645
|
</choice>
|
641
646
|
</attribute>
|
642
647
|
<choice>
|
@@ -673,6 +678,11 @@
|
|
673
678
|
<text/>
|
674
679
|
</element>
|
675
680
|
</define>
|
681
|
+
<define name="docnumber">
|
682
|
+
<element name="docnumber">
|
683
|
+
<text/>
|
684
|
+
</element>
|
685
|
+
</define>
|
676
686
|
<define name="bclassification">
|
677
687
|
<element name="classification">
|
678
688
|
<optional>
|
@@ -45,10 +45,10 @@ module Asciidoctor
|
|
45
45
|
|
46
46
|
def title(node, xml)
|
47
47
|
["en"].each do |lang|
|
48
|
-
xml.title **{ language: lang, format: "plain" } do |t|
|
48
|
+
xml.title **{ language: lang, format: "text/plain" } do |t|
|
49
49
|
t << asciidoc_sub(node.attr("title"))
|
50
50
|
end
|
51
|
-
xml.subtitle **{ language: lang, format: "plain" } do |t|
|
51
|
+
xml.subtitle **{ language: lang, format: "text/plain" } do |t|
|
52
52
|
t << asciidoc_sub(node.attr("subtitle"))
|
53
53
|
end
|
54
54
|
end
|
@@ -157,6 +157,14 @@ module Asciidoctor
|
|
157
157
|
return
|
158
158
|
end
|
159
159
|
|
160
|
+
def html_extract_attributes(node)
|
161
|
+
super.merge(toc: node.attributes.has_key?("toc"))
|
162
|
+
end
|
163
|
+
|
164
|
+
def doc_extract_attributes(node)
|
165
|
+
super.merge(toc: node.attributes.has_key?("toc"))
|
166
|
+
end
|
167
|
+
|
160
168
|
def html_converter(node)
|
161
169
|
IsoDoc::Unece::HtmlConvert.new(html_extract_attributes(node))
|
162
170
|
end
|
@@ -84,6 +84,9 @@
|
|
84
84
|
<zeroOrMore>
|
85
85
|
<ref name="docidentifier"/>
|
86
86
|
</zeroOrMore>
|
87
|
+
<optional>
|
88
|
+
<ref name="docnumber"/>
|
89
|
+
</optional>
|
87
90
|
<zeroOrMore>
|
88
91
|
<ref name="bdate"/>
|
89
92
|
</zeroOrMore>
|
@@ -163,6 +166,9 @@
|
|
163
166
|
<zeroOrMore>
|
164
167
|
<ref name="docidentifier"/>
|
165
168
|
</zeroOrMore>
|
169
|
+
<optional>
|
170
|
+
<ref name="docnumber"/>
|
171
|
+
</optional>
|
166
172
|
<zeroOrMore>
|
167
173
|
<ref name="bdate"/>
|
168
174
|
</zeroOrMore>
|
@@ -172,6 +172,9 @@
|
|
172
172
|
<zeroOrMore>
|
173
173
|
<ref name="docidentifier"/>
|
174
174
|
</zeroOrMore>
|
175
|
+
<optional>
|
176
|
+
<ref name="docnumber"/>
|
177
|
+
</optional>
|
175
178
|
<zeroOrMore>
|
176
179
|
<ref name="bdate"/>
|
177
180
|
</zeroOrMore>
|
@@ -218,12 +221,12 @@
|
|
218
221
|
</optional>
|
219
222
|
</element>
|
220
223
|
</define>
|
224
|
+
<define name="abstract">
|
225
|
+
<element name="abstract">
|
226
|
+
<ref name="Basic-Section"/>
|
227
|
+
</element>
|
228
|
+
</define>
|
221
229
|
</include>
|
222
|
-
<define name="abstract">
|
223
|
-
<element name="abstract">
|
224
|
-
<ref name="Basic-Section"/>
|
225
|
-
</element>
|
226
|
-
</define>
|
227
230
|
<define name="committee">
|
228
231
|
<element name="committee">
|
229
232
|
<text/>
|
@@ -1,3 +1,4 @@
|
|
1
|
+
{% if doctype == "Recommendation" %}
|
1
2
|
<div>
|
2
3
|
<p><b>Note</b>
|
3
4
|
<p>The designations employed and the presentation of the material in this publication do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations concerning the legal status of any country, territory, city or area, or of its authorities, or concerning the delimitation of its frontiers or boundaries.</p>
|
@@ -18,7 +19,10 @@
|
|
18
19
|
</div>
|
19
20
|
|
20
21
|
<div id="preface_container"/>
|
22
|
+
{% endif %}
|
21
23
|
|
24
|
+
{% if toc %}
|
22
25
|
<p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>
|
23
26
|
|
24
27
|
WORDTOC
|
28
|
+
{% endif %}
|
@@ -44,6 +44,7 @@ module IsoDoc
|
|
44
44
|
|
45
45
|
def metadata_init(lang, script, labels)
|
46
46
|
@meta = Metadata.new(lang, script, labels)
|
47
|
+
@meta.set(:toc, @toc)
|
47
48
|
end
|
48
49
|
|
49
50
|
def html_head
|
@@ -67,7 +68,7 @@ module IsoDoc
|
|
67
68
|
def make_body(xml, docxml)
|
68
69
|
plenary = docxml.at(ns("//bibdata[@type = 'plenary']"))
|
69
70
|
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
|
70
|
-
|
71
|
+
#@htmlintropage = nil if plenary
|
71
72
|
xml.body **body_attr do |body|
|
72
73
|
make_body1(body, docxml)
|
73
74
|
make_body2(body, docxml)
|
@@ -75,16 +76,16 @@ module IsoDoc
|
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
79
|
+
def make_body3(body, docxml)
|
80
|
+
body.div **{ class: "main-section" } do |div3|
|
81
|
+
abstract docxml, div3
|
82
|
+
foreword docxml, div3
|
83
|
+
introduction docxml, div3
|
84
|
+
middle docxml, div3
|
85
|
+
footnotes div3
|
86
|
+
comments div3
|
87
|
+
end
|
86
88
|
end
|
87
|
-
end
|
88
89
|
|
89
90
|
def html_preface(docxml)
|
90
91
|
super
|
@@ -104,7 +105,7 @@ module IsoDoc
|
|
104
105
|
sect2.remove # pagebreak
|
105
106
|
end
|
106
107
|
=end
|
107
|
-
docxml
|
108
|
+
docxml
|
108
109
|
end
|
109
110
|
|
110
111
|
def middle(isoxml, out)
|
@@ -134,8 +135,7 @@ docxml
|
|
134
135
|
f = isoxml.at(ns("//introduction")) || return
|
135
136
|
page_break(out)
|
136
137
|
out.div **{ class: "Section3", id: f["id"] } do |div|
|
137
|
-
|
138
|
-
#insert_tab(h1, 1)
|
138
|
+
div.h1(**{ class: "IntroTitle" }) do |h1|
|
139
139
|
h1 << @introduction_lbl
|
140
140
|
end
|
141
141
|
f.elements.each do |e|
|
@@ -149,7 +149,6 @@ docxml
|
|
149
149
|
page_break(out)
|
150
150
|
out.div **attr_code(id: f["id"]) do |s|
|
151
151
|
s.h1(**{ class: "ForewordTitle" }) do |h1|
|
152
|
-
#insert_tab(h1, 1)
|
153
152
|
h1 << @foreword_lbl
|
154
153
|
end
|
155
154
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
@@ -12,6 +12,7 @@ module IsoDoc
|
|
12
12
|
def initialize(options)
|
13
13
|
@libdir = File.dirname(__FILE__)
|
14
14
|
super
|
15
|
+
@toc = options[:toc]
|
15
16
|
FileUtils.cp html_doc_path('logo.jpg'), "logo.jpg"
|
16
17
|
end
|
17
18
|
|
@@ -37,6 +38,7 @@ module IsoDoc
|
|
37
38
|
|
38
39
|
def metadata_init(lang, script, labels)
|
39
40
|
@meta = Metadata.new(lang, script, labels)
|
41
|
+
@meta.set(:toc, @toc)
|
40
42
|
end
|
41
43
|
|
42
44
|
def make_body(xml, docxml)
|
@@ -44,7 +46,7 @@ module IsoDoc
|
|
44
46
|
if plenary && @wordcoverpage == html_doc_path("word_unece_titlepage.html")
|
45
47
|
@wordcoverpage = html_doc_path("word_unece_plenary_titlepage.html")
|
46
48
|
end
|
47
|
-
@wordintropage = nil if plenary
|
49
|
+
@wordintropage = nil if plenary && !@toc
|
48
50
|
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
|
49
51
|
xml.body **body_attr do |body|
|
50
52
|
make_body1(body, docxml)
|
@@ -64,35 +66,6 @@ module IsoDoc
|
|
64
66
|
section_break(body)
|
65
67
|
end
|
66
68
|
|
67
|
-
def title(isoxml, _out)
|
68
|
-
main = isoxml&.at(ns("//title[@language='en']"))&.text
|
69
|
-
set_metadata(:doctitle, main)
|
70
|
-
end
|
71
|
-
|
72
|
-
def generate_header(filename, dir)
|
73
|
-
return unless @header
|
74
|
-
template = Liquid::Template.parse(File.read(@header, encoding: "UTF-8"))
|
75
|
-
meta = @meta.get
|
76
|
-
meta[:filename] = filename
|
77
|
-
params = meta.map { |k, v| [k.to_s, v] }.to_h
|
78
|
-
File.open("header.html", "w") { |f| f.write(template.render(params)) }
|
79
|
-
@files_to_delete << "header.html"
|
80
|
-
"header.html"
|
81
|
-
end
|
82
|
-
|
83
|
-
def header_strip(h)
|
84
|
-
h = h.to_s.gsub(%r{<br/>}, " ").sub(/<\/?h[12][^>]*>/, "").gsub(/<\/?b>/, "")
|
85
|
-
h1 = to_xhtml_fragment(h.dup)
|
86
|
-
h1.traverse do |x|
|
87
|
-
x.replace(" ") if x.name == "span" &&
|
88
|
-
/mso-tab-count/.match(x["style"])
|
89
|
-
x.remove if x.name == "span" && x["class"] == "MsoCommentReference"
|
90
|
-
x.remove if x.name == "a" && x["epub:type"] == "footnote"
|
91
|
-
x.replace(x.children) if x.name == "a"
|
92
|
-
end
|
93
|
-
from_xhtml(h1)
|
94
|
-
end
|
95
|
-
|
96
69
|
ENDLINE = <<~END.freeze
|
97
70
|
<v:line id="_x0000_s1026"
|
98
71
|
alt="" style='position:absolute;left:0;text-align:left;z-index:251662848;
|
@@ -128,9 +101,9 @@ module IsoDoc
|
|
128
101
|
|
129
102
|
def introduction(isoxml, out)
|
130
103
|
f = isoxml.at(ns("//introduction")) || return
|
131
|
-
page_break(out)
|
132
104
|
out.div **{ class: "Section3", id: f["id"] } do |div|
|
133
|
-
|
105
|
+
page_break(out)
|
106
|
+
div.p(**{ class: "IntroTitle" }) do |h1|
|
134
107
|
h1 << @introduction_lbl
|
135
108
|
end
|
136
109
|
f.elements.each do |e|
|
@@ -141,8 +114,8 @@ module IsoDoc
|
|
141
114
|
|
142
115
|
def foreword(isoxml, out)
|
143
116
|
f = isoxml.at(ns("//foreword")) || return
|
144
|
-
page_break(out)
|
145
117
|
out.div **attr_code(id: f["id"]) do |s|
|
118
|
+
page_break(out)
|
146
119
|
s.p(**{ class: "ForewordTitle" }) do |h1|
|
147
120
|
h1 << @foreword_lbl
|
148
121
|
end
|
@@ -158,10 +131,16 @@ module IsoDoc
|
|
158
131
|
intro = docxml.at("//p[@class = 'IntroTitle']/..")
|
159
132
|
abstract = docxml.at("//p[@class = 'AbstractTitle']/..")
|
160
133
|
abstract.parent = (abstractbox || preface_container) if abstract
|
134
|
+
abstractbox and abstract.xpath("./br").each do |a|
|
135
|
+
a.remove if /page-break-before:always/.match(a["style"])
|
136
|
+
end
|
161
137
|
docxml&.at("//p[@class = 'AbstractTitle']")&.remove if abstractbox
|
162
138
|
foreword.parent = preface_container if foreword && preface_container
|
163
139
|
intro.parent = preface_container if intro && preface_container
|
164
|
-
if
|
140
|
+
if preface_container && (foreword || intro)
|
141
|
+
preface_container.at("./div/br").remove # remove initial page break
|
142
|
+
end
|
143
|
+
if abstractbox && !intro && !foreword && !@toc
|
165
144
|
sect2 = docxml.at("//div[@class='WordSection2']")
|
166
145
|
sect2.next_element.remove # pagebreak
|
167
146
|
sect2.remove # pagebreak
|
@@ -392,10 +371,10 @@ module IsoDoc
|
|
392
371
|
end
|
393
372
|
end
|
394
373
|
|
395
|
-
|
374
|
+
def abstract(isoxml, out)
|
396
375
|
f = isoxml.at(ns("//abstract")) || return
|
397
|
-
page_break(out)
|
398
376
|
out.div **attr_code(id: f["id"]) do |s|
|
377
|
+
page_break(out)
|
399
378
|
s.p(**{ class: "AbstractTitle" }) { |h1| h1 << "Summary" }
|
400
379
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
401
380
|
end
|
data/lib/metanorma/unece.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "metanorma/input"
|
2
|
+
|
3
|
+
module Metanorma
|
4
|
+
module Unece
|
5
|
+
module Input
|
6
|
+
class Asciidoc < ::Metanorma::Input::Asciidoc
|
7
|
+
def extract_options(file)
|
8
|
+
head = file.sub(/\n\n.*$/m, "\n")
|
9
|
+
/\n(?<toc>:toc:)/ =~ head
|
10
|
+
new_options = {
|
11
|
+
toc: defined?(toc)
|
12
|
+
}.reject { |_, val| val.nil? }
|
13
|
+
super.merge(new_options)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -22,7 +22,7 @@ module Metanorma
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def input_to_isodoc(file, filename)
|
25
|
-
Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
|
25
|
+
Metanorma::Unece::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
|
26
26
|
end
|
27
27
|
|
28
28
|
def output(isodoc_node, outname, format, options={})
|
data/metanorma-unece.gemspec
CHANGED
@@ -42,6 +42,6 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_development_dependency "rubocop", "~> 0.50"
|
43
43
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
44
44
|
spec.add_development_dependency "timecop", "~> 0.9"
|
45
|
-
spec.add_development_dependency "metanorma", "~> 0.3.
|
45
|
+
spec.add_development_dependency "metanorma", "~> 0.3.1"
|
46
46
|
spec.add_development_dependency "metanorma-cli", "~> 1.0.0"
|
47
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-unece
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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-
|
11
|
+
date: 2018-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -254,14 +254,14 @@ dependencies:
|
|
254
254
|
requirements:
|
255
255
|
- - "~>"
|
256
256
|
- !ruby/object:Gem::Version
|
257
|
-
version: 0.3.
|
257
|
+
version: 0.3.1
|
258
258
|
type: :development
|
259
259
|
prerelease: false
|
260
260
|
version_requirements: !ruby/object:Gem::Requirement
|
261
261
|
requirements:
|
262
262
|
- - "~>"
|
263
263
|
- !ruby/object:Gem::Version
|
264
|
-
version: 0.3.
|
264
|
+
version: 0.3.1
|
265
265
|
- !ruby/object:Gem::Dependency
|
266
266
|
name: metanorma-cli
|
267
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -287,8 +287,6 @@ extra_rdoc_files: []
|
|
287
287
|
files:
|
288
288
|
- ".gitignore"
|
289
289
|
- ".hound.yml"
|
290
|
-
- ".rubocop.ribose.yml"
|
291
|
-
- ".rubocop.tb.yml"
|
292
290
|
- ".rubocop.yml"
|
293
291
|
- ".travis.yml"
|
294
292
|
- CODE_OF_CONDUCT.md
|
@@ -323,6 +321,7 @@ files:
|
|
323
321
|
- lib/metanorma-unece.rb
|
324
322
|
- lib/metanorma/unece.rb
|
325
323
|
- lib/metanorma/unece/UN_emblem_blue.svg
|
324
|
+
- lib/metanorma/unece/input.rb
|
326
325
|
- lib/metanorma/unece/processor.rb
|
327
326
|
- lib/metanorma/unece/version.rb
|
328
327
|
- metanorma-unece.gemspec
|
@@ -346,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
346
345
|
version: '0'
|
347
346
|
requirements: []
|
348
347
|
rubyforge_project:
|
349
|
-
rubygems_version: 2.7.
|
348
|
+
rubygems_version: 2.7.6
|
350
349
|
signing_key:
|
351
350
|
specification_version: 4
|
352
351
|
summary: Metanorma for UNECE.
|
data/.rubocop.ribose.yml
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Include:
|
3
|
-
- "**/*.rake"
|
4
|
-
- "**/Gemfile"
|
5
|
-
- "**/*.gemfile"
|
6
|
-
- "**/Rakefile"
|
7
|
-
- "**/*.rb"
|
8
|
-
Exclude:
|
9
|
-
- "vendor/**/*"
|
10
|
-
- "db/**/*"
|
11
|
-
- "tmp/**/*"
|
12
|
-
DisplayCopNames: false
|
13
|
-
StyleGuideCopsOnly: false
|
14
|
-
Rails:
|
15
|
-
Enabled: true
|
16
|
-
Metrics/AbcSize:
|
17
|
-
Description: A calculated magnitude based on number of assignments, branches, and
|
18
|
-
conditions.
|
19
|
-
Enabled: true
|
20
|
-
Max: 15
|
21
|
-
Metrics/BlockLength:
|
22
|
-
Exclude:
|
23
|
-
- "spec/**/*"
|
24
|
-
Metrics/BlockNesting:
|
25
|
-
Description: Avoid excessive block nesting
|
26
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count
|
27
|
-
Enabled: true
|
28
|
-
Max: 3
|
29
|
-
Metrics/ClassLength:
|
30
|
-
Description: Avoid classes longer than 100 lines of code.
|
31
|
-
Enabled: false
|
32
|
-
CountComments: false
|
33
|
-
Max: 100
|
34
|
-
Metrics/CyclomaticComplexity:
|
35
|
-
Description: A complexity metric that is strongly correlated to the number of test
|
36
|
-
cases needed to validate a method.
|
37
|
-
Enabled: true
|
38
|
-
Max: 6
|
39
|
-
Metrics/LineLength:
|
40
|
-
Description: Limit lines to 80 characters.
|
41
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits
|
42
|
-
Enabled: true
|
43
|
-
Max: 80
|
44
|
-
AllowURI: true
|
45
|
-
URISchemes:
|
46
|
-
- http
|
47
|
-
- https
|
48
|
-
Metrics/MethodLength:
|
49
|
-
Description: Avoid methods longer than 10 lines of code.
|
50
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
|
51
|
-
Enabled: true
|
52
|
-
CountComments: true
|
53
|
-
Max: 10
|
54
|
-
Exclude:
|
55
|
-
- "spec/**/*"
|
56
|
-
Metrics/ParameterLists:
|
57
|
-
Description: Avoid long parameter lists.
|
58
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
|
59
|
-
Enabled: true
|
60
|
-
Max: 5
|
61
|
-
CountKeywordArgs: true
|
62
|
-
Metrics/PerceivedComplexity:
|
63
|
-
Description: A complexity metric geared towards measuring complexity for a human
|
64
|
-
reader.
|
65
|
-
Enabled: true
|
66
|
-
Max: 7
|
data/.rubocop.tb.yml
DELETED
@@ -1,650 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
- db/schema.rb
|
4
|
-
|
5
|
-
Naming/AccessorMethodName:
|
6
|
-
Description: Check the naming of accessor methods for get_/set_.
|
7
|
-
Enabled: false
|
8
|
-
|
9
|
-
Style/Alias:
|
10
|
-
Description: 'Use alias_method instead of alias.'
|
11
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
Style/ArrayJoin:
|
15
|
-
Description: 'Use Array#join instead of Array#*.'
|
16
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Style/AsciiComments:
|
20
|
-
Description: 'Use only ascii symbols in comments.'
|
21
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
|
22
|
-
Enabled: false
|
23
|
-
|
24
|
-
Naming/AsciiIdentifiers:
|
25
|
-
Description: 'Use only ascii symbols in identifiers.'
|
26
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
Style/Attr:
|
30
|
-
Description: 'Checks for uses of Module#attr.'
|
31
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
|
32
|
-
Enabled: false
|
33
|
-
|
34
|
-
Metrics/BlockNesting:
|
35
|
-
Description: 'Avoid excessive block nesting'
|
36
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
|
37
|
-
Enabled: false
|
38
|
-
|
39
|
-
Style/CaseEquality:
|
40
|
-
Description: 'Avoid explicit use of the case equality operator(===).'
|
41
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
|
42
|
-
Enabled: false
|
43
|
-
|
44
|
-
Style/CharacterLiteral:
|
45
|
-
Description: 'Checks for uses of character literals.'
|
46
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
|
47
|
-
Enabled: false
|
48
|
-
|
49
|
-
Style/ClassAndModuleChildren:
|
50
|
-
Description: 'Checks style of children classes and modules.'
|
51
|
-
Enabled: true
|
52
|
-
EnforcedStyle: nested
|
53
|
-
|
54
|
-
Metrics/ClassLength:
|
55
|
-
Description: 'Avoid classes longer than 100 lines of code.'
|
56
|
-
Enabled: false
|
57
|
-
|
58
|
-
Metrics/ModuleLength:
|
59
|
-
Description: 'Avoid modules longer than 100 lines of code.'
|
60
|
-
Enabled: false
|
61
|
-
|
62
|
-
Style/ClassVars:
|
63
|
-
Description: 'Avoid the use of class variables.'
|
64
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
|
65
|
-
Enabled: false
|
66
|
-
|
67
|
-
Style/CollectionMethods:
|
68
|
-
Enabled: true
|
69
|
-
PreferredMethods:
|
70
|
-
find: detect
|
71
|
-
inject: reduce
|
72
|
-
collect: map
|
73
|
-
find_all: select
|
74
|
-
|
75
|
-
Style/ColonMethodCall:
|
76
|
-
Description: 'Do not use :: for method call.'
|
77
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
|
78
|
-
Enabled: false
|
79
|
-
|
80
|
-
Style/CommentAnnotation:
|
81
|
-
Description: >-
|
82
|
-
Checks formatting of special comments
|
83
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
84
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
|
85
|
-
Enabled: false
|
86
|
-
|
87
|
-
Metrics/AbcSize:
|
88
|
-
Description: >-
|
89
|
-
A calculated magnitude based on number of assignments,
|
90
|
-
branches, and conditions.
|
91
|
-
Enabled: false
|
92
|
-
|
93
|
-
Metrics/BlockLength:
|
94
|
-
CountComments: true # count full line comments?
|
95
|
-
Max: 25
|
96
|
-
ExcludedMethods: []
|
97
|
-
Exclude:
|
98
|
-
- "spec/**/*"
|
99
|
-
|
100
|
-
Metrics/CyclomaticComplexity:
|
101
|
-
Description: >-
|
102
|
-
A complexity metric that is strongly correlated to the number
|
103
|
-
of test cases needed to validate a method.
|
104
|
-
Enabled: false
|
105
|
-
|
106
|
-
Rails/Delegate:
|
107
|
-
Description: 'Prefer delegate method for delegations.'
|
108
|
-
Enabled: false
|
109
|
-
|
110
|
-
Style/PreferredHashMethods:
|
111
|
-
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
112
|
-
StyleGuide: '#hash-key'
|
113
|
-
Enabled: false
|
114
|
-
|
115
|
-
Style/Documentation:
|
116
|
-
Description: 'Document classes and non-namespace modules.'
|
117
|
-
Enabled: false
|
118
|
-
|
119
|
-
Style/DoubleNegation:
|
120
|
-
Description: 'Checks for uses of double negation (!!).'
|
121
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
|
122
|
-
Enabled: false
|
123
|
-
|
124
|
-
Style/EachWithObject:
|
125
|
-
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
|
126
|
-
Enabled: false
|
127
|
-
|
128
|
-
Style/EmptyLiteral:
|
129
|
-
Description: 'Prefer literals to Array.new/Hash.new/String.new.'
|
130
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
|
131
|
-
Enabled: false
|
132
|
-
|
133
|
-
# Checks whether the source file has a utf-8 encoding comment or not
|
134
|
-
# AutoCorrectEncodingComment must match the regex
|
135
|
-
# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
|
136
|
-
Style/Encoding:
|
137
|
-
Enabled: false
|
138
|
-
|
139
|
-
Style/EvenOdd:
|
140
|
-
Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
|
141
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
142
|
-
Enabled: false
|
143
|
-
|
144
|
-
Naming/FileName:
|
145
|
-
Description: 'Use snake_case for source file names.'
|
146
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
|
147
|
-
Enabled: false
|
148
|
-
|
149
|
-
Style/FrozenStringLiteralComment:
|
150
|
-
Description: >-
|
151
|
-
Add the frozen_string_literal comment to the top of files
|
152
|
-
to help transition from Ruby 2.3.0 to Ruby 3.0.
|
153
|
-
Enabled: false
|
154
|
-
|
155
|
-
Style/FlipFlop:
|
156
|
-
Description: 'Checks for flip flops'
|
157
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
|
158
|
-
Enabled: false
|
159
|
-
|
160
|
-
Style/FormatString:
|
161
|
-
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
162
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
|
163
|
-
Enabled: false
|
164
|
-
|
165
|
-
Style/GlobalVars:
|
166
|
-
Description: 'Do not introduce global variables.'
|
167
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
|
168
|
-
Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
|
169
|
-
Enabled: false
|
170
|
-
|
171
|
-
Style/GuardClause:
|
172
|
-
Description: 'Check for conditionals that can be replaced with guard clauses'
|
173
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
|
174
|
-
Enabled: false
|
175
|
-
|
176
|
-
Style/IfUnlessModifier:
|
177
|
-
Description: >-
|
178
|
-
Favor modifier if/unless usage when you have a
|
179
|
-
single-line body.
|
180
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
|
181
|
-
Enabled: false
|
182
|
-
|
183
|
-
Style/IfWithSemicolon:
|
184
|
-
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
185
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
|
186
|
-
Enabled: false
|
187
|
-
|
188
|
-
Style/InlineComment:
|
189
|
-
Description: 'Avoid inline comments.'
|
190
|
-
Enabled: false
|
191
|
-
|
192
|
-
Style/Lambda:
|
193
|
-
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
194
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
|
195
|
-
Enabled: false
|
196
|
-
|
197
|
-
Style/LambdaCall:
|
198
|
-
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
199
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
|
200
|
-
Enabled: false
|
201
|
-
|
202
|
-
Style/LineEndConcatenation:
|
203
|
-
Description: >-
|
204
|
-
Use \ instead of + or << to concatenate two string literals at
|
205
|
-
line end.
|
206
|
-
Enabled: false
|
207
|
-
|
208
|
-
Metrics/LineLength:
|
209
|
-
Description: 'Limit lines to 80 characters.'
|
210
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
|
211
|
-
Max: 80
|
212
|
-
|
213
|
-
Metrics/MethodLength:
|
214
|
-
Description: 'Avoid methods longer than 10 lines of code.'
|
215
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
|
216
|
-
Enabled: false
|
217
|
-
|
218
|
-
Style/ModuleFunction:
|
219
|
-
Description: 'Checks for usage of `extend self` in modules.'
|
220
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
|
221
|
-
Enabled: false
|
222
|
-
|
223
|
-
Style/MultilineBlockChain:
|
224
|
-
Description: 'Avoid multi-line chains of blocks.'
|
225
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
|
226
|
-
Enabled: false
|
227
|
-
|
228
|
-
Style/NegatedIf:
|
229
|
-
Description: >-
|
230
|
-
Favor unless over if for negative conditions
|
231
|
-
(or control flow or).
|
232
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
|
233
|
-
Enabled: false
|
234
|
-
|
235
|
-
Style/NegatedWhile:
|
236
|
-
Description: 'Favor until over while for negative conditions.'
|
237
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
|
238
|
-
Enabled: false
|
239
|
-
|
240
|
-
Style/Next:
|
241
|
-
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
242
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
|
243
|
-
Enabled: false
|
244
|
-
|
245
|
-
Style/NilComparison:
|
246
|
-
Description: 'Prefer x.nil? to x == nil.'
|
247
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
248
|
-
Enabled: false
|
249
|
-
|
250
|
-
Style/Not:
|
251
|
-
Description: 'Use ! instead of not.'
|
252
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
|
253
|
-
Enabled: false
|
254
|
-
|
255
|
-
Style/NumericLiterals:
|
256
|
-
Description: >-
|
257
|
-
Add underscores to large numeric literals to improve their
|
258
|
-
readability.
|
259
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
|
260
|
-
Enabled: false
|
261
|
-
|
262
|
-
Style/OneLineConditional:
|
263
|
-
Description: >-
|
264
|
-
Favor the ternary operator(?:) over
|
265
|
-
if/then/else/end constructs.
|
266
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
|
267
|
-
Enabled: false
|
268
|
-
|
269
|
-
Naming/BinaryOperatorParameterName:
|
270
|
-
Description: 'When defining binary operators, name the argument other.'
|
271
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
|
272
|
-
Enabled: false
|
273
|
-
|
274
|
-
Metrics/ParameterLists:
|
275
|
-
Description: 'Avoid parameter lists longer than three or four parameters.'
|
276
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
|
277
|
-
Enabled: false
|
278
|
-
|
279
|
-
Style/PercentLiteralDelimiters:
|
280
|
-
Description: 'Use `%`-literal delimiters consistently'
|
281
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
|
282
|
-
Enabled: false
|
283
|
-
|
284
|
-
Style/PerlBackrefs:
|
285
|
-
Description: 'Avoid Perl-style regex back references.'
|
286
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
|
287
|
-
Enabled: false
|
288
|
-
|
289
|
-
Naming/PredicateName:
|
290
|
-
Description: 'Check the names of predicate methods.'
|
291
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
|
292
|
-
NamePrefixBlacklist:
|
293
|
-
- is_
|
294
|
-
Exclude:
|
295
|
-
- spec/**/*
|
296
|
-
|
297
|
-
Style/Proc:
|
298
|
-
Description: 'Use proc instead of Proc.new.'
|
299
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
|
300
|
-
Enabled: false
|
301
|
-
|
302
|
-
Style/RaiseArgs:
|
303
|
-
Description: 'Checks the arguments passed to raise/fail.'
|
304
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
|
305
|
-
Enabled: false
|
306
|
-
|
307
|
-
Style/RegexpLiteral:
|
308
|
-
Description: 'Use / or %r around regular expressions.'
|
309
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
|
310
|
-
Enabled: false
|
311
|
-
|
312
|
-
Style/SelfAssignment:
|
313
|
-
Description: >-
|
314
|
-
Checks for places where self-assignment shorthand should have
|
315
|
-
been used.
|
316
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
|
317
|
-
Enabled: false
|
318
|
-
|
319
|
-
Style/SingleLineBlockParams:
|
320
|
-
Description: 'Enforces the names of some block params.'
|
321
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
|
322
|
-
Enabled: false
|
323
|
-
|
324
|
-
Style/SingleLineMethods:
|
325
|
-
Description: 'Avoid single-line methods.'
|
326
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
|
327
|
-
Enabled: false
|
328
|
-
|
329
|
-
Style/SignalException:
|
330
|
-
Description: 'Checks for proper usage of fail and raise.'
|
331
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
|
332
|
-
Enabled: false
|
333
|
-
|
334
|
-
Style/SpecialGlobalVars:
|
335
|
-
Description: 'Avoid Perl-style global variables.'
|
336
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
|
337
|
-
Enabled: false
|
338
|
-
|
339
|
-
Style/StringLiterals:
|
340
|
-
Description: 'Checks if uses of quotes match the configured preference.'
|
341
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
|
342
|
-
EnforcedStyle: double_quotes
|
343
|
-
Enabled: true
|
344
|
-
|
345
|
-
Style/TrailingCommaInArguments:
|
346
|
-
Description: 'Checks for trailing comma in argument lists.'
|
347
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
348
|
-
EnforcedStyleForMultiline: comma
|
349
|
-
SupportedStylesForMultiline:
|
350
|
-
- comma
|
351
|
-
- consistent_comma
|
352
|
-
- no_comma
|
353
|
-
Enabled: true
|
354
|
-
|
355
|
-
Style/TrailingCommaInArrayLiteral:
|
356
|
-
Description: 'Checks for trailing comma in array literals.'
|
357
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
358
|
-
EnforcedStyleForMultiline: comma
|
359
|
-
SupportedStylesForMultiline:
|
360
|
-
- comma
|
361
|
-
- consistent_comma
|
362
|
-
- no_comma
|
363
|
-
Enabled: true
|
364
|
-
|
365
|
-
Style/TrailingCommaInHashLiteral:
|
366
|
-
Description: 'Checks for trailing comma in hash literals.'
|
367
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
368
|
-
EnforcedStyleForMultiline: comma
|
369
|
-
SupportedStylesForMultiline:
|
370
|
-
- comma
|
371
|
-
- consistent_comma
|
372
|
-
- no_comma
|
373
|
-
Enabled: true
|
374
|
-
|
375
|
-
Style/TrivialAccessors:
|
376
|
-
Description: 'Prefer attr_* methods to trivial readers/writers.'
|
377
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
|
378
|
-
Enabled: false
|
379
|
-
|
380
|
-
Style/VariableInterpolation:
|
381
|
-
Description: >-
|
382
|
-
Don't interpolate global, instance and class variables
|
383
|
-
directly in strings.
|
384
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
|
385
|
-
Enabled: false
|
386
|
-
|
387
|
-
Style/WhenThen:
|
388
|
-
Description: 'Use when x then ... for one-line cases.'
|
389
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
|
390
|
-
Enabled: false
|
391
|
-
|
392
|
-
Style/WhileUntilModifier:
|
393
|
-
Description: >-
|
394
|
-
Favor modifier while/until usage when you have a
|
395
|
-
single-line body.
|
396
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
|
397
|
-
Enabled: false
|
398
|
-
|
399
|
-
Style/WordArray:
|
400
|
-
Description: 'Use %w or %W for arrays of words.'
|
401
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
|
402
|
-
Enabled: false
|
403
|
-
|
404
|
-
# Layout
|
405
|
-
|
406
|
-
Layout/AlignParameters:
|
407
|
-
Description: 'Here we check if the parameters on a multi-line method call or definition are aligned.'
|
408
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
|
409
|
-
Enabled: false
|
410
|
-
|
411
|
-
Layout/ConditionPosition:
|
412
|
-
Description: >-
|
413
|
-
Checks for condition placed in a confusing position relative to
|
414
|
-
the keyword.
|
415
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
|
416
|
-
Enabled: false
|
417
|
-
|
418
|
-
Layout/DotPosition:
|
419
|
-
Description: 'Checks the position of the dot in multi-line method calls.'
|
420
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
|
421
|
-
EnforcedStyle: trailing
|
422
|
-
|
423
|
-
Layout/ExtraSpacing:
|
424
|
-
Description: 'Do not use unnecessary spacing.'
|
425
|
-
Enabled: true
|
426
|
-
|
427
|
-
Layout/MultilineOperationIndentation:
|
428
|
-
Description: >-
|
429
|
-
Checks indentation of binary operations that span more than
|
430
|
-
one line.
|
431
|
-
Enabled: true
|
432
|
-
EnforcedStyle: indented
|
433
|
-
|
434
|
-
Layout/MultilineMethodCallIndentation:
|
435
|
-
Description: >-
|
436
|
-
Checks indentation of method calls with the dot operator
|
437
|
-
that span more than one line.
|
438
|
-
Enabled: true
|
439
|
-
EnforcedStyle: indented
|
440
|
-
|
441
|
-
Layout/InitialIndentation:
|
442
|
-
Description: >-
|
443
|
-
Checks the indentation of the first non-blank non-comment line in a file.
|
444
|
-
Enabled: false
|
445
|
-
|
446
|
-
# Lint
|
447
|
-
|
448
|
-
Lint/AmbiguousOperator:
|
449
|
-
Description: >-
|
450
|
-
Checks for ambiguous operators in the first argument of a
|
451
|
-
method invocation without parentheses.
|
452
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
|
453
|
-
Enabled: false
|
454
|
-
|
455
|
-
Lint/AmbiguousRegexpLiteral:
|
456
|
-
Description: >-
|
457
|
-
Checks for ambiguous regexp literals in the first argument of
|
458
|
-
a method invocation without parenthesis.
|
459
|
-
Enabled: false
|
460
|
-
|
461
|
-
Lint/AssignmentInCondition:
|
462
|
-
Description: "Don't use assignment in conditions."
|
463
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
|
464
|
-
Enabled: false
|
465
|
-
|
466
|
-
Lint/CircularArgumentReference:
|
467
|
-
Description: "Don't refer to the keyword argument in the default value."
|
468
|
-
Enabled: false
|
469
|
-
|
470
|
-
Lint/DeprecatedClassMethods:
|
471
|
-
Description: 'Check for deprecated class method calls.'
|
472
|
-
Enabled: false
|
473
|
-
|
474
|
-
Lint/DuplicatedKey:
|
475
|
-
Description: 'Check for duplicate keys in hash literals.'
|
476
|
-
Enabled: false
|
477
|
-
|
478
|
-
Lint/EachWithObjectArgument:
|
479
|
-
Description: 'Check for immutable argument given to each_with_object.'
|
480
|
-
Enabled: false
|
481
|
-
|
482
|
-
Lint/ElseLayout:
|
483
|
-
Description: 'Check for odd code arrangement in an else block.'
|
484
|
-
Enabled: false
|
485
|
-
|
486
|
-
Lint/FormatParameterMismatch:
|
487
|
-
Description: 'The number of parameters to format/sprint must match the fields.'
|
488
|
-
Enabled: false
|
489
|
-
|
490
|
-
Lint/HandleExceptions:
|
491
|
-
Description: "Don't suppress exception."
|
492
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
|
493
|
-
Enabled: false
|
494
|
-
|
495
|
-
Lint/LiteralAsCondition:
|
496
|
-
Description: 'Checks of literals used in conditions.'
|
497
|
-
Enabled: false
|
498
|
-
|
499
|
-
Lint/LiteralInInterpolation:
|
500
|
-
Description: 'Checks for literals used in interpolation.'
|
501
|
-
Enabled: false
|
502
|
-
|
503
|
-
Lint/Loop:
|
504
|
-
Description: >-
|
505
|
-
Use Kernel#loop with break rather than begin/end/until or
|
506
|
-
begin/end/while for post-loop tests.
|
507
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
|
508
|
-
Enabled: false
|
509
|
-
|
510
|
-
Lint/NestedMethodDefinition:
|
511
|
-
Description: 'Do not use nested method definitions.'
|
512
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
|
513
|
-
Enabled: false
|
514
|
-
|
515
|
-
Lint/NonLocalExitFromIterator:
|
516
|
-
Description: 'Do not use return in iterator to cause non-local exit.'
|
517
|
-
Enabled: false
|
518
|
-
|
519
|
-
Lint/ParenthesesAsGroupedExpression:
|
520
|
-
Description: >-
|
521
|
-
Checks for method calls with a space before the opening
|
522
|
-
parenthesis.
|
523
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
|
524
|
-
Enabled: false
|
525
|
-
|
526
|
-
Lint/RequireParentheses:
|
527
|
-
Description: >-
|
528
|
-
Use parentheses in the method call to avoid confusion
|
529
|
-
about precedence.
|
530
|
-
Enabled: false
|
531
|
-
|
532
|
-
Lint/UnderscorePrefixedVariableName:
|
533
|
-
Description: 'Do not use prefix `_` for a variable that is used.'
|
534
|
-
Enabled: false
|
535
|
-
|
536
|
-
Lint/UnneededCopDisableDirective:
|
537
|
-
Description: >-
|
538
|
-
Checks for rubocop:disable comments that can be removed.
|
539
|
-
Note: this cop is not disabled when disabling all cops.
|
540
|
-
It must be explicitly disabled.
|
541
|
-
Enabled: false
|
542
|
-
|
543
|
-
Lint/Void:
|
544
|
-
Description: 'Possible use of operator/literal/variable in void context.'
|
545
|
-
Enabled: false
|
546
|
-
|
547
|
-
# Performance
|
548
|
-
|
549
|
-
Performance/CaseWhenSplat:
|
550
|
-
Description: >-
|
551
|
-
Place `when` conditions that use splat at the end
|
552
|
-
of the list of `when` branches.
|
553
|
-
Enabled: false
|
554
|
-
|
555
|
-
Performance/Count:
|
556
|
-
Description: >-
|
557
|
-
Use `count` instead of `select...size`, `reject...size`,
|
558
|
-
`select...count`, `reject...count`, `select...length`,
|
559
|
-
and `reject...length`.
|
560
|
-
Enabled: false
|
561
|
-
|
562
|
-
Performance/Detect:
|
563
|
-
Description: >-
|
564
|
-
Use `detect` instead of `select.first`, `find_all.first`,
|
565
|
-
`select.last`, and `find_all.last`.
|
566
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
567
|
-
Enabled: false
|
568
|
-
|
569
|
-
Performance/FlatMap:
|
570
|
-
Description: >-
|
571
|
-
Use `Enumerable#flat_map`
|
572
|
-
instead of `Enumerable#map...Array#flatten(1)`
|
573
|
-
or `Enumberable#collect..Array#flatten(1)`
|
574
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
575
|
-
Enabled: false
|
576
|
-
|
577
|
-
Performance/ReverseEach:
|
578
|
-
Description: 'Use `reverse_each` instead of `reverse.each`.'
|
579
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
580
|
-
Enabled: false
|
581
|
-
|
582
|
-
Performance/Sample:
|
583
|
-
Description: >-
|
584
|
-
Use `sample` instead of `shuffle.first`,
|
585
|
-
`shuffle.last`, and `shuffle[Fixnum]`.
|
586
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
587
|
-
Enabled: false
|
588
|
-
|
589
|
-
Performance/Size:
|
590
|
-
Description: >-
|
591
|
-
Use `size` instead of `count` for counting
|
592
|
-
the number of elements in `Array` and `Hash`.
|
593
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
|
594
|
-
Enabled: false
|
595
|
-
|
596
|
-
Performance/StringReplacement:
|
597
|
-
Description: >-
|
598
|
-
Use `tr` instead of `gsub` when you are replacing the same
|
599
|
-
number of characters. Use `delete` instead of `gsub` when
|
600
|
-
you are deleting characters.
|
601
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
602
|
-
Enabled: false
|
603
|
-
|
604
|
-
# Rails
|
605
|
-
|
606
|
-
Rails/ActionFilter:
|
607
|
-
Description: 'Enforces consistent use of action filter methods.'
|
608
|
-
Enabled: false
|
609
|
-
|
610
|
-
Rails/Date:
|
611
|
-
Description: >-
|
612
|
-
Checks the correct usage of date aware methods,
|
613
|
-
such as Date.today, Date.current etc.
|
614
|
-
Enabled: false
|
615
|
-
|
616
|
-
Rails/FindBy:
|
617
|
-
Description: 'Prefer find_by over where.first.'
|
618
|
-
Enabled: false
|
619
|
-
|
620
|
-
Rails/FindEach:
|
621
|
-
Description: 'Prefer all.find_each over all.find.'
|
622
|
-
Enabled: false
|
623
|
-
|
624
|
-
Rails/HasAndBelongsToMany:
|
625
|
-
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
626
|
-
Enabled: false
|
627
|
-
|
628
|
-
Rails/Output:
|
629
|
-
Description: 'Checks for calls to puts, print, etc.'
|
630
|
-
Enabled: false
|
631
|
-
|
632
|
-
Rails/ReadWriteAttribute:
|
633
|
-
Description: >-
|
634
|
-
Checks for read_attribute(:attr) and
|
635
|
-
write_attribute(:attr, val).
|
636
|
-
Enabled: false
|
637
|
-
|
638
|
-
Rails/ScopeArgs:
|
639
|
-
Description: 'Checks the arguments of ActiveRecord scopes.'
|
640
|
-
Enabled: false
|
641
|
-
|
642
|
-
Rails/TimeZone:
|
643
|
-
Description: 'Checks the correct usage of time zone aware methods.'
|
644
|
-
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
|
645
|
-
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
646
|
-
Enabled: false
|
647
|
-
|
648
|
-
Rails/Validation:
|
649
|
-
Description: 'Use validates :attribute, hash of validations.'
|
650
|
-
Enabled: false
|