isodoc 1.5.4 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8da1e26ad7132ffa08da0fcea2d5690591d195fed192f9de480f142045526f00
4
- data.tar.gz: 6f7790baee1639e89aa09f8234a17dd024cac0a9d47ad95039f2caa273264d94
3
+ metadata.gz: 8bdc454593acf1b0a4d0a9cc04a6338de5848e3e28b77a3fc22126d8c445f07b
4
+ data.tar.gz: d4e1a7f0db4f38fdb76eaae029a26fda9d04bb43a5d25d03ad82e7956e247c5b
5
5
  SHA512:
6
- metadata.gz: 5f72f7cbc23636918dade5e52ceb6e1115cdd018b4a051ffd965162d11c081b6e7dfcafe04cf583373e55d5f2262d4393823497b7a5ed4a0a8d248dc5c1574a6
7
- data.tar.gz: 249e6bb5247039595870c52969c49bc4acbb40a1dcae798a4f925ab6fa5ea4640a22a8defdd60ad64134159a21f26088268324ce2381f00aa79db673ffcb3695
6
+ metadata.gz: fae8cdbb24965be799d0e8bf084dc56c7af1cd303981a3b151f039bc51184dec5792e6537641fad9f0dd5b7098262d961277a5f10a9eb0673e0739775baaaf74
7
+ data.tar.gz: e300abaa10548c18961d1aac9ab111c6cc392821d28d29c6083c2daab4dcef2a7b245858689995f7f0adb6afad35452707a4dbaaf60b63b463bf4f05305a4298
data/.rubocop.yml CHANGED
@@ -1,10 +1,14 @@
1
1
  # This project follows the Ribose OSS style guide.
2
2
  # https://github.com/riboseinc/oss-guides
3
3
  # All project-specific additions and overrides should be specified in this file.
4
-
5
4
  inherit_from:
6
5
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
6
+
7
+ # local repo-specific modifications
8
+
7
9
  AllCops:
8
- TargetRubyVersion: 2.3
10
+ DisplayCopNames: false
11
+ StyleGuideCopsOnly: false
12
+ TargetRubyVersion: 2.4
9
13
  Rails:
10
14
  Enabled: true
data/isodoc.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.add_dependency "uuidtools"
36
36
  spec.add_dependency "html2doc", "~> 1.0.0"
37
37
  spec.add_dependency "liquid", "~> 4"
38
- spec.add_dependency "twitter_cldr"
38
+ spec.add_dependency "twitter_cldr", ">= 6.6.0"
39
39
  spec.add_dependency "roman-numerals"
40
40
  spec.add_dependency "metanorma", "~> 1.2.0"
41
41
  spec.add_dependency "relaton-cli"
@@ -47,7 +47,7 @@ Gem::Specification.new do |spec|
47
47
  spec.add_development_dependency "guard", "~> 2.14"
48
48
  spec.add_development_dependency "guard-rspec", "~> 4.7"
49
49
  spec.add_development_dependency "rspec", "~> 3.6"
50
- spec.add_development_dependency "rubocop", "= 0.54.0"
50
+ spec.add_development_dependency "rubocop", "~> 1.5.2"
51
51
  spec.add_development_dependency "simplecov", "~> 0.15"
52
52
  spec.add_development_dependency "timecop", "~> 0.9"
53
53
  spec.add_development_dependency "rexml"
@@ -12,7 +12,9 @@ module IsoDoc
12
12
  attr_accessor :meta
13
13
 
14
14
  # htmlstylesheet: Generic stylesheet for HTML
15
+ # htmlstylesheet_override: Override stylesheet for HTML
15
16
  # wordstylesheet: Generic stylesheet for Word
17
+ # wordstylesheet_override: Override stylesheet for Word
16
18
  # standardsheet: Stylesheet specific to Standard
17
19
  # header: Header file for Word
18
20
  # htmlcoverpage: Cover page for HTML
@@ -48,6 +50,8 @@ module IsoDoc
48
50
  @tempfile_cache = []
49
51
  @htmlstylesheet_name = options[:htmlstylesheet]
50
52
  @wordstylesheet_name = options[:wordstylesheet]
53
+ @htmlstylesheet_override_name = options[:htmlstylesheet_override]
54
+ @wordstylesheet_override_name = options[:wordstylesheet_override]
51
55
  @standardstylesheet_name = options[:standardstylesheet]
52
56
  @header = options[:header]
53
57
  @htmlcoverpage = options[:htmlcoverpage]
