eastasianwidth-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/eastasianwidth-rails.gemspec +24 -0
- data/lib/eastasianwidth-rails.rb +9 -0
- data/vendor/assets/javascripts/eastasianwidth.js +277 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: adeb5171a72b8148a60acb476dd9d6846d2f77bd
|
4
|
+
data.tar.gz: 548c896caf5b71e77d7cc891d211f3b9f79988ba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 812b471320e59ee1318b0661f615f1180450e6bf4fbe3b8c4fbf36ee2dce178c1fd483aece191545fc4423ece5a26d9745e71d3cf98f2b644abab2b801517c69
|
7
|
+
data.tar.gz: 81a97c15a5e026098f24273f971c9dcdd0c5286d76624d5f4cdd2c08ef3e0ea5c5b86b7802e098b0069fb7b0f549ae07322a5662c3a59624ab2e26b1f0147092
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Masaki Komagata
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Eastasianwidth::Rails
|
2
|
+
|
3
|
+
gem for (eastasianwidth.js)[https://github.com/komagata/eastasianwidth]
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'eastasianwidth-rails'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install eastasianwidth-rails
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Add the follow line in app/assets/javascripts/application.js
|
22
|
+
|
23
|
+
//= require eastasianwidth
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'eastasianwidth-rails'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "eastasianwidth-rails"
|
8
|
+
spec.version = Eastasianwidth::Rails::VERSION
|
9
|
+
spec.authors = ["Masaki Komagata"]
|
10
|
+
spec.email = ["komagata@gmail.com"]
|
11
|
+
spec.description = %q{gem for eastasianwidth.js}
|
12
|
+
spec.summary = %q{gem for eastasianwidth.js}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rails"
|
24
|
+
end
|
@@ -0,0 +1,277 @@
|
|
1
|
+
var eaw = {};
|
2
|
+
|
3
|
+
if ('undefined' == typeof module) {
|
4
|
+
window.eastasianwidth = eaw;
|
5
|
+
} else {
|
6
|
+
module.exports = eaw;
|
7
|
+
}
|
8
|
+
|
9
|
+
eaw.eastAsianWidth = function(character) {
|
10
|
+
var x = character.charCodeAt(0);
|
11
|
+
var y = (character.length == 2) ? character.charCodeAt(1) : 0;
|
12
|
+
var codePoint = x;
|
13
|
+
if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) {
|
14
|
+
x &= 0x3FF;
|
15
|
+
y &= 0x3FF;
|
16
|
+
codePoint = (x << 10) | y;
|
17
|
+
codePoint += 0x10000;
|
18
|
+
}
|
19
|
+
|
20
|
+
if ((0x3000 == codePoint) ||
|
21
|
+
(0xFF01 <= codePoint && codePoint <= 0xFF60) ||
|
22
|
+
(0xFFE0 <= codePoint && codePoint <= 0xFFE6)) {
|
23
|
+
return 'F';
|
24
|
+
}
|
25
|
+
if ((0x20A9 == codePoint) ||
|
26
|
+
(0xFF61 <= codePoint && codePoint <= 0xFFBE) ||
|
27
|
+
(0xFFC2 <= codePoint && codePoint <= 0xFFC7) ||
|
28
|
+
(0xFFCA <= codePoint && codePoint <= 0xFFCF) ||
|
29
|
+
(0xFFD2 <= codePoint && codePoint <= 0xFFD7) ||
|
30
|
+
(0xFFDA <= codePoint && codePoint <= 0xFFDC) ||
|
31
|
+
(0xFFE8 <= codePoint && codePoint <= 0xFFEE)) {
|
32
|
+
return 'H';
|
33
|
+
}
|
34
|
+
if ((0x1100 <= codePoint && codePoint <= 0x115F) ||
|
35
|
+
(0x11A3 <= codePoint && codePoint <= 0x11A7) ||
|
36
|
+
(0x11FA <= codePoint && codePoint <= 0x11FF) ||
|
37
|
+
(0x2329 <= codePoint && codePoint <= 0x232A) ||
|
38
|
+
(0x2E80 <= codePoint && codePoint <= 0x2E99) ||
|
39
|
+
(0x2E9B <= codePoint && codePoint <= 0x2EF3) ||
|
40
|
+
(0x2F00 <= codePoint && codePoint <= 0x2FD5) ||
|
41
|
+
(0x2FF0 <= codePoint && codePoint <= 0x2FFB) ||
|
42
|
+
(0x3001 <= codePoint && codePoint <= 0x303E) ||
|
43
|
+
(0x3041 <= codePoint && codePoint <= 0x3096) ||
|
44
|
+
(0x3099 <= codePoint && codePoint <= 0x30FF) ||
|
45
|
+
(0x3105 <= codePoint && codePoint <= 0x312D) ||
|
46
|
+
(0x3131 <= codePoint && codePoint <= 0x318E) ||
|
47
|
+
(0x3190 <= codePoint && codePoint <= 0x31BA) ||
|
48
|
+
(0x31C0 <= codePoint && codePoint <= 0x31E3) ||
|
49
|
+
(0x31F0 <= codePoint && codePoint <= 0x321E) ||
|
50
|
+
(0x3220 <= codePoint && codePoint <= 0x3247) ||
|
51
|
+
(0x3250 <= codePoint && codePoint <= 0x32FE) ||
|
52
|
+
(0x3300 <= codePoint && codePoint <= 0x4DBF) ||
|
53
|
+
(0x4E00 <= codePoint && codePoint <= 0xA48C) ||
|
54
|
+
(0xA490 <= codePoint && codePoint <= 0xA4C6) ||
|
55
|
+
(0xA960 <= codePoint && codePoint <= 0xA97C) ||
|
56
|
+
(0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
|
57
|
+
(0xD7B0 <= codePoint && codePoint <= 0xD7C6) ||
|
58
|
+
(0xD7CB <= codePoint && codePoint <= 0xD7FB) ||
|
59
|
+
(0xF900 <= codePoint && codePoint <= 0xFAFF) ||
|
60
|
+
(0xFE10 <= codePoint && codePoint <= 0xFE19) ||
|
61
|
+
(0xFE30 <= codePoint && codePoint <= 0xFE52) ||
|
62
|
+
(0xFE54 <= codePoint && codePoint <= 0xFE66) ||
|
63
|
+
(0xFE68 <= codePoint && codePoint <= 0xFE6B) ||
|
64
|
+
(0x1B000 <= codePoint && codePoint <= 0x1B001) ||
|
65
|
+
(0x1F200 <= codePoint && codePoint <= 0x1F202) ||
|
66
|
+
(0x1F210 <= codePoint && codePoint <= 0x1F23A) ||
|
67
|
+
(0x1F240 <= codePoint && codePoint <= 0x1F248) ||
|
68
|
+
(0x1F250 <= codePoint && codePoint <= 0x1F251) ||
|
69
|
+
(0x20000 <= codePoint && codePoint <= 0x2F73F) ||
|
70
|
+
(0x2B740 <= codePoint && codePoint <= 0x2FFFD) ||
|
71
|
+
(0x30000 <= codePoint && codePoint <= 0x3FFFD)) {
|
72
|
+
return 'W';
|
73
|
+
}
|
74
|
+
if ((0x0020 <= codePoint && codePoint <= 0x007E) ||
|
75
|
+
(0x00A2 <= codePoint && codePoint <= 0x00A3) ||
|
76
|
+
(0x00A5 <= codePoint && codePoint <= 0x00A6) ||
|
77
|
+
(0x00AC == codePoint) ||
|
78
|
+
(0x00AF == codePoint) ||
|
79
|
+
(0x27E6 <= codePoint && codePoint <= 0x27ED) ||
|
80
|
+
(0x2985 <= codePoint && codePoint <= 0x2986)) {
|
81
|
+
return 'Na';
|
82
|
+
}
|
83
|
+
if ((0x00A1 == codePoint) ||
|
84
|
+
(0x00A4 == codePoint) ||
|
85
|
+
(0x00A7 <= codePoint && codePoint <= 0x00A8) ||
|
86
|
+
(0x00AA == codePoint) ||
|
87
|
+
(0x00AD <= codePoint && codePoint <= 0x00AE) ||
|
88
|
+
(0x00B0 <= codePoint && codePoint <= 0x00B4) ||
|
89
|
+
(0x00B6 <= codePoint && codePoint <= 0x00BA) ||
|
90
|
+
(0x00BC <= codePoint && codePoint <= 0x00BF) ||
|
91
|
+
(0x00C6 == codePoint) ||
|
92
|
+
(0x00D0 == codePoint) ||
|
93
|
+
(0x00D7 <= codePoint && codePoint <= 0x00D8) ||
|
94
|
+
(0x00DE <= codePoint && codePoint <= 0x00E1) ||
|
95
|
+
(0x00E6 == codePoint) ||
|
96
|
+
(0x00E8 <= codePoint && codePoint <= 0x00EA) ||
|
97
|
+
(0x00EC <= codePoint && codePoint <= 0x00ED) ||
|
98
|
+
(0x00F0 == codePoint) ||
|
99
|
+
(0x00F2 <= codePoint && codePoint <= 0x00F3) ||
|
100
|
+
(0x00F7 <= codePoint && codePoint <= 0x00FA) ||
|
101
|
+
(0x00FC == codePoint) ||
|
102
|
+
(0x00FE == codePoint) ||
|
103
|
+
(0x0101 == codePoint) ||
|
104
|
+
(0x0111 == codePoint) ||
|
105
|
+
(0x0113 == codePoint) ||
|
106
|
+
(0x011B == codePoint) ||
|
107
|
+
(0x0126 <= codePoint && codePoint <= 0x0127) ||
|
108
|
+
(0x012B == codePoint) ||
|
109
|
+
(0x0131 <= codePoint && codePoint <= 0x0133) ||
|
110
|
+
(0x0138 == codePoint) ||
|
111
|
+
(0x013F <= codePoint && codePoint <= 0x0142) ||
|
112
|
+
(0x0144 == codePoint) ||
|
113
|
+
(0x0148 <= codePoint && codePoint <= 0x014B) ||
|
114
|
+
(0x014D == codePoint) ||
|
115
|
+
(0x0152 <= codePoint && codePoint <= 0x0153) ||
|
116
|
+
(0x0166 <= codePoint && codePoint <= 0x0167) ||
|
117
|
+
(0x016B == codePoint) ||
|
118
|
+
(0x01CE == codePoint) ||
|
119
|
+
(0x01D0 == codePoint) ||
|
120
|
+
(0x01D2 == codePoint) ||
|
121
|
+
(0x01D4 == codePoint) ||
|
122
|
+
(0x01D6 == codePoint) ||
|
123
|
+
(0x01D8 == codePoint) ||
|
124
|
+
(0x01DA == codePoint) ||
|
125
|
+
(0x01DC == codePoint) ||
|
126
|
+
(0x0251 == codePoint) ||
|
127
|
+
(0x0261 == codePoint) ||
|
128
|
+
(0x02C4 == codePoint) ||
|
129
|
+
(0x02C7 == codePoint) ||
|
130
|
+
(0x02C9 <= codePoint && codePoint <= 0x02CB) ||
|
131
|
+
(0x02CD == codePoint) ||
|
132
|
+
(0x02D0 == codePoint) ||
|
133
|
+
(0x02D8 <= codePoint && codePoint <= 0x02DB) ||
|
134
|
+
(0x02DD == codePoint) ||
|
135
|
+
(0x02DF == codePoint) ||
|
136
|
+
(0x0300 <= codePoint && codePoint <= 0x036F) ||
|
137
|
+
(0x0391 <= codePoint && codePoint <= 0x03A1) ||
|
138
|
+
(0x03A3 <= codePoint && codePoint <= 0x03A9) ||
|
139
|
+
(0x03B1 <= codePoint && codePoint <= 0x03C1) ||
|
140
|
+
(0x03C3 <= codePoint && codePoint <= 0x03C9) ||
|
141
|
+
(0x0401 == codePoint) ||
|
142
|
+
(0x0410 <= codePoint && codePoint <= 0x044F) ||
|
143
|
+
(0x0451 == codePoint) ||
|
144
|
+
(0x2010 == codePoint) ||
|
145
|
+
(0x2013 <= codePoint && codePoint <= 0x2016) ||
|
146
|
+
(0x2018 <= codePoint && codePoint <= 0x2019) ||
|
147
|
+
(0x201C <= codePoint && codePoint <= 0x201D) ||
|
148
|
+
(0x2020 <= codePoint && codePoint <= 0x2022) ||
|
149
|
+
(0x2024 <= codePoint && codePoint <= 0x2027) ||
|
150
|
+
(0x2030 == codePoint) ||
|
151
|
+
(0x2032 <= codePoint && codePoint <= 0x2033) ||
|
152
|
+
(0x2035 == codePoint) ||
|
153
|
+
(0x203B == codePoint) ||
|
154
|
+
(0x203E == codePoint) ||
|
155
|
+
(0x2074 == codePoint) ||
|
156
|
+
(0x207F == codePoint) ||
|
157
|
+
(0x2081 <= codePoint && codePoint <= 0x2084) ||
|
158
|
+
(0x20AC == codePoint) ||
|
159
|
+
(0x2103 == codePoint) ||
|
160
|
+
(0x2105 == codePoint) ||
|
161
|
+
(0x2109 == codePoint) ||
|
162
|
+
(0x2113 == codePoint) ||
|
163
|
+
(0x2116 == codePoint) ||
|
164
|
+
(0x2121 <= codePoint && codePoint <= 0x2122) ||
|
165
|
+
(0x2126 == codePoint) ||
|
166
|
+
(0x212B == codePoint) ||
|
167
|
+
(0x2153 <= codePoint && codePoint <= 0x2154) ||
|
168
|
+
(0x215B <= codePoint && codePoint <= 0x215E) ||
|
169
|
+
(0x2160 <= codePoint && codePoint <= 0x216B) ||
|
170
|
+
(0x2170 <= codePoint && codePoint <= 0x2179) ||
|
171
|
+
(0x2189 == codePoint) ||
|
172
|
+
(0x2190 <= codePoint && codePoint <= 0x2199) ||
|
173
|
+
(0x21B8 <= codePoint && codePoint <= 0x21B9) ||
|
174
|
+
(0x21D2 == codePoint) ||
|
175
|
+
(0x21D4 == codePoint) ||
|
176
|
+
(0x21E7 == codePoint) ||
|
177
|
+
(0x2200 == codePoint) ||
|
178
|
+
(0x2202 <= codePoint && codePoint <= 0x2203) ||
|
179
|
+
(0x2207 <= codePoint && codePoint <= 0x2208) ||
|
180
|
+
(0x220B == codePoint) ||
|
181
|
+
(0x220F == codePoint) ||
|
182
|
+
(0x2211 == codePoint) ||
|
183
|
+
(0x2215 == codePoint) ||
|
184
|
+
(0x221A == codePoint) ||
|
185
|
+
(0x221D <= codePoint && codePoint <= 0x2220) ||
|
186
|
+
(0x2223 == codePoint) ||
|
187
|
+
(0x2225 == codePoint) ||
|
188
|
+
(0x2227 <= codePoint && codePoint <= 0x222C) ||
|
189
|
+
(0x222E == codePoint) ||
|
190
|
+
(0x2234 <= codePoint && codePoint <= 0x2237) ||
|
191
|
+
(0x223C <= codePoint && codePoint <= 0x223D) ||
|
192
|
+
(0x2248 == codePoint) ||
|
193
|
+
(0x224C == codePoint) ||
|
194
|
+
(0x2252 == codePoint) ||
|
195
|
+
(0x2260 <= codePoint && codePoint <= 0x2261) ||
|
196
|
+
(0x2264 <= codePoint && codePoint <= 0x2267) ||
|
197
|
+
(0x226A <= codePoint && codePoint <= 0x226B) ||
|
198
|
+
(0x226E <= codePoint && codePoint <= 0x226F) ||
|
199
|
+
(0x2282 <= codePoint && codePoint <= 0x2283) ||
|
200
|
+
(0x2286 <= codePoint && codePoint <= 0x2287) ||
|
201
|
+
(0x2295 == codePoint) ||
|
202
|
+
(0x2299 == codePoint) ||
|
203
|
+
(0x22A5 == codePoint) ||
|
204
|
+
(0x22BF == codePoint) ||
|
205
|
+
(0x2312 == codePoint) ||
|
206
|
+
(0x2460 <= codePoint && codePoint <= 0x24E9) ||
|
207
|
+
(0x24EB <= codePoint && codePoint <= 0x254B) ||
|
208
|
+
(0x2550 <= codePoint && codePoint <= 0x2573) ||
|
209
|
+
(0x2580 <= codePoint && codePoint <= 0x258F) ||
|
210
|
+
(0x2592 <= codePoint && codePoint <= 0x2595) ||
|
211
|
+
(0x25A0 <= codePoint && codePoint <= 0x25A1) ||
|
212
|
+
(0x25A3 <= codePoint && codePoint <= 0x25A9) ||
|
213
|
+
(0x25B2 <= codePoint && codePoint <= 0x25B3) ||
|
214
|
+
(0x25B6 <= codePoint && codePoint <= 0x25B7) ||
|
215
|
+
(0x25BC <= codePoint && codePoint <= 0x25BD) ||
|
216
|
+
(0x25C0 <= codePoint && codePoint <= 0x25C1) ||
|
217
|
+
(0x25C6 <= codePoint && codePoint <= 0x25C8) ||
|
218
|
+
(0x25CB == codePoint) ||
|
219
|
+
(0x25CE <= codePoint && codePoint <= 0x25D1) ||
|
220
|
+
(0x25E2 <= codePoint && codePoint <= 0x25E5) ||
|
221
|
+
(0x25EF == codePoint) ||
|
222
|
+
(0x2605 <= codePoint && codePoint <= 0x2606) ||
|
223
|
+
(0x2609 == codePoint) ||
|
224
|
+
(0x260E <= codePoint && codePoint <= 0x260F) ||
|
225
|
+
(0x2614 <= codePoint && codePoint <= 0x2615) ||
|
226
|
+
(0x261C == codePoint) ||
|
227
|
+
(0x261E == codePoint) ||
|
228
|
+
(0x2640 == codePoint) ||
|
229
|
+
(0x2642 == codePoint) ||
|
230
|
+
(0x2660 <= codePoint && codePoint <= 0x2661) ||
|
231
|
+
(0x2663 <= codePoint && codePoint <= 0x2665) ||
|
232
|
+
(0x2667 <= codePoint && codePoint <= 0x266A) ||
|
233
|
+
(0x266C <= codePoint && codePoint <= 0x266D) ||
|
234
|
+
(0x266F == codePoint) ||
|
235
|
+
(0x269E <= codePoint && codePoint <= 0x269F) ||
|
236
|
+
(0x26BE <= codePoint && codePoint <= 0x26BF) ||
|
237
|
+
(0x26C4 <= codePoint && codePoint <= 0x26CD) ||
|
238
|
+
(0x26CF <= codePoint && codePoint <= 0x26E1) ||
|
239
|
+
(0x26E3 == codePoint) ||
|
240
|
+
(0x26E8 <= codePoint && codePoint <= 0x26FF) ||
|
241
|
+
(0x273D == codePoint) ||
|
242
|
+
(0x2757 == codePoint) ||
|
243
|
+
(0x2776 <= codePoint && codePoint <= 0x277F) ||
|
244
|
+
(0x2B55 <= codePoint && codePoint <= 0x2B59) ||
|
245
|
+
(0x3248 <= codePoint && codePoint <= 0x324F) ||
|
246
|
+
(0xE000 <= codePoint && codePoint <= 0xF8FF) ||
|
247
|
+
(0xFE00 <= codePoint && codePoint <= 0xFE0F) ||
|
248
|
+
(0xFFFD == codePoint) ||
|
249
|
+
(0x1F100 <= codePoint && codePoint <= 0x1F10A) ||
|
250
|
+
(0x1F110 <= codePoint && codePoint <= 0x1F12D) ||
|
251
|
+
(0x1F130 <= codePoint && codePoint <= 0x1F169) ||
|
252
|
+
(0x1F170 <= codePoint && codePoint <= 0x1F19A) ||
|
253
|
+
(0xE0100 <= codePoint && codePoint <= 0xE01EF) ||
|
254
|
+
(0xF0000 <= codePoint && codePoint <= 0xFFFFD) ||
|
255
|
+
(0x100000 <= codePoint && codePoint <= 0x10FFFD)) {
|
256
|
+
return 'A';
|
257
|
+
}
|
258
|
+
|
259
|
+
return 'N';
|
260
|
+
};
|
261
|
+
|
262
|
+
eaw.characterLength = function(character) {
|
263
|
+
var code = this.eastAsianWidth(character);
|
264
|
+
if (code == 'F' || code == 'W' || code == 'A') {
|
265
|
+
return 2;
|
266
|
+
} else {
|
267
|
+
return 1;
|
268
|
+
}
|
269
|
+
};
|
270
|
+
|
271
|
+
eaw.length = function(string) {
|
272
|
+
var len = 0;
|
273
|
+
for (var i = 0; i < string.length; i++) {
|
274
|
+
len = len + this.characterLength(string.charAt(i));
|
275
|
+
}
|
276
|
+
return len;
|
277
|
+
};
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eastasianwidth-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masaki Komagata
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: gem for eastasianwidth.js
|
56
|
+
email:
|
57
|
+
- komagata@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- eastasianwidth-rails.gemspec
|
68
|
+
- lib/eastasianwidth-rails.rb
|
69
|
+
- vendor/assets/javascripts/eastasianwidth.js
|
70
|
+
homepage: ''
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.0.0
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: gem for eastasianwidth.js
|
94
|
+
test_files: []
|
95
|
+
has_rdoc:
|