yellow-brick-road 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rst +42 -20
- data/lib/generators/templates/yellow_brick_road.rb.erb +19 -0
- data/lib/generators/yellow_brick_road/install_generator.rb +14 -0
- data/lib/yellow-brick-road/config.rb +41 -8
- data/lib/yellow-brick-road/directive_processor.rb +6 -5
- data/lib/yellow-brick-road/engine.rb +2 -3
- data/lib/yellow-brick-road/soy_processor.rb +1 -1
- data/lib/yellow-brick-road/version.rb +1 -1
- data/test/dummy/app/assets/javascripts/closure-deps.js +1 -1
- data/test/dummy/config/initializers/yellow_brick_road.rb +18 -1
- data/test/dummy/log/development.log +2208 -0
- data/test/dummy/tmp/cache/assets/C33/E00/sprockets%2F50c54266987e056bca666f8951752841 +2556 -0
- data/test/dummy/tmp/cache/assets/C48/990/sprockets%2F182c7921a46c3b8603c7f5595a111407 +823 -0
- data/test/dummy/tmp/cache/assets/C53/B40/sprockets%2F48cf0c035092dc945559526a279061c6 +204 -0
- data/test/dummy/tmp/cache/assets/C60/DB0/sprockets%2F3f00684578f2a3246581db667309ed89 +187 -0
- data/test/dummy/tmp/cache/assets/C60/E40/sprockets%2F3c5422f721521f492a5f02ca00b70009 +457 -0
- data/test/dummy/tmp/cache/assets/C73/DE0/sprockets%2F21f1f4574326846114a3c106873cebc3 +0 -0
- data/test/dummy/tmp/cache/assets/C7E/9F0/sprockets%2F89862076204c62c4593ac20de32da909 +4 -4
- data/test/dummy/tmp/cache/assets/C80/6F0/sprockets%2F56459a0713f8610d7d261f8be93073a2 +115 -0
- data/test/dummy/tmp/cache/assets/C8D/E10/sprockets%2F34b84bc4732937f885707002eda3896e +511 -0
- data/test/dummy/tmp/cache/assets/C93/CB0/sprockets%2F539b403b24833ca478a6f5877f37687c +239 -0
- data/test/dummy/tmp/cache/assets/C9A/C70/sprockets%2F10933dc6d342f604514713510b9ef0ab +806 -0
- data/test/dummy/tmp/cache/assets/CA0/7C0/sprockets%2Ff591bc0af8f085501241305c04907d3e +590 -0
- data/test/dummy/tmp/cache/assets/CA1/4A0/sprockets%2F5a9ad311e7d225b530b597041714b1e9 +2539 -0
- data/test/dummy/tmp/cache/assets/CA7/310/sprockets%2F45664cf816315200b574e029fde6f10a +0 -0
- data/test/dummy/tmp/cache/assets/CA7/A80/sprockets%2F1f32590957635a5a4f35442bc22f4ca4 +0 -0
- data/test/dummy/tmp/cache/assets/CAE/1D0/sprockets%2F2e62c7733d38a817a1532a744c6287bd +72 -0
- data/test/dummy/tmp/cache/assets/CB2/3C0/sprockets%2F9c35c290501a896b82c31448a39f3d5d +142 -0
- data/test/dummy/tmp/cache/assets/CB3/F20/sprockets%2F558b00e493fb501f7d95761e7eb40273 +2539 -0
- data/test/dummy/tmp/cache/assets/CBE/550/sprockets%2Fd680cac830e0b3408ba910f0b0421147 +2 -2
- data/test/dummy/tmp/cache/assets/CCD/480/sprockets%2Ffe7e11511634a2d03e1a20980b4593cf +0 -0
- data/test/dummy/tmp/cache/assets/CD0/080/sprockets%2Ffd5cbb87741244521d013d11c55573fa +204 -0
- data/test/dummy/tmp/cache/assets/CD2/020/sprockets%2Ff97740ba22118a2c91e992aac041843b +811 -0
- data/test/dummy/tmp/cache/assets/CD8/D90/sprockets%2F55dd841661d646f0024261a08ecf8ec0 +823 -0
- data/test/dummy/tmp/cache/assets/CE3/0D0/sprockets%2F301f97a178fd839a81bd663a6e22b616 +811 -0
- data/test/dummy/tmp/cache/assets/CE4/330/sprockets%2Fbd23466639af99164ab8e1c93721f14b +127 -0
- data/test/dummy/tmp/cache/assets/CE6/8A0/sprockets%2F3c0e7c5fa31563c8e820d6771e09918d +103 -0
- data/test/dummy/tmp/cache/assets/CEB/120/sprockets%2F857a0dde6829f7a27b93a840e1c60469 +522 -0
- data/test/dummy/tmp/cache/assets/CEE/CF0/sprockets%2F376f94b987d8156056c4e1d38ec06bf0 +0 -0
- data/test/dummy/tmp/cache/assets/CF2/C10/sprockets%2Fc64ef8a9dd0a1c3101d662750105c11a +806 -0
- data/test/dummy/tmp/cache/assets/CF3/CD0/sprockets%2F4bb42a5a6b504190f10d20b1c5f93d54 +1529 -0
- data/test/dummy/tmp/cache/assets/CF6/890/sprockets%2F36007a87f140155b5a04f2ca6b262dcc +494 -0
- data/test/dummy/tmp/cache/assets/CF6/9D0/sprockets%2F34b7199e9d33994c8ec7a442d60ca985 +173 -0
- data/test/dummy/tmp/cache/assets/CFA/A90/sprockets%2F901ba405a6d6747f6412ed4d0e0ac620 +256 -0
- data/test/dummy/tmp/cache/assets/CFC/E70/sprockets%2F8ee639668b5f0e629fbe0d62d1394689 +173 -0
- data/test/dummy/tmp/cache/assets/D04/1B0/sprockets%2F418f2b3b6b08b320f6db268a0991c54c +0 -0
- data/test/dummy/tmp/cache/assets/D05/920/sprockets%2F909507434dcc270db4853e4c147f0aac +5 -4
- data/test/dummy/tmp/cache/assets/D07/DB0/sprockets%2F0c17d7dac64290e385c91eb6f1570b31 +511 -0
- data/test/dummy/tmp/cache/assets/D07/EE0/sprockets%2F4999982b09e0b786894fce44f5d783cc +1371 -0
- data/test/dummy/tmp/cache/assets/D09/380/sprockets%2F14383e18fa2faac6b561a29d8e132863 +0 -0
- data/test/dummy/tmp/cache/assets/D0D/200/sprockets%2F545a7e34cce1d4272d83d58fd4215d42 +1277 -0
- data/test/dummy/tmp/cache/assets/D0E/870/sprockets%2F84996444f4f1f3fdc0248131cfb1a3b6 +794 -0
- data/test/dummy/tmp/cache/assets/D15/F60/sprockets%2Fa28394e3f80365b5bc86794dd46daa22 +0 -0
- data/test/dummy/tmp/cache/assets/D18/950/sprockets%2Fcf650d67c5d431ffdb38552e562299b2 +474 -0
- data/test/dummy/tmp/cache/assets/D18/E10/sprockets%2Fec7c58f640556b401fcd66528352dc9d +474 -0
- data/test/dummy/tmp/cache/assets/D20/660/sprockets%2F0d2875475ced01df962f3d758cda7792 +103 -0
- data/test/dummy/tmp/cache/assets/D22/AB0/sprockets%2F0b08e7f81651aaf739a93d61ae99779c +283 -0
- data/test/dummy/tmp/cache/assets/D2E/B20/sprockets%2Feed5412a17a52b1a335925e2af1f75d3 +0 -0
- data/test/dummy/tmp/cache/assets/D36/700/sprockets%2Fd219bf9db2eacc105bb294755093a437 +505 -0
- data/test/dummy/tmp/cache/assets/D3B/A10/sprockets%2Fcf38b51682d84a04da7b8a7313de52c6 +207 -0
- data/test/dummy/tmp/cache/assets/D3C/0E0/sprockets%2Fe9d7aba138d602c4a6ac701bc9615977 +505 -0
- data/test/dummy/tmp/cache/assets/D3E/FF0/sprockets%2F6bd8ccd3e02f397c20f349d5c0960e51 +0 -0
- data/test/dummy/tmp/cache/assets/D41/B30/sprockets%2Fba1b93913dd01d83ac9a96df334456f8 +0 -0
- data/test/dummy/tmp/cache/assets/D41/DA0/sprockets%2Fe8d00810698a9fcee032022fefd084f7 +0 -0
- data/test/dummy/tmp/cache/assets/D44/CF0/sprockets%2Ffa31a45f04884493c909c5a67fcbdf23 +1371 -0
- data/test/dummy/tmp/cache/assets/D47/BE0/sprockets%2F0b5ebdf6dec160a264698e7f745061e8 +142 -0
- data/test/dummy/tmp/cache/assets/D4C/F30/sprockets%2Ff90155c10f59a3fe44959ac09bf817fe +2556 -0
- data/test/dummy/tmp/cache/assets/D4E/7C0/sprockets%2Ff01b58512d01eda23fd5cb23a2b28b60 +1529 -0
- data/test/dummy/tmp/cache/assets/D4E/860/sprockets%2F86eed0c77c47d0970345bbabb58d8939 +1277 -0
- data/test/dummy/tmp/cache/assets/D4E/C30/sprockets%2F52420c10c73ca310d026565eafdadb4e +1545 -0
- data/test/dummy/tmp/cache/assets/D4E/F60/sprockets%2F9893a3c5aeb1a9e77469f4751b4d3c3f +115 -0
- data/test/dummy/tmp/cache/assets/D4F/E60/sprockets%2F17ee65de1f78c3dd5c165a9867e810b6 +165 -0
- data/test/dummy/tmp/cache/assets/D57/0D0/sprockets%2Fa29e6e8106d9d5ed1e2889126cfbf877 +300 -0
- data/test/dummy/tmp/cache/assets/D5C/650/sprockets%2Fe1c381da3cc213a639e956ae3315a2bd +607 -0
- data/test/dummy/tmp/cache/assets/D61/860/sprockets%2Fbf032a3b4aad2c2e25704e65c966cf45 +794 -0
- data/test/dummy/tmp/cache/assets/D63/B20/sprockets%2F31fc70ce66bb80fb9421be34eb3b0287 +0 -0
- data/test/dummy/tmp/cache/assets/D64/D60/sprockets%2Fa544ea03bf0a45948a053ba76ec2a79f +239 -0
- data/test/dummy/tmp/cache/assets/D6B/F90/sprockets%2F66636712ecb1fcc777dccf7643a0e1b1 +127 -0
- data/test/dummy/tmp/cache/assets/D6E/AD0/sprockets%2Fc91cdc6a72c729d7a64119198b3d2eab +0 -0
- data/test/dummy/tmp/cache/assets/D6F/140/sprockets%2F9ddc51f4388dd5243a28dba1ce47572b +53 -0
- data/test/dummy/tmp/cache/assets/D72/800/sprockets%2F92baa375d54e16fe0a5c7f079a1ce992 +165 -0
- data/test/dummy/tmp/cache/assets/D74/220/sprockets%2F3f888bda53179cb945eab35fbd31a708 +53 -0
- data/test/dummy/tmp/cache/assets/D78/5F0/sprockets%2F638ed6af667d4fc5147f72ff34aa2d33 +0 -0
- data/test/dummy/tmp/cache/assets/D7D/640/sprockets%2F95a7c5580f957c31e1ab9d0773ed5fde +607 -0
- data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +6 -5
- data/test/dummy/tmp/cache/assets/D89/020/sprockets%2Fa06df6166e70324e712e54b1cafca0ae +187 -0
- data/test/dummy/tmp/cache/assets/D8A/9F0/sprockets%2Fc06547ca33ee3d03be14ce045ae1c9e2 +207 -0
- data/test/dummy/tmp/cache/assets/D9E/B80/sprockets%2F9561df1d45c7ff4aa8ac3e2df0c99121 +0 -0
- data/test/dummy/tmp/cache/assets/DA3/F30/sprockets%2Fe015d6ccdfcf022e47c83d7906f728ae +457 -0
- data/test/dummy/tmp/cache/assets/DAE/190/sprockets%2F433c7b21968be8d1f9bfdbdf7a637c57 +0 -0
- data/test/dummy/tmp/cache/assets/DB3/600/sprockets%2F9b70ae73f15ba693886eeef4eb5d6c75 +0 -0
- data/test/dummy/tmp/cache/assets/DB4/510/sprockets%2F29cdae8e29c88fd9ddbd4831419560fe +1260 -0
- data/test/dummy/tmp/cache/assets/DC1/4A0/sprockets%2F0b63dfcf163f2faeb612724eb4545bcc +1354 -0
- data/test/dummy/tmp/cache/assets/DC4/C10/sprockets%2Fcf48f4cbad3db33146eab4c577c1d209 +300 -0
- data/test/dummy/tmp/cache/assets/DC4/CA0/sprockets%2Fd0da8a60ea4dc16b9fd3e2a50d88633c +0 -0
- data/test/dummy/tmp/cache/assets/DC7/8C0/sprockets%2F1ad68dcc9ef598d3811ba2ac5c0ea182 +1354 -0
- data/test/dummy/tmp/cache/assets/DC7/C00/sprockets%2Fba755ff3a81c3192f0e45a4f7c0c7dcb +0 -0
- data/test/dummy/tmp/cache/assets/DCA/760/sprockets%2F717c4cea10bf601090ffdfe4e668e4cb +283 -0
- data/test/dummy/tmp/cache/assets/DCA/DE0/sprockets%2F51dcced9ec2b3cd4b1cc2949f860c361 +590 -0
- data/test/dummy/tmp/cache/assets/DD7/E70/sprockets%2F2595d8c8d1d5f4deb096247fb3bfc7ab +256 -0
- data/test/dummy/tmp/cache/assets/DE1/9D0/sprockets%2F8befd77af580ee16ec42ec95b1766ff3 +1545 -0
- data/test/dummy/tmp/cache/assets/E00/D80/sprockets%2F9debc27161f7bccf2d84a36b8c36c4bf +522 -0
- data/test/dummy/tmp/cache/assets/E00/E60/sprockets%2Fac159b94b0a6d621e4f6cde9b4de87bb +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E1B/D00/sprockets%2F886dff4afe55f9d3f8abe434f2689add +72 -0
- data/test/dummy/tmp/cache/assets/E1B/F20/sprockets%2Fa4bbc04eb83ebf94fd8134c3abd220dd +494 -0
- data/test/dummy/tmp/cache/assets/E71/0C0/sprockets%2F5ffdc0daa0a1f9638c787897ceefcdee +1260 -0
- metadata +186 -10
- data/test/dummy/tmp/pids/server.pid +0 -1
@@ -0,0 +1,204 @@
|
|
1
|
+
o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325538162.2579:@value{I"
|
2
|
+
class:EFI"BundledAsset;
|
3
|
+
FI"id;
|
4
|
+
F"%bf473b978218efa5e92d4119564d63e5I"logical_path;
|
5
|
+
FI"'closure/goog/i18n/graphemebreak.js;
|
6
|
+
TI"
|
7
|
+
F"s/Volumes/Development/dev-web/closure-library-wrapper/vendor/closure-library/closure/goog/i18n/graphemebreak.jsI"content_type;
|
8
|
+
FI"application/javascript;
|
9
|
+
FI"
|
10
|
+
mtime;
|
11
|
+
FI"2012-01-02T16:18:52+00:00;
|
12
|
+
FI" body;
|
13
|
+
FI"�// Copyright 2006 The Closure Library Authors. All Rights Reserved.
|
14
|
+
//
|
15
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
16
|
+
// you may not use this file except in compliance with the License.
|
17
|
+
// You may obtain a copy of the License at
|
18
|
+
//
|
19
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
20
|
+
//
|
21
|
+
// Unless required by applicable law or agreed to in writing, software
|
22
|
+
// distributed under the License is distributed on an "AS-IS" BASIS,
|
23
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
24
|
+
// See the License for the specific language governing permissions and
|
25
|
+
// limitations under the License.
|
26
|
+
|
27
|
+
/**
|
28
|
+
* @fileoverview Detect Grapheme Cluster Break in a pair of codepoints. Follows
|
29
|
+
* Unicode 5.1 UAX#29.
|
30
|
+
*
|
31
|
+
*/
|
32
|
+
|
33
|
+
|
34
|
+
goog.provide('goog.i18n.GraphemeBreak');
|
35
|
+
goog.require('goog.structs.InversionMap');
|
36
|
+
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Enum for all Grapheme Cluster Break properties.
|
40
|
+
* These enums directly corresponds to Grapheme_Cluster_Break property values
|
41
|
+
* mentioned in http://unicode.org/reports/tr29 table 2.
|
42
|
+
*
|
43
|
+
* CR and LF are moved to the bottom of the list because they occur only once
|
44
|
+
* and so good candidates to take 2 decimal digit values.
|
45
|
+
* @enum {number}
|
46
|
+
* @protected
|
47
|
+
*/
|
48
|
+
goog.i18n.GraphemeBreak.property = {
|
49
|
+
ANY: 0,
|
50
|
+
CONTROL: 1,
|
51
|
+
EXTEND: 2,
|
52
|
+
PREPEND: 3,
|
53
|
+
SPACING_MARK: 4,
|
54
|
+
L: 5,
|
55
|
+
V: 6,
|
56
|
+
T: 7,
|
57
|
+
LV: 8,
|
58
|
+
LVT: 9,
|
59
|
+
CR: 10,
|
60
|
+
LF: 11
|
61
|
+
};
|
62
|
+
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Grapheme Cluster Break property values for all codepoints as inversion map.
|
66
|
+
* Constructed lazily.
|
67
|
+
*
|
68
|
+
* @type {goog.structs.InversionMap}
|
69
|
+
* @private
|
70
|
+
*/
|
71
|
+
goog.i18n.GraphemeBreak.inversions_ = null;
|
72
|
+
|
73
|
+
|
74
|
+
/**
|
75
|
+
* There are two kinds of grapheme clusters: 1) Legacy 2)Extended. This method
|
76
|
+
* is to check for legacy rules.
|
77
|
+
*
|
78
|
+
* @param {number} prop_a The property enum value of the first character.
|
79
|
+
* @param {number} prop_b The property enum value of the second character.
|
80
|
+
* @return {boolean} True if a & b do not form a cluster; False otherwise.
|
81
|
+
* @private
|
82
|
+
*/
|
83
|
+
goog.i18n.GraphemeBreak.applyLegacyBreakRules_ = function(prop_a, prop_b) {
|
84
|
+
|
85
|
+
var prop = goog.i18n.GraphemeBreak.property;
|
86
|
+
|
87
|
+
if (prop_a == prop.CR && prop_b == prop.LF) {
|
88
|
+
return false;
|
89
|
+
}
|
90
|
+
if (prop_a == prop.CONTROL || prop_a == prop.CR || prop_a == prop.LF) {
|
91
|
+
return true;
|
92
|
+
}
|
93
|
+
if (prop_b == prop.CONTROL || prop_b == prop.CR || prop_b == prop.LF) {
|
94
|
+
return true;
|
95
|
+
}
|
96
|
+
if ((prop_a == prop.L) &&
|
97
|
+
(prop_b == prop.L || prop_b == prop.V ||
|
98
|
+
prop_b == prop.LV || prop_b == prop.LVT)) {
|
99
|
+
return false;
|
100
|
+
}
|
101
|
+
if ((prop_a == prop.LV || prop_a == prop.V) &&
|
102
|
+
(prop_b == prop.V || prop_b == prop.T)) {
|
103
|
+
return false;
|
104
|
+
}
|
105
|
+
if ((prop_a == prop.LVT || prop_a == prop.T) && (prop_b == prop.T)) {
|
106
|
+
return false;
|
107
|
+
}
|
108
|
+
if (prop_b == prop.EXTEND) {
|
109
|
+
return false;
|
110
|
+
}
|
111
|
+
return true;
|
112
|
+
};
|
113
|
+
|
114
|
+
|
115
|
+
/**
|
116
|
+
* Method to return property enum value of the codepoint. If it is Hangul LV or
|
117
|
+
* LVT, then it is computed; for the rest it is picked from the inversion map.
|
118
|
+
* @param {number} acode The code point value of the character.
|
119
|
+
* @return {number} Property enum value of codepoint.
|
120
|
+
* @private
|
121
|
+
*/
|
122
|
+
goog.i18n.GraphemeBreak.getBreakProp_ = function(acode) {
|
123
|
+
if (0xAC00 <= acode && acode <= 0xD7A3) {
|
124
|
+
var prop = goog.i18n.GraphemeBreak.property;
|
125
|
+
if (acode % 0x1C == 0x10) {
|
126
|
+
return prop.LV;
|
127
|
+
}
|
128
|
+
return prop.LVT;
|
129
|
+
} else {
|
130
|
+
if (!goog.i18n.GraphemeBreak.inversions_) {
|
131
|
+
goog.i18n.GraphemeBreak.inversions_ = new goog.structs.InversionMap(
|
132
|
+
[0, 10, 1, 2, 1, 18, 95, 33, 13, 1, 594, 112, 275, 7, 263, 45, 1, 1,
|
133
|
+
1, 2, 1, 2, 1, 1, 56, 4, 12, 11, 48, 20, 17, 1, 101, 7, 1, 7, 2, 2,
|
134
|
+
1, 4, 33, 1, 1, 1, 30, 27, 91, 11, 58, 9, 269, 2, 1, 56, 1, 1, 3, 8,
|
135
|
+
4, 1, 3, 4, 13, 2, 29, 1, 2, 56, 1, 1, 1, 2, 6, 6, 1, 9, 1, 10, 2,
|
136
|
+
29, 2, 1, 56, 2, 3, 17, 30, 2, 3, 14, 1, 56, 1, 1, 3, 8, 4, 1, 20,
|
137
|
+
2, 29, 1, 2, 56, 1, 1, 2, 1, 6, 6, 11, 10, 2, 30, 1, 59, 1, 1, 1,
|
138
|
+
12, 1, 9, 1, 41, 3, 58, 3, 5, 17, 11, 2, 30, 2, 56, 1, 1, 1, 1, 2,
|
139
|
+
1, 3, 1, 5, 11, 11, 2, 30, 2, 58, 1, 2, 5, 7, 11, 10, 2, 30, 2, 70,
|
140
|
+
6, 2, 6, 7, 19, 2, 60, 11, 5, 5, 1, 1, 8, 97, 13, 3, 5, 3, 6, 74, 2,
|
141
|
+
27, 1, 1, 1, 1, 1, 4, 2, 49, 14, 1, 5, 1, 2, 8, 45, 9, 1, 100, 2, 4,
|
142
|
+
1, 6, 1, 2, 2, 2, 23, 2, 2, 4, 3, 1, 3, 2, 7, 3, 4, 13, 1, 2, 2, 6,
|
143
|
+
1, 1, 1, 112, 96, 72, 82, 357, 1, 946, 3, 29, 3, 29, 2, 30, 2, 64,
|
144
|
+
2, 1, 7, 8, 1, 2, 11, 9, 1, 45, 3, 155, 1, 118, 3, 4, 2, 9, 1, 6, 3,
|
145
|
+
116, 17, 7, 2, 77, 2, 3, 228, 4, 1, 47, 1, 1, 5, 1, 1, 5, 1, 2, 38,
|
146
|
+
9, 12, 2, 1, 30, 1, 4, 2, 2, 1, 121, 8, 8, 2, 2, 392, 64, 523, 1, 2,
|
147
|
+
2, 24, 7, 49, 16, 96, 33, 3311, 32, 554, 6, 105, 2, 30164, 4, 9, 2,
|
148
|
+
388, 1, 3, 1, 4, 1, 23, 2, 2, 1, 88, 2, 50, 16, 1, 97, 8, 25, 11, 2,
|
149
|
+
213, 6, 2, 2, 2, 2, 12, 1, 8, 1, 1, 434, 11172, 1116, 1024, 6942, 1,
|
150
|
+
737, 16, 16, 7, 216, 1, 158, 2, 89, 3, 513, 1, 2051, 15, 40, 8,
|
151
|
+
50981, 1, 1, 3, 3, 1, 5, 8, 8, 2, 7, 30, 4, 148, 3, 798140, 255],
|
152
|
+
[1, 11, 1, 10, 1, 0, 1, 0, 1, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0,
|
153
|
+
2, 0, 1, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 2, 0, 2, 0, 1, 0, 2, 0, 2,
|
154
|
+
0, 2, 0, 2, 0, 2, 4, 0, 2, 0, 4, 2, 4, 2, 0, 2, 0, 2, 0, 2, 4, 0, 2,
|
155
|
+
0, 2, 4, 2, 4, 2, 0, 2, 0, 2, 0, 2, 4, 0, 2, 4, 2, 0, 2, 0, 2, 4, 0,
|
156
|
+
2, 0, 4, 2, 4, 2, 0, 2, 0, 2, 4, 0, 2, 0, 2, 4, 2, 4, 2, 0, 2, 0, 2,
|
157
|
+
0, 2, 4, 2, 4, 2, 0, 2, 0, 4, 0, 2, 4, 2, 0, 2, 0, 4, 0, 2, 0, 4, 2,
|
158
|
+
4, 2, 4, 2, 4, 2, 0, 2, 0, 4, 0, 2, 4, 2, 4, 2, 0, 2, 0, 4, 0, 2, 4,
|
159
|
+
2, 4, 2, 4, 0, 2, 0, 3, 2, 0, 2, 0, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2,
|
160
|
+
0, 2, 0, 4, 0, 2, 4, 2, 0, 2, 0, 2, 0, 2, 0, 4, 2, 4, 2, 4, 2, 4, 2,
|
161
|
+
0, 4, 2, 0, 2, 0, 4, 0, 4, 0, 2, 0, 2, 4, 2, 4, 2, 0, 4, 0, 5, 6, 7,
|
162
|
+
0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 4, 2, 4, 2, 4, 2, 0, 2, 0, 2, 0,
|
163
|
+
2, 0, 2, 4, 2, 4, 2, 4, 2, 0, 4, 0, 4, 0, 2, 4, 0, 2, 4, 0, 2, 4, 2,
|
164
|
+
4, 2, 4, 2, 4, 0, 2, 0, 2, 4, 0, 4, 2, 4, 2, 4, 0, 4, 2, 4, 2, 0, 2,
|
165
|
+
0, 1, 2, 1, 0, 1, 0, 1, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0,
|
166
|
+
2, 0, 2, 0, 4, 2, 4, 0, 4, 0, 4, 2, 0, 2, 0, 2, 4, 0, 2, 4, 2, 4, 2,
|
167
|
+
0, 2, 0, 2, 4, 0, 9, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2,
|
168
|
+
0, 2, 0, 2, 0, 2, 4, 2, 0, 4, 2, 1, 2, 0, 2, 0, 2, 0, 2, 0, 1, 2],
|
169
|
+
true);
|
170
|
+
}
|
171
|
+
return (/** @type {number} */
|
172
|
+
goog.i18n.GraphemeBreak.inversions_.at(acode));
|
173
|
+
}
|
174
|
+
};
|
175
|
+
|
176
|
+
|
177
|
+
/**
|
178
|
+
* There are two kinds of grapheme clusters: 1) Legacy 2)Extended. This method
|
179
|
+
* is to check for both using a boolean flag to switch between them.
|
180
|
+
* @param {number} a The code point value of the first character.
|
181
|
+
* @param {number} b The code point value of the second character.
|
182
|
+
* @param {boolean=} opt_extended If true, indicates extended grapheme cluster;
|
183
|
+
* If false, indicates legacy cluster.
|
184
|
+
* @return {boolean} True if a & b do not form a cluster; False otherwise.
|
185
|
+
*/
|
186
|
+
goog.i18n.GraphemeBreak.hasGraphemeBreak = function(a, b, opt_extended) {
|
187
|
+
|
188
|
+
var prop_a = goog.i18n.GraphemeBreak.getBreakProp_(a);
|
189
|
+
var prop_b = goog.i18n.GraphemeBreak.getBreakProp_(b);
|
190
|
+
var prop = goog.i18n.GraphemeBreak.property;
|
191
|
+
|
192
|
+
return goog.i18n.GraphemeBreak.applyLegacyBreakRules_(prop_a, prop_b) &&
|
193
|
+
!(opt_extended && (prop_a == prop.PREPEND || prop_b == prop.SPACING_MARK));
|
194
|
+
};
|
195
|
+
;
|
196
|
+
FI"asset_paths;
|
197
|
+
F["s/Volumes/Development/dev-web/closure-library-wrapper/vendor/closure-library/closure/goog/i18n/graphemebreak.jsI"dependency_paths;
|
198
|
+
F[{I" path;
|
199
|
+
F"s/Volumes/Development/dev-web/closure-library-wrapper/vendor/closure-library/closure/goog/i18n/graphemebreak.jsI"
|
200
|
+
mtime;
|
201
|
+
FIu: Time
|
202
|
+
T:offsetiI"hexdigest;
|
203
|
+
F"%2643825de66578a8fd08c8563f3a2184I"
|
204
|
+
F"%46dde6621c301f4928e3b34efee9e3b5
|
@@ -0,0 +1,187 @@
|
|
1
|
+
o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325549268.101027:@value{ I"length:EFi�I"digest;
|
2
|
+
F"%b9a272e872bf38cba18b69cc64d68569I"source;
|
3
|
+
FI"�// Copyright 2006 The Closure Library Authors. All Rights Reserved.
|
4
|
+
//
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
// you may not use this file except in compliance with the License.
|
7
|
+
// You may obtain a copy of the License at
|
8
|
+
//
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
//
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
12
|
+
// distributed under the License is distributed on an "AS-IS" BASIS,
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
// See the License for the specific language governing permissions and
|
15
|
+
// limitations under the License.
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @fileoverview Detect Grapheme Cluster Break in a pair of codepoints. Follows
|
19
|
+
* Unicode 5.1 UAX#29.
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
|
23
|
+
|
24
|
+
goog.provide('goog.i18n.GraphemeBreak');
|
25
|
+
goog.require('goog.structs.InversionMap');
|
26
|
+
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Enum for all Grapheme Cluster Break properties.
|
30
|
+
* These enums directly corresponds to Grapheme_Cluster_Break property values
|
31
|
+
* mentioned in http://unicode.org/reports/tr29 table 2.
|
32
|
+
*
|
33
|
+
* CR and LF are moved to the bottom of the list because they occur only once
|
34
|
+
* and so good candidates to take 2 decimal digit values.
|
35
|
+
* @enum {number}
|
36
|
+
* @protected
|
37
|
+
*/
|
38
|
+
goog.i18n.GraphemeBreak.property = {
|
39
|
+
ANY: 0,
|
40
|
+
CONTROL: 1,
|
41
|
+
EXTEND: 2,
|
42
|
+
PREPEND: 3,
|
43
|
+
SPACING_MARK: 4,
|
44
|
+
L: 5,
|
45
|
+
V: 6,
|
46
|
+
T: 7,
|
47
|
+
LV: 8,
|
48
|
+
LVT: 9,
|
49
|
+
CR: 10,
|
50
|
+
LF: 11
|
51
|
+
};
|
52
|
+
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Grapheme Cluster Break property values for all codepoints as inversion map.
|
56
|
+
* Constructed lazily.
|
57
|
+
*
|
58
|
+
* @type {goog.structs.InversionMap}
|
59
|
+
* @private
|
60
|
+
*/
|
61
|
+
goog.i18n.GraphemeBreak.inversions_ = null;
|
62
|
+
|
63
|
+
|
64
|
+
/**
|
65
|
+
* There are two kinds of grapheme clusters: 1) Legacy 2)Extended. This method
|
66
|
+
* is to check for legacy rules.
|
67
|
+
*
|
68
|
+
* @param {number} prop_a The property enum value of the first character.
|
69
|
+
* @param {number} prop_b The property enum value of the second character.
|
70
|
+
* @return {boolean} True if a & b do not form a cluster; False otherwise.
|
71
|
+
* @private
|
72
|
+
*/
|
73
|
+
goog.i18n.GraphemeBreak.applyLegacyBreakRules_ = function(prop_a, prop_b) {
|
74
|
+
|
75
|
+
var prop = goog.i18n.GraphemeBreak.property;
|
76
|
+
|
77
|
+
if (prop_a == prop.CR && prop_b == prop.LF) {
|
78
|
+
return false;
|
79
|
+
}
|
80
|
+
if (prop_a == prop.CONTROL || prop_a == prop.CR || prop_a == prop.LF) {
|
81
|
+
return true;
|
82
|
+
}
|
83
|
+
if (prop_b == prop.CONTROL || prop_b == prop.CR || prop_b == prop.LF) {
|
84
|
+
return true;
|
85
|
+
}
|
86
|
+
if ((prop_a == prop.L) &&
|
87
|
+
(prop_b == prop.L || prop_b == prop.V ||
|
88
|
+
prop_b == prop.LV || prop_b == prop.LVT)) {
|
89
|
+
return false;
|
90
|
+
}
|
91
|
+
if ((prop_a == prop.LV || prop_a == prop.V) &&
|
92
|
+
(prop_b == prop.V || prop_b == prop.T)) {
|
93
|
+
return false;
|
94
|
+
}
|
95
|
+
if ((prop_a == prop.LVT || prop_a == prop.T) && (prop_b == prop.T)) {
|
96
|
+
return false;
|
97
|
+
}
|
98
|
+
if (prop_b == prop.EXTEND) {
|
99
|
+
return false;
|
100
|
+
}
|
101
|
+
return true;
|
102
|
+
};
|
103
|
+
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Method to return property enum value of the codepoint. If it is Hangul LV or
|
107
|
+
* LVT, then it is computed; for the rest it is picked from the inversion map.
|
108
|
+
* @param {number} acode The code point value of the character.
|
109
|
+
* @return {number} Property enum value of codepoint.
|
110
|
+
* @private
|
111
|
+
*/
|
112
|
+
goog.i18n.GraphemeBreak.getBreakProp_ = function(acode) {
|
113
|
+
if (0xAC00 <= acode && acode <= 0xD7A3) {
|
114
|
+
var prop = goog.i18n.GraphemeBreak.property;
|
115
|
+
if (acode % 0x1C == 0x10) {
|
116
|
+
return prop.LV;
|
117
|
+
}
|
118
|
+
return prop.LVT;
|
119
|
+
} else {
|
120
|
+
if (!goog.i18n.GraphemeBreak.inversions_) {
|
121
|
+
goog.i18n.GraphemeBreak.inversions_ = new goog.structs.InversionMap(
|
122
|
+
[0, 10, 1, 2, 1, 18, 95, 33, 13, 1, 594, 112, 275, 7, 263, 45, 1, 1,
|
123
|
+
1, 2, 1, 2, 1, 1, 56, 4, 12, 11, 48, 20, 17, 1, 101, 7, 1, 7, 2, 2,
|
124
|
+
1, 4, 33, 1, 1, 1, 30, 27, 91, 11, 58, 9, 269, 2, 1, 56, 1, 1, 3, 8,
|
125
|
+
4, 1, 3, 4, 13, 2, 29, 1, 2, 56, 1, 1, 1, 2, 6, 6, 1, 9, 1, 10, 2,
|
126
|
+
29, 2, 1, 56, 2, 3, 17, 30, 2, 3, 14, 1, 56, 1, 1, 3, 8, 4, 1, 20,
|
127
|
+
2, 29, 1, 2, 56, 1, 1, 2, 1, 6, 6, 11, 10, 2, 30, 1, 59, 1, 1, 1,
|
128
|
+
12, 1, 9, 1, 41, 3, 58, 3, 5, 17, 11, 2, 30, 2, 56, 1, 1, 1, 1, 2,
|
129
|
+
1, 3, 1, 5, 11, 11, 2, 30, 2, 58, 1, 2, 5, 7, 11, 10, 2, 30, 2, 70,
|
130
|
+
6, 2, 6, 7, 19, 2, 60, 11, 5, 5, 1, 1, 8, 97, 13, 3, 5, 3, 6, 74, 2,
|
131
|
+
27, 1, 1, 1, 1, 1, 4, 2, 49, 14, 1, 5, 1, 2, 8, 45, 9, 1, 100, 2, 4,
|
132
|
+
1, 6, 1, 2, 2, 2, 23, 2, 2, 4, 3, 1, 3, 2, 7, 3, 4, 13, 1, 2, 2, 6,
|
133
|
+
1, 1, 1, 112, 96, 72, 82, 357, 1, 946, 3, 29, 3, 29, 2, 30, 2, 64,
|
134
|
+
2, 1, 7, 8, 1, 2, 11, 9, 1, 45, 3, 155, 1, 118, 3, 4, 2, 9, 1, 6, 3,
|
135
|
+
116, 17, 7, 2, 77, 2, 3, 228, 4, 1, 47, 1, 1, 5, 1, 1, 5, 1, 2, 38,
|
136
|
+
9, 12, 2, 1, 30, 1, 4, 2, 2, 1, 121, 8, 8, 2, 2, 392, 64, 523, 1, 2,
|
137
|
+
2, 24, 7, 49, 16, 96, 33, 3311, 32, 554, 6, 105, 2, 30164, 4, 9, 2,
|
138
|
+
388, 1, 3, 1, 4, 1, 23, 2, 2, 1, 88, 2, 50, 16, 1, 97, 8, 25, 11, 2,
|
139
|
+
213, 6, 2, 2, 2, 2, 12, 1, 8, 1, 1, 434, 11172, 1116, 1024, 6942, 1,
|
140
|
+
737, 16, 16, 7, 216, 1, 158, 2, 89, 3, 513, 1, 2051, 15, 40, 8,
|
141
|
+
50981, 1, 1, 3, 3, 1, 5, 8, 8, 2, 7, 30, 4, 148, 3, 798140, 255],
|
142
|
+
[1, 11, 1, 10, 1, 0, 1, 0, 1, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0,
|
143
|
+
2, 0, 1, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 2, 0, 2, 0, 1, 0, 2, 0, 2,
|
144
|
+
0, 2, 0, 2, 0, 2, 4, 0, 2, 0, 4, 2, 4, 2, 0, 2, 0, 2, 0, 2, 4, 0, 2,
|
145
|
+
0, 2, 4, 2, 4, 2, 0, 2, 0, 2, 0, 2, 4, 0, 2, 4, 2, 0, 2, 0, 2, 4, 0,
|
146
|
+
2, 0, 4, 2, 4, 2, 0, 2, 0, 2, 4, 0, 2, 0, 2, 4, 2, 4, 2, 0, 2, 0, 2,
|
147
|
+
0, 2, 4, 2, 4, 2, 0, 2, 0, 4, 0, 2, 4, 2, 0, 2, 0, 4, 0, 2, 0, 4, 2,
|
148
|
+
4, 2, 4, 2, 4, 2, 0, 2, 0, 4, 0, 2, 4, 2, 4, 2, 0, 2, 0, 4, 0, 2, 4,
|
149
|
+
2, 4, 2, 4, 0, 2, 0, 3, 2, 0, 2, 0, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2,
|
150
|
+
0, 2, 0, 4, 0, 2, 4, 2, 0, 2, 0, 2, 0, 2, 0, 4, 2, 4, 2, 4, 2, 4, 2,
|
151
|
+
0, 4, 2, 0, 2, 0, 4, 0, 4, 0, 2, 0, 2, 4, 2, 4, 2, 0, 4, 0, 5, 6, 7,
|
152
|
+
0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 4, 2, 4, 2, 4, 2, 0, 2, 0, 2, 0,
|
153
|
+
2, 0, 2, 4, 2, 4, 2, 4, 2, 0, 4, 0, 4, 0, 2, 4, 0, 2, 4, 0, 2, 4, 2,
|
154
|
+
4, 2, 4, 2, 4, 0, 2, 0, 2, 4, 0, 4, 2, 4, 2, 4, 0, 4, 2, 4, 2, 0, 2,
|
155
|
+
0, 1, 2, 1, 0, 1, 0, 1, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0,
|
156
|
+
2, 0, 2, 0, 4, 2, 4, 0, 4, 0, 4, 2, 0, 2, 0, 2, 4, 0, 2, 4, 2, 4, 2,
|
157
|
+
0, 2, 0, 2, 4, 0, 9, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2,
|
158
|
+
0, 2, 0, 2, 0, 2, 4, 2, 0, 4, 2, 1, 2, 0, 2, 0, 2, 0, 2, 0, 1, 2],
|
159
|
+
true);
|
160
|
+
}
|
161
|
+
return (/** @type {number} */
|
162
|
+
goog.i18n.GraphemeBreak.inversions_.at(acode));
|
163
|
+
}
|
164
|
+
};
|
165
|
+
|
166
|
+
|
167
|
+
/**
|
168
|
+
* There are two kinds of grapheme clusters: 1) Legacy 2)Extended. This method
|
169
|
+
* is to check for both using a boolean flag to switch between them.
|
170
|
+
* @param {number} a The code point value of the first character.
|
171
|
+
* @param {number} b The code point value of the second character.
|
172
|
+
* @param {boolean=} opt_extended If true, indicates extended grapheme cluster;
|
173
|
+
* If false, indicates legacy cluster.
|
174
|
+
* @return {boolean} True if a & b do not form a cluster; False otherwise.
|
175
|
+
*/
|
176
|
+
goog.i18n.GraphemeBreak.hasGraphemeBreak = function(a, b, opt_extended) {
|
177
|
+
|
178
|
+
var prop_a = goog.i18n.GraphemeBreak.getBreakProp_(a);
|
179
|
+
var prop_b = goog.i18n.GraphemeBreak.getBreakProp_(b);
|
180
|
+
var prop = goog.i18n.GraphemeBreak.property;
|
181
|
+
|
182
|
+
return goog.i18n.GraphemeBreak.applyLegacyBreakRules_(prop_a, prop_b) &&
|
183
|
+
!(opt_extended && (prop_a == prop.PREPEND || prop_b == prop.SPACING_MARK));
|
184
|
+
};
|
185
|
+
;
|
186
|
+
FI"
|
187
|
+
F"%6ce3b02dac65041a34221109dc9d180f
|
@@ -0,0 +1,457 @@
|
|
1
|
+
o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325549268.123588:@value{ I"length:EFi:I"digest;
|
2
|
+
F"%e8dff6f49f2e5eefe3a7589f155fd5cdI"source;
|
3
|
+
FI":// Copyright 2006 The Closure Library Authors. All Rights Reserved.
|
4
|
+
//
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
// you may not use this file except in compliance with the License.
|
7
|
+
// You may obtain a copy of the License at
|
8
|
+
//
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
//
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
12
|
+
// distributed under the License is distributed on an "AS-IS" BASIS,
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
// See the License for the specific language governing permissions and
|
15
|
+
// limitations under the License.
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @fileoverview Provides utility functions for formatting strings, numbers etc.
|
19
|
+
*
|
20
|
+
*/
|
21
|
+
|
22
|
+
|
23
|
+
goog.provide('goog.format');
|
24
|
+
|
25
|
+
goog.require('goog.i18n.GraphemeBreak');
|
26
|
+
goog.require('goog.string');
|
27
|
+
goog.require('goog.userAgent');
|
28
|
+
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Formats a number of bytes in human readable form.
|
32
|
+
* 54, 450K, 1.3M, 5G etc.
|
33
|
+
* @param {number} bytes The number of bytes to show.
|
34
|
+
* @param {number=} opt_decimals The number of decimals to use. Defaults to 2.
|
35
|
+
* @return {string} The human readable form of the byte size.
|
36
|
+
*/
|
37
|
+
goog.format.fileSize = function(bytes, opt_decimals) {
|
38
|
+
return goog.format.numBytesToString(bytes, opt_decimals, false);
|
39
|
+
};
|
40
|
+
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Checks whether string value containing scaling units (K, M, G, T, P, m,
|
44
|
+
* u, n) can be converted to a number.
|
45
|
+
*
|
46
|
+
* Where there is a decimal, there must be a digit to the left of the
|
47
|
+
* decimal point.
|
48
|
+
*
|
49
|
+
* Negative numbers are valid.
|
50
|
+
*
|
51
|
+
* Examples:
|
52
|
+
* 0, 1, 1.0, 10.4K, 2.3M, -0.3P, 1.2m
|
53
|
+
*
|
54
|
+
* @param {string} val String value to check.
|
55
|
+
* @return {boolean} True if string could be converted to a numeric value.
|
56
|
+
*/
|
57
|
+
goog.format.isConvertableScaledNumber = function(val) {
|
58
|
+
return goog.format.SCALED_NUMERIC_RE_.test(val);
|
59
|
+
};
|
60
|
+
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Converts a string to numeric value, taking into account the units.
|
64
|
+
* If string ends in 'B', use binary conversion.
|
65
|
+
* @param {string} stringValue String to be converted to numeric value.
|
66
|
+
* @return {number} Numeric value for string.
|
67
|
+
*/
|
68
|
+
goog.format.stringToNumericValue = function(stringValue) {
|
69
|
+
if (goog.string.endsWith(stringValue, 'B')) {
|
70
|
+
return goog.format.stringToNumericValue_(
|
71
|
+
stringValue, goog.format.NUMERIC_SCALES_BINARY_);
|
72
|
+
}
|
73
|
+
return goog.format.stringToNumericValue_(
|
74
|
+
stringValue, goog.format.NUMERIC_SCALES_SI_);
|
75
|
+
};
|
76
|
+
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Converts a string to number of bytes, taking into account the units.
|
80
|
+
* Binary conversion.
|
81
|
+
* @param {string} stringValue String to be converted to numeric value.
|
82
|
+
* @return {number} Numeric value for string.
|
83
|
+
*/
|
84
|
+
goog.format.stringToNumBytes = function(stringValue) {
|
85
|
+
return goog.format.stringToNumericValue_(
|
86
|
+
stringValue, goog.format.NUMERIC_SCALES_BINARY_);
|
87
|
+
};
|
88
|
+
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Converts a numeric value to string representation. SI conversion.
|
92
|
+
* @param {number} val Value to be converted.
|
93
|
+
* @param {number=} opt_decimals The number of decimals to use. Defaults to 2.
|
94
|
+
* @return {string} String representation of number.
|
95
|
+
*/
|
96
|
+
goog.format.numericValueToString = function(val, opt_decimals) {
|
97
|
+
return goog.format.numericValueToString_(
|
98
|
+
val, goog.format.NUMERIC_SCALES_SI_, opt_decimals);
|
99
|
+
};
|
100
|
+
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Converts number of bytes to string representation. Binary conversion.
|
104
|
+
* Default is to return the additional 'B' suffix, e.g. '10.5KB' to minimize
|
105
|
+
* confusion with counts that are scaled by powers of 1000.
|
106
|
+
* @param {number} val Value to be converted.
|
107
|
+
* @param {number=} opt_decimals The number of decimals to use. Defaults to 2.
|
108
|
+
* @param {boolean=} opt_suffix If true, include trailing 'B' in returned
|
109
|
+
* string. Default is true.
|
110
|
+
* @return {string} String representation of number of bytes.
|
111
|
+
*/
|
112
|
+
goog.format.numBytesToString = function(val, opt_decimals, opt_suffix) {
|
113
|
+
var suffix = '';
|
114
|
+
if (!goog.isDef(opt_suffix) || opt_suffix) {
|
115
|
+
suffix = 'B';
|
116
|
+
}
|
117
|
+
return goog.format.numericValueToString_(
|
118
|
+
val, goog.format.NUMERIC_SCALES_BINARY_, opt_decimals, suffix);
|
119
|
+
};
|
120
|
+
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Converts a string to numeric value, taking into account the units.
|
124
|
+
* @param {string} stringValue String to be converted to numeric value.
|
125
|
+
* @param {Object} conversion Dictionary of conversion scales.
|
126
|
+
* @return {number} Numeric value for string. If it cannot be converted,
|
127
|
+
* returns NaN.
|
128
|
+
* @private
|
129
|
+
*/
|
130
|
+
goog.format.stringToNumericValue_ = function(stringValue, conversion) {
|
131
|
+
var match = stringValue.match(goog.format.SCALED_NUMERIC_RE_);
|
132
|
+
if (!match) {
|
133
|
+
return NaN;
|
134
|
+
}
|
135
|
+
var val = match[1] * conversion[match[2]];
|
136
|
+
return val;
|
137
|
+
};
|
138
|
+
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Converts a numeric value to string, using specified conversion
|
142
|
+
* scales.
|
143
|
+
* @param {number} val Value to be converted.
|
144
|
+
* @param {Object} conversion Dictionary of scaling factors.
|
145
|
+
* @param {number=} opt_decimals The number of decimals to use. Default is 2.
|
146
|
+
* @param {string=} opt_suffix Optional suffix to append.
|
147
|
+
* @return {string} The human readable form of the byte size.
|
148
|
+
* @private
|
149
|
+
*/
|
150
|
+
goog.format.numericValueToString_ = function(val, conversion,
|
151
|
+
opt_decimals, opt_suffix) {
|
152
|
+
var prefixes = goog.format.NUMERIC_SCALE_PREFIXES_;
|
153
|
+
var orig_val = val;
|
154
|
+
var symbol = '';
|
155
|
+
var scale = 1;
|
156
|
+
if (val < 0) {
|
157
|
+
val = -val;
|
158
|
+
}
|
159
|
+
for (var i = 0; i < prefixes.length; i++) {
|
160
|
+
var unit = prefixes[i];
|
161
|
+
scale = conversion[unit];
|
162
|
+
if (val >= scale || (scale <= 1 && val > 0.1 * scale)) {
|
163
|
+
// Treat values less than 1 differently, allowing 0.5 to be "0.5" rather
|
164
|
+
// than "500m"
|
165
|
+
symbol = unit;
|
166
|
+
break;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
if (!symbol) {
|
170
|
+
scale = 1;
|
171
|
+
} else if (opt_suffix) {
|
172
|
+
symbol += opt_suffix;
|
173
|
+
}
|
174
|
+
var ex = Math.pow(10, goog.isDef(opt_decimals) ? opt_decimals : 2);
|
175
|
+
return Math.round(orig_val / scale * ex) / ex + symbol;
|
176
|
+
};
|
177
|
+
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Regular expression for detecting scaling units, such as K, M, G, etc. for
|
181
|
+
* converting a string representation to a numeric value.
|
182
|
+
*
|
183
|
+
* Also allow 'k' to be aliased to 'K'. These could be used for SI (powers
|
184
|
+
* of 1000) or Binary (powers of 1024) conversions.
|
185
|
+
*
|
186
|
+
* Also allow final 'B' to be interpreted as byte-count, implicitly triggering
|
187
|
+
* binary conversion (e.g., '10.2MB').
|
188
|
+
*
|
189
|
+
* @type {RegExp}
|
190
|
+
* @private
|
191
|
+
*/
|
192
|
+
goog.format.SCALED_NUMERIC_RE_ = /^([-]?\d+\.?\d*)([K,M,G,T,P,k,m,u,n]?)[B]?$/;
|
193
|
+
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Ordered list of scaling prefixes in decreasing order.
|
197
|
+
* @type {Array}
|
198
|
+
* @private
|
199
|
+
*/
|
200
|
+
goog.format.NUMERIC_SCALE_PREFIXES_ = [
|
201
|
+
'P', 'T', 'G', 'M', 'K', '', 'm', 'u', 'n'
|
202
|
+
];
|
203
|
+
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Scaling factors for conversion of numeric value to string. SI conversion.
|
207
|
+
* @type {Object}
|
208
|
+
* @private
|
209
|
+
*/
|
210
|
+
goog.format.NUMERIC_SCALES_SI_ = {
|
211
|
+
'': 1,
|
212
|
+
'n': 1e-9,
|
213
|
+
'u': 1e-6,
|
214
|
+
'm': 1e-3,
|
215
|
+
'k': 1e3,
|
216
|
+
'K': 1e3,
|
217
|
+
'M': 1e6,
|
218
|
+
'G': 1e9,
|
219
|
+
'T': 1e12,
|
220
|
+
'P': 1e15
|
221
|
+
};
|
222
|
+
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Scaling factors for conversion of numeric value to string. Binary
|
226
|
+
* conversion.
|
227
|
+
* @type {Object}
|
228
|
+
* @private
|
229
|
+
*/
|
230
|
+
goog.format.NUMERIC_SCALES_BINARY_ = {
|
231
|
+
'': 1,
|
232
|
+
'n': Math.pow(1024, -3),
|
233
|
+
'u': Math.pow(1024, -2),
|
234
|
+
'm': 1.0 / 1024,
|
235
|
+
'k': 1024,
|
236
|
+
'K': 1024,
|
237
|
+
'M': Math.pow(1024, 2),
|
238
|
+
'G': Math.pow(1024, 3),
|
239
|
+
'T': Math.pow(1024, 4),
|
240
|
+
'P': Math.pow(1024, 5)
|
241
|
+
};
|
242
|
+
|
243
|
+
|
244
|
+
/**
|
245
|
+
* First Unicode code point that has the Mark property.
|
246
|
+
* @type {number}
|
247
|
+
* @private
|
248
|
+
*/
|
249
|
+
goog.format.FIRST_GRAPHEME_EXTEND_ = 0x300;
|
250
|
+
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Inserts word breaks into an HTML string at a given interval. The counter is
|
254
|
+
* reset if a space is encountered. WBRs aren't inserted into HTML tags or
|
255
|
+
* entities. Entites count towards the character count, HTML tags do not.
|
256
|
+
*
|
257
|
+
* With common strings aliased, objects allocations are constant based on the
|
258
|
+
* length of the string: N + 3. This guarantee does not hold if the string
|
259
|
+
* contains an element >= U+0300 and hasGraphemeBreak is non-trivial.
|
260
|
+
*
|
261
|
+
* @param {string} str HTML to insert word breaks into.
|
262
|
+
* @param {function(number, number, boolean): boolean} hasGraphemeBreak A
|
263
|
+
* function determining if there is a grapheme break between two characters,
|
264
|
+
* in the same signature as goog.i18n.GraphemeBreak.hasGraphemeBreak.
|
265
|
+
* @param {number=} opt_maxlen Maximum length after which to ensure
|
266
|
+
* there is a break. Default is 10 characters.
|
267
|
+
* @return {string} The string including word breaks.
|
268
|
+
* @private
|
269
|
+
*/
|
270
|
+
goog.format.insertWordBreaksGeneric_ = function(str, hasGraphemeBreak,
|
271
|
+
opt_maxlen) {
|
272
|
+
var maxlen = opt_maxlen || 10;
|
273
|
+
if (maxlen > str.length) return str;
|
274
|
+
|
275
|
+
var rv = [];
|
276
|
+
var n = 0; // The length of the current token
|
277
|
+
|
278
|
+
// This will contain the ampersand or less-than character if one of the
|
279
|
+
// two has been seen; otherwise, the value is zero.
|
280
|
+
var nestingCharCode = 0;
|
281
|
+
|
282
|
+
// First character position from input string that has not been outputted.
|
283
|
+
var lastDumpPosition = 0;
|
284
|
+
|
285
|
+
var charCode = 0;
|
286
|
+
for (var i = 0; i < str.length; i++) {
|
287
|
+
// Using charCodeAt versus charAt avoids allocating new string objects.
|
288
|
+
var lastCharCode = charCode;
|
289
|
+
charCode = str.charCodeAt(i);
|
290
|
+
|
291
|
+
// Don't add a WBR before characters that might be grapheme extending.
|
292
|
+
var isPotentiallyGraphemeExtending =
|
293
|
+
charCode >= goog.format.FIRST_GRAPHEME_EXTEND_ &&
|
294
|
+
!hasGraphemeBreak(lastCharCode, charCode, true);
|
295
|
+
|
296
|
+
// Don't add a WBR at the end of a word. For simplicity, all control
|
297
|
+
// characters are treated as whitespace.
|
298
|
+
if (n >= maxlen &&
|
299
|
+
charCode > goog.format.WbrToken_.SPACE &&
|
300
|
+
!isPotentiallyGraphemeExtending) {
|
301
|
+
// Flush everything seen so far, and append a word break.
|
302
|
+
rv.push(str.substring(lastDumpPosition, i), goog.format.WORD_BREAK_HTML);
|
303
|
+
lastDumpPosition = i;
|
304
|
+
n = 0;
|
305
|
+
}
|
306
|
+
|
307
|
+
if (!nestingCharCode) {
|
308
|
+
// Not currently within an HTML tag or entity
|
309
|
+
|
310
|
+
if (charCode == goog.format.WbrToken_.LT ||
|
311
|
+
charCode == goog.format.WbrToken_.AMP) {
|
312
|
+
|
313
|
+
// Entering an HTML Entity '&' or open tag '<'
|
314
|
+
nestingCharCode = charCode;
|
315
|
+
} else if (charCode <= goog.format.WbrToken_.SPACE) {
|
316
|
+
|
317
|
+
// A space or control character -- reset the token length
|
318
|
+
n = 0;
|
319
|
+
} else {
|
320
|
+
|
321
|
+
// A normal flow character - increment. For grapheme extending
|
322
|
+
// characters, this is not *technically* a new character. However,
|
323
|
+
// since the grapheme break detector might be overly conservative,
|
324
|
+
// we have to continue incrementing, or else we won't even be able
|
325
|
+
// to add breaks when we get to things like punctuation. For the
|
326
|
+
// case where we have a full grapheme break detector, it is okay if
|
327
|
+
// we occasionally break slightly early.
|
328
|
+
n++;
|
329
|
+
}
|
330
|
+
} else if (charCode == goog.format.WbrToken_.GT &&
|
331
|
+
nestingCharCode == goog.format.WbrToken_.LT) {
|
332
|
+
|
333
|
+
// Leaving an HTML tag, treat the tag as zero-length
|
334
|
+
nestingCharCode = 0;
|
335
|
+
} else if (charCode == goog.format.WbrToken_.SEMI_COLON &&
|
336
|
+
nestingCharCode == goog.format.WbrToken_.AMP) {
|
337
|
+
|
338
|
+
// Leaving an HTML entity, treat it as length one
|
339
|
+
nestingCharCode = 0;
|
340
|
+
n++;
|
341
|
+
}
|
342
|
+
}
|
343
|
+
|
344
|
+
// Take care of anything we haven't flushed so far.
|
345
|
+
rv.push(str.substr(lastDumpPosition));
|
346
|
+
|
347
|
+
return rv.join('');
|
348
|
+
};
|
349
|
+
|
350
|
+
|
351
|
+
/**
|
352
|
+
* Inserts word breaks into an HTML string at a given interval.
|
353
|
+
*
|
354
|
+
* This method is as aggressive as possible, using a full table of Unicode
|
355
|
+
* characters where it is legal to insert word breaks; however, this table
|
356
|
+
* comes at a 2.5k pre-gzip (~1k post-gzip) size cost. Consider using
|
357
|
+
* insertWordBreaksBasic to minimize the size impact.
|
358
|
+
*
|
359
|
+
* @param {string} str HTML to insert word breaks into.
|
360
|
+
* @param {number=} opt_maxlen Maximum length after which to ensure there is a
|
361
|
+
* break. Default is 10 characters.
|
362
|
+
* @return {string} The string including word breaks.
|
363
|
+
*/
|
364
|
+
goog.format.insertWordBreaks = function(str, opt_maxlen) {
|
365
|
+
return goog.format.insertWordBreaksGeneric_(str,
|
366
|
+
goog.i18n.GraphemeBreak.hasGraphemeBreak, opt_maxlen);
|
367
|
+
};
|
368
|
+
|
369
|
+
|
370
|
+
/**
|
371
|
+
* Determines conservatively if a character has a Grapheme break.
|
372
|
+
*
|
373
|
+
* Conforms to a similar signature as goog.i18n.GraphemeBreak, but is overly
|
374
|
+
* conservative, returning true only for characters in common scripts that
|
375
|
+
* are simple to account for.
|
376
|
+
*
|
377
|
+
* @param {number} lastCharCode The previous character code. Ignored.
|
378
|
+
* @param {number} charCode The character code under consideration. It must be
|
379
|
+
* at least \u0300 as a precondition -- this case is covered by
|
380
|
+
* insertWordBreaksGeneric_.
|
381
|
+
* @param {boolean=} opt_extended Ignored, to conform with the interface.
|
382
|
+
* @return {boolean} Whether it is one of the recognized subsets of characters
|
383
|
+
* with a grapheme break.
|
384
|
+
* @private
|
385
|
+
*/
|
386
|
+
goog.format.conservativelyHasGraphemeBreak_ = function(
|
387
|
+
lastCharCode, charCode, opt_extended) {
|
388
|
+
// Return false for everything except the most common Cyrillic characters.
|
389
|
+
// Don't worry about Latin characters, because insertWordBreaksGeneric_
|
390
|
+
// itself already handles those.
|
391
|
+
// TODO(gboyer): Also account for Greek, Armenian, and Georgian if it is
|
392
|
+
// simple to do so.
|
393
|
+
return charCode >= 0x400 && charCode < 0x523;
|
394
|
+
};
|
395
|
+
|
396
|
+
|
397
|
+
// TODO(gboyer): Consider using a compile-time flag to switch implementations
|
398
|
+
// rather than relying on the developers to toggle implementations.
|
399
|
+
/**
|
400
|
+
* Inserts word breaks into an HTML string at a given interval.
|
401
|
+
*
|
402
|
+
* This method is less aggressive than insertWordBreaks, only inserting
|
403
|
+
* breaks next to punctuation and between Latin or Cyrillic characters.
|
404
|
+
* However, this is good enough for the common case of URLs. It also
|
405
|
+
* works for all Latin and Cyrillic languages, plus CJK has no need for word
|
406
|
+
* breaks. When this method is used, goog.i18n.GraphemeBreak may be dead
|
407
|
+
* code eliminated.
|
408
|
+
*
|
409
|
+
* @param {string} str HTML to insert word breaks into.
|
410
|
+
* @param {number=} opt_maxlen Maximum length after which to ensure there is a
|
411
|
+
* break. Default is 10 characters.
|
412
|
+
* @return {string} The string including word breaks.
|
413
|
+
*/
|
414
|
+
goog.format.insertWordBreaksBasic = function(str, opt_maxlen) {
|
415
|
+
return goog.format.insertWordBreaksGeneric_(str,
|
416
|
+
goog.format.conservativelyHasGraphemeBreak_, opt_maxlen);
|
417
|
+
};
|
418
|
+
|
419
|
+
|
420
|
+
/**
|
421
|
+
* True iff the current userAgent is IE8 or above.
|
422
|
+
* @type {boolean}
|
423
|
+
* @private
|
424
|
+
*/
|
425
|
+
goog.format.IS_IE8_OR_ABOVE_ = goog.userAgent.IE &&
|
426
|
+
goog.userAgent.isVersion(8);
|
427
|
+
|
428
|
+
|
429
|
+
/**
|
430
|
+
* Constant for the WBR replacement used by insertWordBreaks. Safari requires
|
431
|
+
* <wbr></wbr>, Opera needs the ­ entity, though this will give a visible
|
432
|
+
* hyphen at breaks. IE8 uses a zero width space.
|
433
|
+
* Other browsers just use <wbr>.
|
434
|
+
* @type {string}
|
435
|
+
*/
|
436
|
+
goog.format.WORD_BREAK_HTML =
|
437
|
+
goog.userAgent.WEBKIT ?
|
438
|
+
'<wbr></wbr>' : goog.userAgent.OPERA ?
|
439
|
+
'­' : goog.format.IS_IE8_OR_ABOVE_ ?
|
440
|
+
'​' : '<wbr>';
|
441
|
+
|
442
|
+
|
443
|
+
/**
|
444
|
+
* Tokens used within insertWordBreaks.
|
445
|
+
* @private
|
446
|
+
* @enum {number}
|
447
|
+
*/
|
448
|
+
goog.format.WbrToken_ = {
|
449
|
+
LT: 60, // '<'.charCodeAt(0)
|
450
|
+
GT: 62, // '>'.charCodeAt(0)
|
451
|
+
AMP: 38, // '&'.charCodeAt(0)
|
452
|
+
SEMI_COLON: 59, // ';'.charCodeAt(0)
|
453
|
+
SPACE: 32 // ' '.charCodeAt(0)
|
454
|
+
};
|
455
|
+
;
|
456
|
+
FI"
|
457
|
+
F"%388ae2f14aeefbca3921a1ef0758d2f0
|