data/lib/isodoc/css.rb CHANGED
@@ -19,6 +19,12 @@ module IsoDoc
19
19
  @htmlstylesheet = generate_css(@htmlstylesheet_name, true)
20
20
  @wordstylesheet = generate_css(@wordstylesheet_name, false)
21
21
  @standardstylesheet = generate_css(@standardstylesheet_name, false)
22
+ if @htmlstylesheet_override_name
23
+ @htmlstylesheet_override = File.open(@htmlstylesheet_override_name)
24
+ end
25
+ if @wordstylesheet_override_name
26
+ @wordstylesheet_override = File.open(@wordstylesheet_override_name)
27
+ end
22
28
  end
23
29
 
24
30
  def default_fonts(_options)
@@ -77,7 +83,6 @@ module IsoDoc
77
83
  # stripwordcss if HTML stylesheet, !stripwordcss if DOC stylesheet
78
84
  def generate_css(filename, stripwordcss)
79
85
  return nil if filename.nil?
80
-
81
86
  filename = precompiled_style_or_original(filename)
82
87
  stylesheet = File.read(filename, encoding: 'UTF-8')
83
88
  stylesheet = populate_template(stylesheet, :word)
@@ -87,7 +87,7 @@ module IsoDoc::Function
87
87
 
88
88
  def omit_docid_prefix(prefix)
89
89
  return true if prefix.nil? || prefix.empty?
90
- return %w(ISO IEC IEV ITU W3C metanorma rfc-anchor).include? prefix
90
+ return %w(ISO IEC IEV ITU W3C csd metanorma rfc-anchor).include? prefix
91
91
  end
92
92
 
93
93
  def date_note_process(b, ref)
@@ -44,12 +44,14 @@ module IsoDoc::HtmlFunction
44
44
  IsoDoc::HtmlFunction::MathvariantToPlain.new(docxml).convert
45
45
  end
46
46
 
47
- def htmlstylesheet
48
- @htmlstylesheet.open
49
- stylesheet = @htmlstylesheet.read
47
+ def htmlstylesheet(file)
48
+ return if file.nil?
49
+ file.open if file.is_a?(Tempfile)
50
+ stylesheet = file.read
50
51
  xml = Nokogiri::XML("<style/>")
51
52
  xml.children.first << Nokogiri::XML::Comment.new(xml, "\n#{stylesheet}\n")
52
- @htmlstylesheet.close!
53
+ file.close
54
+ file.unlink if file.is_a?(Tempfile)
53
55
  xml.root.to_s
54
56
  end
55
57
 
@@ -57,7 +59,8 @@ module IsoDoc::HtmlFunction
57
59
  return docxml unless @htmlstylesheet
58
60
  title = docxml.at("//*[local-name() = 'head']/*[local-name() = 'title']")
59
61
  head = docxml.at("//*[local-name() = 'head']")
60
- head << htmlstylesheet
62
+ head << htmlstylesheet(@htmlstylesheet)
63
+ s = htmlstylesheet(@htmlstylesheet_override) and head << s
61
64
  docxml
62
65
  end
63
66
 
@@ -1,6 +1,5 @@
1
1
  require "twitter_cldr"
2
2
  require "bigdecimal"
3
- require_relative "../../twitter-cldr/patch"
4
3
 
5
4
  module IsoDoc
6
5
  class PresentationXMLConvert < ::IsoDoc::Convert
@@ -168,7 +167,6 @@ module IsoDoc
168
167
  # By itself twitter-cldr does not support fraction part digits grouping
169
168
  # and custom delimeter, will decorate fraction part manually
170
169
  def localized_number(num, locale, precision)
171
- TwitterCldr::Localized::LocalizedNumber.localize(BigDecimal)
172
170
  localized = (precision == 0) ? num.localize(locale).to_s :
173
171
  num.localize(locale).to_decimal.to_s(:precision => precision)
174
172
  twitter_cldr_reader_symbols = twitter_cldr_reader(locale)
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.5.4".freeze
2
+ VERSION = "1.5.5".freeze
3
3
  end
@@ -37,17 +37,27 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
37
37
 
38
38
  def toWord(result, filename, dir, header)
39
39
  result = from_xhtml(word_cleanup(to_xhtml(result)))
