haml_i18n_lint 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/gemfiles/haml_5.gemfile +4 -0
- data/haml_i18n_lint.gemspec +0 -1
- data/lib/haml_i18n_lint/config.rb +6 -6
- data/lib/haml_i18n_lint/linter/compiler_extension.rb +6 -1
- data/lib/haml_i18n_lint/version.rb +1 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78805af5b853ddbec51cf86d6c36a4066a3092b5
|
4
|
+
data.tar.gz: a3011cb66c6713c8477f19bb4d696c1fa7d0752b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 159555954c585b89cf66e299c7d7f4e8fb14681f13261da1ddd30c472bd2f799d8c50f4dfd012f4909d19ae7e578e5d594c87edf6fc01f110f5c8098f92259b2
|
7
|
+
data.tar.gz: fb19c060fd2cc561d2dc8b27a253974eea8e0a9bdae8fc530db40a7470db44f87143ed06b21878cb0660e974767387e49870af19a65df2199839e9cd39c5badf
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ The configuration file sample:
|
|
38
38
|
# You can override Config#need_i18n? that returns the content in Haml template need i18n or not.
|
39
39
|
def need_i18n?(content)
|
40
40
|
# the default behaviours is ignore white spaces and digits
|
41
|
-
/^[\s]+$/ !~ content && /
|
41
|
+
/^[\s]+$/ !~ content && /\p{Alpha}/ =~ content
|
42
42
|
end
|
43
43
|
|
44
44
|
# You can override Config#report in configuration file
|
data/gemfiles/haml_5.gemfile
CHANGED
data/haml_i18n_lint.gemspec
CHANGED
@@ -11,15 +11,10 @@ module HamlI18nLint
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
# @return [String] the translate method name
|
15
|
-
def i18n_method
|
16
|
-
't'
|
17
|
-
end
|
18
|
-
|
19
14
|
# @param content [String] the text content found in haml template
|
20
15
|
# @return [true, false] the content need i18n or not.
|
21
16
|
def need_i18n?(content)
|
22
|
-
/^[\s]+$/ !~ content && /
|
17
|
+
/^[\s]+$/ !~ content && /\p{Alpha}/ =~ content
|
23
18
|
end
|
24
19
|
|
25
20
|
# Output the formatted result
|
@@ -45,6 +40,11 @@ module HamlI18nLint
|
|
45
40
|
Dir[*@options.files]
|
46
41
|
end
|
47
42
|
|
43
|
+
# @return [String] the list of methods, which takes string. The string is no translation required.
|
44
|
+
def ignore_methods
|
45
|
+
%w(t render)
|
46
|
+
end
|
47
|
+
|
48
48
|
private
|
49
49
|
|
50
50
|
def load_config(config_content)
|
@@ -6,7 +6,12 @@ module HamlI18nLint
|
|
6
6
|
super
|
7
7
|
program = Ripper.sexp(@node.value[:text]).flatten
|
8
8
|
str_num = program.flatten.count { |t| t == :string_literal }
|
9
|
-
tstr_num = program.each_with_index.count
|
9
|
+
tstr_num = program.each_with_index.count do |t, i|
|
10
|
+
lint_config.ignore_methods.any? do |m|
|
11
|
+
[t, program[i + 1], program[i + 2]] == [:fcall, :@ident, m.to_s] ||
|
12
|
+
[t, program[i + 1], program[i + 2]] == [:command, :@ident, m.to_s]
|
13
|
+
end
|
14
|
+
end
|
10
15
|
|
11
16
|
lint_add_matched_node(@node) unless str_num == tstr_num
|
12
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml_i18n_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seiei Miyagi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '10.0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: coveralls
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
97
|
description:
|
112
98
|
email:
|
113
99
|
- hanachin@gmail.com
|
@@ -159,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
145
|
version: '0'
|
160
146
|
requirements: []
|
161
147
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.6.
|
148
|
+
rubygems_version: 2.6.8
|
163
149
|
signing_key:
|
164
150
|
specification_version: 4
|
165
151
|
summary: find out not translated yet plain text from your Haml template
|