40
- unless @landscapestyle.empty?
41
- @wordstylesheet&.open
42
- @wordstylesheet&.write(@landscapestyle)
43
- @wordstylesheet&.close
44
- end
40
+ @wordstylesheet = wordstylesheet_update
45
41
  Html2Doc.process(result, filename: filename, stylesheet: @wordstylesheet&.path,
46
42
  header_file: header&.path, dir: dir,
47
43
  asciimathdelims: [@openmathdelim, @closemathdelim],
48
44
  liststyles: { ul: @ulstyle, ol: @olstyle })
49
45
  header&.unlink
50
- @wordstylesheet&.unlink
46
+ @wordstylesheet&.unlink if @wordstylesheet&.is_a?(Tempfile)
47
+ end
48
+
49
+ def wordstylesheet_update()
50
+ return if @wordstylesheet.nil?
51
+ f = File.open(@wordstylesheet.path, "a")
52
+ @landscapestyle.empty? or f.write(@landscapestyle)
53
+ if @wordstylesheet_override && @wordstylesheet
54
+ f.write(@wordstylesheet_override.read)
55
+ @wordstylesheet_override.close
56
+ elsif @wordstylesheet_override && !@wordstylesheet
57
+ @wordstylesheet = @wordstylesheet_override
58
+ end
59
+ f.close
60
+ @wordstylesheet
51
61
  end
52
62
 
53
63
  def word_admonition_images(docxml)
data/lib/isodoc/xref.rb CHANGED
@@ -49,7 +49,7 @@ module IsoDoc
49
49
  note_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
50
50
  example_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
51
51
  list_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
52
- bookmark_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
52
+ bookmark_anchor_names(docxml)
53
53
  end
54
54
 
55
55
  def ns(xpath)
@@ -94,16 +94,17 @@ module IsoDoc::XrefGen
94
94
  "not(self::xmlns:terms) and not(self::xmlns:definitions)]//"\
95
95
  "xmlns:example | ./xmlns:example".freeze
96
96
 
97
- CHILD_SECTIONS = "./clause | ./appendix | ./terms | ./definitions | ./references"
97
+ CHILD_SECTIONS = "./clause | ./appendix | ./terms | ./definitions | "\
98
+ "./references"
98
99
 
99
100
  def example_anchor_names(sections)
100
101
  sections.each do |s|
101
102
  notes = s.xpath(CHILD_EXAMPLES_XPATH)
102
103
  c = Counter.new
103
104
  notes.each do |n|
104
- next if @anchors[n["id"]]
105
- next if n["id"].nil? || n["id"].empty?
106
- idx = notes.size == 1 && !n["number"] ? "" : " #{c.increment(n).print}"
105
+ next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
106
+ idx = notes.size == 1 && !n["number"] ? "" :
107
+ " #{c.increment(n).print}"
107
108
  @anchors[n["id"]] = anchor_struct(idx, n, @labels["example_xref"],
108
109
  "example", n["unnumbered"])
109
110
  end
@@ -119,7 +120,8 @@ module IsoDoc::XrefGen
119
120
  notes.each do |n|
120
121
  next if n["id"].nil? || n["id"].empty?
121
122
  idx = notes.size == 1 && !n["number"] ? "" : " #{c.increment(n).print}"
122
- @anchors[n["id"]] = anchor_struct(idx, n, @labels["list"], "list", false)
123
+ @anchors[n["id"]] = anchor_struct(idx, n, @labels["list"], "list",
124
+ false)
123
125
  list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
124
126
  end
125
127
  list_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
@@ -141,17 +143,16 @@ module IsoDoc::XrefGen
141
143
  end
142
144
  end
143
145
 
144
- def bookmark_anchor_names(sections)
145
- sections.each do |s|
146
- notes = s.xpath(ns(".//bookmark")) - s.xpath(ns(".//clause//bookmark")) -
147
- s.xpath(ns(".//appendix//bookmark"))
148
- notes.each do |n|
149
- next if n["id"].nil? || n["id"].empty?
150
- @anchors[n["id"]] = {
151
- type: "bookmark", label: nil, value: nil,
152
- xref: @anchors[s["id"]][:xref] }
146
+ def bookmark_anchor_names(docxml)
147
+ docxml.xpath(ns(".//bookmark")).each do |n|
148
+ next if n["id"].nil? || n["id"].empty?
149
+ parent = nil
150
+ n.ancestors.each do |a|
151
+ next unless a["id"] && parent = @anchors.dig(a["id"], :xref)
152
+ break
153
153
  end
154
- bookmark_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
154
+ @anchors[n["id"]] = { type: "bookmark", label: nil, value: nil,
155
+ xref: parent || "???" }
155
156
  end
156
157
  end
157
158
  end
@@ -24,6 +24,8 @@ module IsoDoc
24
24
  end
25
25
 
26
26
  def pdf_options(docxml)
27
+ font_manifest_file = @options.dig(:mn2pdf, :font_manifest_file)
28
+ "--font_manifest #{font_manifest_file}" if font_manifest_file
27
29
  ""
28
30
  end
29
31
 
@@ -0,0 +1 @@
1
+ /* html-override */
@@ -0,0 +1 @@
1
+ /* word-override */
@@ -83,6 +83,7 @@ expect(File.exist?("test.doc")).to be true
83
83
  expect(html).not_to match(/another empty stylesheet/)
84
84
  expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
85
85
  expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
86
+ expect(html).not_to match(/html-override/)
86
87
  end
87
88
 
88
89
  it "generates Word output docs with null configuration" do
@@ -101,6 +102,7 @@ expect(File.exist?("test.doc")).to be true
101
102
  word = File.read("test.doc")
102
103
  expect(word).to match(/one empty stylesheet/)
103
104
  expect(word).to match(/div\.table_container/)
105
+ expect(word).not_to match(/word-override/)
104
106
  end
105
107
 
106
108
  it "generates HTML output docs with null configuration from file" do
@@ -139,7 +141,7 @@ expect(File.exist?("test.doc")).to be true
139
141
  it "generates HTML output docs with complete configuration" do
140
142
  FileUtils.rm_f "test.doc"
141
143
  FileUtils.rm_f "test.html"
142
- IsoDoc::HtmlConvert.new({bodyfont: "Zapf", monospacefont: "Consolas", headerfont: "Comic Sans", normalfontsize: "30pt", monospacefontsize: "29pt", smallerfontsize: "28pt", footnotefontsize: "27pt", htmlstylesheet: "spec/assets/html.scss", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
144
+ IsoDoc::HtmlConvert.new({bodyfont: "Zapf", monospacefont: "Consolas", headerfont: "Comic Sans", normalfontsize: "30pt", monospacefontsize: "29pt", smallerfontsize: "28pt", footnotefontsize: "27pt", htmlstylesheet: "spec/assets/html.scss", htmlstylesheet_override: "spec/assets/html_override.css", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
143
145
  <iso-standard xmlns="http://riboseinc.com/isoxml">
144
146
  <preface><foreword>
145
147
  <note>
@@ -162,6 +164,7 @@ expect(File.exist?("test.doc")).to be true
162
164
  expect(html).to match(/This is > a script/)
163
165
  expect(html).not_to match(/CDATA/)
164
166
  expect(html).to match(%r{Anta&#x16D;parolo</h1>})
167
+ expect(html).to match(%r{html-override})
165
168
  end
166
169
 
167
170
  it "generates HTML output docs with default fonts" do
@@ -195,7 +198,7 @@ expect(File.exist?("test.doc")).to be true
195
198
  it "generates Word output docs with complete configuration" do
196
199
  FileUtils.rm_f "test.doc"
197
200
  FileUtils.rm_f "test.html"
198
- IsoDoc::WordConvert.new({bodyfont: "Zapf", monospacefont: "Consolas", headerfont: "Comic Sans", normalfontsize: "30pt", monospacefontsize: "29pt", smallerfontsize: "28pt", footnotefontsize: "27pt", wordstylesheet: "spec/assets/html.scss", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
201
+ IsoDoc::WordConvert.new({bodyfont: "Zapf", monospacefont: "Consolas", headerfont: "Comic Sans", normalfontsize: "30pt", monospacefontsize: "29pt", smallerfontsize: "28pt", footnotefontsize: "27pt", wordstylesheet: "spec/assets/html.scss", wordstylesheet_override: "spec/assets/word_override.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
199
202
  <iso-standard xmlns="http://riboseinc.com/isoxml">
200
203
  <preface><foreword>
201
204
  <note>
@@ -219,6 +222,7 @@ expect(File.exist?("test.doc")).to be true
219
222
  expect(word).to match(/an empty word cover page/)
220
223
  expect(word).to match(/an empty word intro page/)
221
224
  expect(word).to match(%r{Anta&#x16D;parolo</h1>})
225
+ expect(word).to match(%r{word-override})
222
226
  end
223
227
 
224
228
  it "generates Word output docs with default fonts" do
@@ -2583,9 +2583,10 @@ OUTPUT
2583
2583
  <terms id="terms"/>
2584
2584
  <clause id="widgets"><title>Widgets</title>
2585
2585
  <clause id="widgets1">
2586
- <p id="note1l" type="alphabet">
2586
+ <note id="note0"/>
2587
+ <note id="note1l" type="alphabet">
2587
2588
  <bookmark id="note1"/>
2588
- </p>
2589
+ </note>
2589
2590
  <p id="note2l" type="roman_upper">
2590
2591
  <bookmark id="note2"/>
2591
2592
  </p>
@@ -2599,9 +2600,9 @@ OUTPUT
2599
2600
  </p>
2600
2601
  </clause>
2601
2602
  <clause id="annex1b">
2602
- <p id="Anote1l" type="roman" start="4">
2603
+ <figure id="Anote1l" type="roman" start="4">
2603
2604
  <bookmark id="Anote1"/>
2604
- </p>
2605
+ </figure>
2605
2606
  <p id="Anote2l">
2606
2607
  <bookmark id="Anote2"/>
2607
2608
  </p>
@@ -2616,10 +2617,10 @@ OUTPUT
2616
2617
  <xref target='N1'>Introduction</xref>
2617
2618
  <xref target='N2'>Preparatory</xref>
2618
2619
  <xref target='N'>Clause 1</xref>
2619
- <xref target='note1'>Clause 3.1</xref>
2620
+ <xref target='note1'>Note 2</xref>
2620
2621
  <xref target='note2'>Clause 3.1</xref>
2621
2622
  <xref target='AN'>Annex A.1</xref>
2622
- <xref target='Anote1'>Annex A.2</xref>
2623
+ <xref target='Anote1'>Figure A.1</xref>
2623
2624
  <xref target='Anote2'>Annex A.2</xref>
2624
2625
  </p>
2625
2626
  </foreword>
@@ -2657,9 +2658,13 @@ OUTPUT
2657
2658
  </title>
2658
2659
  <clause id='widgets1'>
2659
2660
  <title>3.1.</title>
2660
- <p id='note1l' type='alphabet'>
2661
+ <note id='note0'>
2662
+ <name>NOTE 1</name>
2663
+ </note>
2664
+ <note id='note1l' type='alphabet'>
2665
+ <name>NOTE 2</name>
2661
2666
  <bookmark id='note1'/>
2662
- </p>
2667
+ </note>
2663
2668
  <p id='note2l' type='roman_upper'>
2664
2669
  <bookmark id='note2'/>
2665
2670
  </p>
@@ -2680,9 +2685,10 @@ OUTPUT
2680
2685
  </clause>
2681
2686
  <clause id='annex1b'>
2682
2687
  <title>A.2.</title>
2683
- <p id='Anote1l' type='roman' start='4'>
2688
+ <figure id='Anote1l' type='roman' start='4'>
2689
+ <name>Figure A.1</name>
2684
2690
  <bookmark id='Anote1'/>
2685
- </p>
2691
+ </figure>
2686
2692
  <p id='Anote2l'>
2687
2693
  <bookmark id='Anote2'/>
2688
2694
  </p>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-16 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 6.6.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 6.6.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: roman-numerals
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -266,16 +266,16 @@ dependencies:
266
266
  name: rubocop
267
267
  requirement: !ruby/object:Gem::Requirement
268
268
  requirements:
269
- - - '='
269
+ - - "~>"
270
270
  - !ruby/object:Gem::Version
271
- version: 0.54.0
271
+ version: 1.5.2
272
272
  type: :development
273
273
  prerelease: false
274
274
  version_requirements: !ruby/object:Gem::Requirement
275
275
  requirements:
276
- - - '='
276
+ - - "~>"
277
277
  - !ruby/object:Gem::Version
278
- version: 0.54.0
278
+ version: 1.5.2
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: simplecov
281
281
  requirement: !ruby/object:Gem::Requirement
@@ -332,8 +332,6 @@ files:
332
332
  - ".github/workflows/rake.yml"
333
333
  - ".hound.yml"
334
334
  - ".oss-guides.rubocop.yml"
335
- - ".rubocop.ribose.yml"
336
- - ".rubocop.tb.yml"
337
335
  - ".rubocop.yml"
338
336
  - CODE_OF_CONDUCT.md
339
337
  - Gemfile
@@ -418,9 +416,9 @@ files:
418
416
  - lib/isodoc/xref/xref_gen_seq.rb
419
417
  - lib/isodoc/xref/xref_sect_gen.rb
420
418
  - lib/isodoc/xslfo_convert.rb
421
- - lib/twitter-cldr/patch.rb
422
419
  - spec/assets/header.html
423
420
  - spec/assets/html.scss
421
+ - spec/assets/html_override.css
424
422
  - spec/assets/htmlcover.html
425
423
  - spec/assets/htmlintro.html
426
424
  - spec/assets/i18n.yaml
@@ -433,6 +431,7 @@ files:
433
431
  - spec/assets/scripts.html
434
432
  - spec/assets/std.css
435
433
  - spec/assets/word.css
434
+ - spec/assets/word_override.css
436
435
  - spec/assets/wordcover.html
437
436
  - spec/assets/wordintro.html
438
437
  - spec/isodoc/blocks_spec.rb
data/.rubocop.ribose.yml DELETED
@@ -1,65 +0,0 @@
1
- AllCops:
2
- Include:
3
- - "**/*.rake"
4
- - "**/Gemfile"
5
- - "**/*.gemfile"
6
- - "**/Rakefile"
7
- Exclude:
8
- - "vendor/**/*"
9
- - "db/**/*"
10
- - "tmp/**/*"
11
- DisplayCopNames: false
12
- StyleGuideCopsOnly: false
13
- Rails:
14
- Enabled: true
15
- Metrics/AbcSize:
16
- Description: A calculated magnitude based on number of assignments, branches, and
17
- conditions.
18
- Enabled: true
19
- Max: 15
20
- Metrics/BlockLength:
21
- Exclude:
22
- - "spec/**/*"
23
- Metrics/BlockNesting:
24
- Description: Avoid excessive block nesting
25
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count
26
- Enabled: true
27
- Max: 3
28
- Metrics/ClassLength:
29
- Description: Avoid classes longer than 100 lines of code.
30
- Enabled: false
31
- CountComments: false
32
- Max: 100
33
- Metrics/CyclomaticComplexity:
34
- Description: A complexity metric that is strongly correlated to the number of test
35
- cases needed to validate a method.
36
- Enabled: true
37
- Max: 6
38
- Metrics/LineLength:
39
- Description: Limit lines to 80 characters.
40
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits
41
- Enabled: true
42
- Max: 80
43
- AllowURI: true
44
- URISchemes:
45
- - http
46
- - https
47
- Metrics/MethodLength:
48
- Description: Avoid methods longer than 10 lines of code.
49
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
50
- Enabled: true
51
- CountComments: true
52
- Max: 10
53
- Exclude:
54
- - "spec/**/*"
55
- Metrics/ParameterLists:
56
- Description: Avoid long parameter lists.
57
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
58
- Enabled: true
59
- Max: 5
60
- CountKeywordArgs: true
61
- Metrics/PerceivedComplexity:
62
- Description: A complexity metric geared towards measuring complexity for a human
63
- reader.
64
- Enabled: true
65
- 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
@@ -1,39 +0,0 @@
1
- module ::TwitterCldr
2
- module Formatters
3
- class NumberFormatter
4
- def parse_number(number, options = {})
5
- precision = options[:precision] || precision_from(number)
6
- rounding = options[:rounding] || 0
7
- if number.is_a? BigDecimal
8
- number = precision == 0 ?
9
- round_to(number, precision, rounding).abs.fix.to_s("F") :
10
- round_to(number, precision, rounding).abs.round(precision).to_s("F")
11
- else
12
- number = "%.#{precision}f" % round_to(number, precision, rounding).abs
13
- end
14
- number.split(".")
15
- end
16
-
17
- def round_to(number, precision, rounding = 0)
18
- factor = 10 ** precision
19
- result = number.is_a?(BigDecimal) ?
20
- ((number * factor).fix / factor) :
21
- ((number * factor).round.to_f / factor)
22
- if rounding > 0
23
- rounding = rounding.to_f / factor
24
- result = number.is_a?(BigDecimal) ?
25
- ((result * (1.0 / rounding)).fix / (1.0 / rounding)) :
26
- ((result * (1.0 / rounding)).round.to_f / (1.0 / rounding))
27
- end
28
- result
29
- end
30
-
31
- def precision_from(num)
32
- return 0 if num.is_a?(BigDecimal) && num.fix == num
33
- parts = (num.is_a?(BigDecimal) ? num.to_s("F") : num.to_s ).split(".")
34
- parts.size == 2 ? parts[1].size : 0
35
- end
36
- end
37
- end
38
- end
39
-