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.
Files changed (109) hide show
  1. data/README.rst +42 -20
  2. data/lib/generators/templates/yellow_brick_road.rb.erb +19 -0
  3. data/lib/generators/yellow_brick_road/install_generator.rb +14 -0
  4. data/lib/yellow-brick-road/config.rb +41 -8
  5. data/lib/yellow-brick-road/directive_processor.rb +6 -5
  6. data/lib/yellow-brick-road/engine.rb +2 -3
  7. data/lib/yellow-brick-road/soy_processor.rb +1 -1
  8. data/lib/yellow-brick-road/version.rb +1 -1
  9. data/test/dummy/app/assets/javascripts/closure-deps.js +1 -1
  10. data/test/dummy/config/initializers/yellow_brick_road.rb +18 -1
  11. data/test/dummy/log/development.log +2208 -0
  12. data/test/dummy/tmp/cache/assets/C33/E00/sprockets%2F50c54266987e056bca666f8951752841 +2556 -0
  13. data/test/dummy/tmp/cache/assets/C48/990/sprockets%2F182c7921a46c3b8603c7f5595a111407 +823 -0
  14. data/test/dummy/tmp/cache/assets/C53/B40/sprockets%2F48cf0c035092dc945559526a279061c6 +204 -0
  15. data/test/dummy/tmp/cache/assets/C60/DB0/sprockets%2F3f00684578f2a3246581db667309ed89 +187 -0
  16. data/test/dummy/tmp/cache/assets/C60/E40/sprockets%2F3c5422f721521f492a5f02ca00b70009 +457 -0
  17. data/test/dummy/tmp/cache/assets/C73/DE0/sprockets%2F21f1f4574326846114a3c106873cebc3 +0 -0
  18. data/test/dummy/tmp/cache/assets/C7E/9F0/sprockets%2F89862076204c62c4593ac20de32da909 +4 -4
  19. data/test/dummy/tmp/cache/assets/C80/6F0/sprockets%2F56459a0713f8610d7d261f8be93073a2 +115 -0
  20. data/test/dummy/tmp/cache/assets/C8D/E10/sprockets%2F34b84bc4732937f885707002eda3896e +511 -0
  21. data/test/dummy/tmp/cache/assets/C93/CB0/sprockets%2F539b403b24833ca478a6f5877f37687c +239 -0
  22. data/test/dummy/tmp/cache/assets/C9A/C70/sprockets%2F10933dc6d342f604514713510b9ef0ab +806 -0
  23. data/test/dummy/tmp/cache/assets/CA0/7C0/sprockets%2Ff591bc0af8f085501241305c04907d3e +590 -0
  24. data/test/dummy/tmp/cache/assets/CA1/4A0/sprockets%2F5a9ad311e7d225b530b597041714b1e9 +2539 -0
  25. data/test/dummy/tmp/cache/assets/CA7/310/sprockets%2F45664cf816315200b574e029fde6f10a +0 -0
  26. data/test/dummy/tmp/cache/assets/CA7/A80/sprockets%2F1f32590957635a5a4f35442bc22f4ca4 +0 -0
  27. data/test/dummy/tmp/cache/assets/CAE/1D0/sprockets%2F2e62c7733d38a817a1532a744c6287bd +72 -0
  28. data/test/dummy/tmp/cache/assets/CB2/3C0/sprockets%2F9c35c290501a896b82c31448a39f3d5d +142 -0
  29. data/test/dummy/tmp/cache/assets/CB3/F20/sprockets%2F558b00e493fb501f7d95761e7eb40273 +2539 -0
  30. data/test/dummy/tmp/cache/assets/CBE/550/sprockets%2Fd680cac830e0b3408ba910f0b0421147 +2 -2
  31. data/test/dummy/tmp/cache/assets/CCD/480/sprockets%2Ffe7e11511634a2d03e1a20980b4593cf +0 -0
  32. data/test/dummy/tmp/cache/assets/CD0/080/sprockets%2Ffd5cbb87741244521d013d11c55573fa +204 -0
  33. data/test/dummy/tmp/cache/assets/CD2/020/sprockets%2Ff97740ba22118a2c91e992aac041843b +811 -0
  34. data/test/dummy/tmp/cache/assets/CD8/D90/sprockets%2F55dd841661d646f0024261a08ecf8ec0 +823 -0
  35. data/test/dummy/tmp/cache/assets/CE3/0D0/sprockets%2F301f97a178fd839a81bd663a6e22b616 +811 -0
  36. data/test/dummy/tmp/cache/assets/CE4/330/sprockets%2Fbd23466639af99164ab8e1c93721f14b +127 -0
  37. data/test/dummy/tmp/cache/assets/CE6/8A0/sprockets%2F3c0e7c5fa31563c8e820d6771e09918d +103 -0
  38. data/test/dummy/tmp/cache/assets/CEB/120/sprockets%2F857a0dde6829f7a27b93a840e1c60469 +522 -0
  39. data/test/dummy/tmp/cache/assets/CEE/CF0/sprockets%2F376f94b987d8156056c4e1d38ec06bf0 +0 -0
  40. data/test/dummy/tmp/cache/assets/CF2/C10/sprockets%2Fc64ef8a9dd0a1c3101d662750105c11a +806 -0
  41. data/test/dummy/tmp/cache/assets/CF3/CD0/sprockets%2F4bb42a5a6b504190f10d20b1c5f93d54 +1529 -0
  42. data/test/dummy/tmp/cache/assets/CF6/890/sprockets%2F36007a87f140155b5a04f2ca6b262dcc +494 -0
  43. data/test/dummy/tmp/cache/assets/CF6/9D0/sprockets%2F34b7199e9d33994c8ec7a442d60ca985 +173 -0
  44. data/test/dummy/tmp/cache/assets/CFA/A90/sprockets%2F901ba405a6d6747f6412ed4d0e0ac620 +256 -0
  45. data/test/dummy/tmp/cache/assets/CFC/E70/sprockets%2F8ee639668b5f0e629fbe0d62d1394689 +173 -0
  46. data/test/dummy/tmp/cache/assets/D04/1B0/sprockets%2F418f2b3b6b08b320f6db268a0991c54c +0 -0
  47. data/test/dummy/tmp/cache/assets/D05/920/sprockets%2F909507434dcc270db4853e4c147f0aac +5 -4
  48. data/test/dummy/tmp/cache/assets/D07/DB0/sprockets%2F0c17d7dac64290e385c91eb6f1570b31 +511 -0
  49. data/test/dummy/tmp/cache/assets/D07/EE0/sprockets%2F4999982b09e0b786894fce44f5d783cc +1371 -0
  50. data/test/dummy/tmp/cache/assets/D09/380/sprockets%2F14383e18fa2faac6b561a29d8e132863 +0 -0
  51. data/test/dummy/tmp/cache/assets/D0D/200/sprockets%2F545a7e34cce1d4272d83d58fd4215d42 +1277 -0
  52. data/test/dummy/tmp/cache/assets/D0E/870/sprockets%2F84996444f4f1f3fdc0248131cfb1a3b6 +794 -0
  53. data/test/dummy/tmp/cache/assets/D15/F60/sprockets%2Fa28394e3f80365b5bc86794dd46daa22 +0 -0
  54. data/test/dummy/tmp/cache/assets/D18/950/sprockets%2Fcf650d67c5d431ffdb38552e562299b2 +474 -0
  55. data/test/dummy/tmp/cache/assets/D18/E10/sprockets%2Fec7c58f640556b401fcd66528352dc9d +474 -0
  56. data/test/dummy/tmp/cache/assets/D20/660/sprockets%2F0d2875475ced01df962f3d758cda7792 +103 -0
  57. data/test/dummy/tmp/cache/assets/D22/AB0/sprockets%2F0b08e7f81651aaf739a93d61ae99779c +283 -0
  58. data/test/dummy/tmp/cache/assets/D2E/B20/sprockets%2Feed5412a17a52b1a335925e2af1f75d3 +0 -0
  59. data/test/dummy/tmp/cache/assets/D36/700/sprockets%2Fd219bf9db2eacc105bb294755093a437 +505 -0
  60. data/test/dummy/tmp/cache/assets/D3B/A10/sprockets%2Fcf38b51682d84a04da7b8a7313de52c6 +207 -0
  61. data/test/dummy/tmp/cache/assets/D3C/0E0/sprockets%2Fe9d7aba138d602c4a6ac701bc9615977 +505 -0
  62. data/test/dummy/tmp/cache/assets/D3E/FF0/sprockets%2F6bd8ccd3e02f397c20f349d5c0960e51 +0 -0
  63. data/test/dummy/tmp/cache/assets/D41/B30/sprockets%2Fba1b93913dd01d83ac9a96df334456f8 +0 -0
  64. data/test/dummy/tmp/cache/assets/D41/DA0/sprockets%2Fe8d00810698a9fcee032022fefd084f7 +0 -0
  65. data/test/dummy/tmp/cache/assets/D44/CF0/sprockets%2Ffa31a45f04884493c909c5a67fcbdf23 +1371 -0
  66. data/test/dummy/tmp/cache/assets/D47/BE0/sprockets%2F0b5ebdf6dec160a264698e7f745061e8 +142 -0
  67. data/test/dummy/tmp/cache/assets/D4C/F30/sprockets%2Ff90155c10f59a3fe44959ac09bf817fe +2556 -0
  68. data/test/dummy/tmp/cache/assets/D4E/7C0/sprockets%2Ff01b58512d01eda23fd5cb23a2b28b60 +1529 -0
  69. data/test/dummy/tmp/cache/assets/D4E/860/sprockets%2F86eed0c77c47d0970345bbabb58d8939 +1277 -0
  70. data/test/dummy/tmp/cache/assets/D4E/C30/sprockets%2F52420c10c73ca310d026565eafdadb4e +1545 -0
  71. data/test/dummy/tmp/cache/assets/D4E/F60/sprockets%2F9893a3c5aeb1a9e77469f4751b4d3c3f +115 -0
  72. data/test/dummy/tmp/cache/assets/D4F/E60/sprockets%2F17ee65de1f78c3dd5c165a9867e810b6 +165 -0
  73. data/test/dummy/tmp/cache/assets/D57/0D0/sprockets%2Fa29e6e8106d9d5ed1e2889126cfbf877 +300 -0
  74. data/test/dummy/tmp/cache/assets/D5C/650/sprockets%2Fe1c381da3cc213a639e956ae3315a2bd +607 -0
  75. data/test/dummy/tmp/cache/assets/D61/860/sprockets%2Fbf032a3b4aad2c2e25704e65c966cf45 +794 -0
  76. data/test/dummy/tmp/cache/assets/D63/B20/sprockets%2F31fc70ce66bb80fb9421be34eb3b0287 +0 -0
  77. data/test/dummy/tmp/cache/assets/D64/D60/sprockets%2Fa544ea03bf0a45948a053ba76ec2a79f +239 -0
  78. data/test/dummy/tmp/cache/assets/D6B/F90/sprockets%2F66636712ecb1fcc777dccf7643a0e1b1 +127 -0
  79. data/test/dummy/tmp/cache/assets/D6E/AD0/sprockets%2Fc91cdc6a72c729d7a64119198b3d2eab +0 -0
  80. data/test/dummy/tmp/cache/assets/D6F/140/sprockets%2F9ddc51f4388dd5243a28dba1ce47572b +53 -0
  81. data/test/dummy/tmp/cache/assets/D72/800/sprockets%2F92baa375d54e16fe0a5c7f079a1ce992 +165 -0
  82. data/test/dummy/tmp/cache/assets/D74/220/sprockets%2F3f888bda53179cb945eab35fbd31a708 +53 -0
  83. data/test/dummy/tmp/cache/assets/D78/5F0/sprockets%2F638ed6af667d4fc5147f72ff34aa2d33 +0 -0
  84. data/test/dummy/tmp/cache/assets/D7D/640/sprockets%2F95a7c5580f957c31e1ab9d0773ed5fde +607 -0
  85. data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +6 -5
  86. data/test/dummy/tmp/cache/assets/D89/020/sprockets%2Fa06df6166e70324e712e54b1cafca0ae +187 -0
  87. data/test/dummy/tmp/cache/assets/D8A/9F0/sprockets%2Fc06547ca33ee3d03be14ce045ae1c9e2 +207 -0
  88. data/test/dummy/tmp/cache/assets/D9E/B80/sprockets%2F9561df1d45c7ff4aa8ac3e2df0c99121 +0 -0
  89. data/test/dummy/tmp/cache/assets/DA3/F30/sprockets%2Fe015d6ccdfcf022e47c83d7906f728ae +457 -0
  90. data/test/dummy/tmp/cache/assets/DAE/190/sprockets%2F433c7b21968be8d1f9bfdbdf7a637c57 +0 -0
  91. data/test/dummy/tmp/cache/assets/DB3/600/sprockets%2F9b70ae73f15ba693886eeef4eb5d6c75 +0 -0
  92. data/test/dummy/tmp/cache/assets/DB4/510/sprockets%2F29cdae8e29c88fd9ddbd4831419560fe +1260 -0
  93. data/test/dummy/tmp/cache/assets/DC1/4A0/sprockets%2F0b63dfcf163f2faeb612724eb4545bcc +1354 -0
  94. data/test/dummy/tmp/cache/assets/DC4/C10/sprockets%2Fcf48f4cbad3db33146eab4c577c1d209 +300 -0
  95. data/test/dummy/tmp/cache/assets/DC4/CA0/sprockets%2Fd0da8a60ea4dc16b9fd3e2a50d88633c +0 -0
  96. data/test/dummy/tmp/cache/assets/DC7/8C0/sprockets%2F1ad68dcc9ef598d3811ba2ac5c0ea182 +1354 -0
  97. data/test/dummy/tmp/cache/assets/DC7/C00/sprockets%2Fba755ff3a81c3192f0e45a4f7c0c7dcb +0 -0
  98. data/test/dummy/tmp/cache/assets/DCA/760/sprockets%2F717c4cea10bf601090ffdfe4e668e4cb +283 -0
  99. data/test/dummy/tmp/cache/assets/DCA/DE0/sprockets%2F51dcced9ec2b3cd4b1cc2949f860c361 +590 -0
  100. data/test/dummy/tmp/cache/assets/DD7/E70/sprockets%2F2595d8c8d1d5f4deb096247fb3bfc7ab +256 -0
  101. data/test/dummy/tmp/cache/assets/DE1/9D0/sprockets%2F8befd77af580ee16ec42ec95b1766ff3 +1545 -0
  102. data/test/dummy/tmp/cache/assets/E00/D80/sprockets%2F9debc27161f7bccf2d84a36b8c36c4bf +522 -0
  103. data/test/dummy/tmp/cache/assets/E00/E60/sprockets%2Fac159b94b0a6d621e4f6cde9b4de87bb +0 -0
  104. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  105. data/test/dummy/tmp/cache/assets/E1B/D00/sprockets%2F886dff4afe55f9d3f8abe434f2689add +72 -0
  106. data/test/dummy/tmp/cache/assets/E1B/F20/sprockets%2Fa4bbc04eb83ebf94fd8134c3abd220dd +494 -0
  107. data/test/dummy/tmp/cache/assets/E71/0C0/sprockets%2F5ffdc0daa0a1f9638c787897ceefcdee +1260 -0
  108. metadata +186 -10
  109. data/test/dummy/tmp/pids/server.pid +0 -1
@@ -1,9 +1,9 @@
1
- o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325458171.124773: @value{ I" length:EFirI" digest;
2
- F"%d6e5a4588ea1e5479d5338672e96be7bI" source;
3
- FI"r// This file was autogenerated by /Volumes/Development/dev-web/yellow-brick-road/vendor/closure-library/closure/bin/build/depswriter.py.
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325549267.512146: @value{ I" length:EFi�I" digest;
2
+ F"%ad6870b3e4927bb1917c19d3873262faI" source;
3
+ FI"�// This file was autogenerated by /Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-b30bab11ab83/vendor/closure-library/closure/bin/build/depswriter.py.
4
4
  // Please do not edit.
5
5
  goog.addDependency('../../soyutils_usegoog.js', ['soy', 'soy.StringBuilder', 'soy.esc', 'soydata', 'soydata.SanitizedHtml', 'soydata.SanitizedHtmlAttribute', 'soydata.SanitizedJsStrChars', 'soydata.SanitizedUri'], ['goog.asserts', 'goog.dom.DomHelper', 'goog.format', 'goog.i18n.BidiFormatter', 'goog.i18n.bidi', 'goog.soy', 'goog.string', 'goog.string.StringBuffer']);
6
6
  goog.addDependency('../../start.js', ['myproject.start'], ['goog.dom', 'myproject.templates']);
7
7
  ;
8
8
  FI"
9
- F"%ef0ff6ad8f880745b8fd592bcfe2eb14
9
+ F"%1dfbbf3a4af5ea3eb1861df6f66674b7
@@ -0,0 +1,115 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325538162.379482: @value{ I" length:EFi�I" digest;
2
+ F"%9c6d1a6f816598cba384e9b4b4405319I" source;
3
+ FI"�// Copyright 2011 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 methods to render soy template.
19
+ */
20
+
21
+
22
+ goog.provide('goog.soy');
23
+
24
+ goog.require('goog.dom');
25
+ goog.require('goog.dom.NodeType');
26
+ goog.require('goog.dom.TagName');
27
+
28
+
29
+
30
+ /**
31
+ * Renders a Soy template and then set the output string as
32
+ * the innerHTML of an element. It is recommended to use this helper function
33
+ * instead of directly setting innerHTML in your hand-written code, so that it
34
+ * will be easier to audit the code for cross-site scripting vulnerabilities.
35
+ *
36
+ * @param {Element} element The element whose content we are rendering into.
37
+ * @param {Function} template The Soy template defining the element's content.
38
+ * @param {Object=} opt_templateData The data for the template.
39
+ * @param {Object=} opt_injectedData The injected data for the template.
40
+ */
41
+ goog.soy.renderElement = function(element, template, opt_templateData,
42
+ opt_injectedData) {
43
+ element.innerHTML = template(
44
+ opt_templateData || goog.soy.defaultTemplateData_, undefined,
45
+ opt_injectedData);
46
+ };
47
+
48
+
49
+ /**
50
+ * Renders a Soy template into a single node or a document
51
+ * fragment. If the rendered HTML string represents a single node, then that
52
+ * node is returned (note that this is *not* a fragment, despite them name of
53
+ * the method). Otherwise a document fragment is returned containing the
54
+ * rendered nodes.
55
+ *
56
+ * @param {Function} template The Soy template defining the element's content.
57
+ * @param {Object=} opt_templateData The data for the template.
58
+ * @param {Object=} opt_injectedData The injected data for the template.
59
+ * @param {goog.dom.DomHelper=} opt_domHelper The DOM helper used to
60
+ * create DOM nodes; defaults to {@code goog.dom.getDomHelper}.
61
+ * @return {!Node} The resulting node or document fragment.
62
+ */
63
+ goog.soy.renderAsFragment = function(template, opt_templateData,
64
+ opt_injectedData, opt_domHelper) {
65
+ var dom = opt_domHelper || goog.dom.getDomHelper();
66
+ return dom.htmlToDocumentFragment(
67
+ template(opt_templateData || goog.soy.defaultTemplateData_,
68
+ undefined, opt_injectedData));
69
+ };
70
+
71
+
72
+ /**
73
+ * Renders a Soy template into a single node. If the rendered
74
+ * HTML string represents a single node, then that node is returned. Otherwise,
75
+ * a DIV element is returned containing the rendered nodes.
76
+ *
77
+ * @param {Function} template The Soy template defining the element's content.
78
+ * @param {Object=} opt_templateData The data for the template.
79
+ * @param {Object=} opt_injectedData The injected data for the template.
80
+ * @param {goog.dom.DomHelper=} opt_domHelper The DOM helper used to
81
+ * create DOM nodes; defaults to {@code goog.dom.getDomHelper}.
82
+ * @return {!Element} Rendered template contents, wrapped in a parent DIV
83
+ * element if necessary.
84
+ */
85
+ goog.soy.renderAsElement = function(template, opt_templateData,
86
+ opt_injectedData, opt_domHelper) {
87
+ var dom = opt_domHelper || goog.dom.getDomHelper();
88
+ var wrapper = dom.createElement(goog.dom.TagName.DIV);
89
+ wrapper.innerHTML = template(
90
+ opt_templateData || goog.soy.defaultTemplateData_,
91
+ undefined, opt_injectedData);
92
+
93
+ // If the template renders as a single element, return it.
94
+ if (wrapper.childNodes.length == 1) {
95
+ var firstChild = wrapper.firstChild;
96
+ if (firstChild.nodeType == goog.dom.NodeType.ELEMENT) {
97
+ return /** @type {!Element} */ (firstChild);
98
+ }
99
+ }
100
+
101
+ // Otherwise, return the wrapper DIV.
102
+ return wrapper;
103
+ };
104
+
105
+
106
+ /**
107
+ * Immutable object that is passed into templates that are rendered
108
+ * without any data.
109
+ * @type {Object}
110
+ * @private
111
+ */
112
+ goog.soy.defaultTemplateData_ = {};
113
+ ;
114
+ FI"
115
+ F"%fc117d7c10789946b453fcb0e7eab240
@@ -0,0 +1,511 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325549268.1654432: @value{I"
2
+ class:EFI"BundledAsset;
3
+ FI"id;
4
+ F"%b319458ffe747a792465127563da4a4cI"logical_path;
5
+ FI"'closure/goog/i18n/bidiformatter.js;
6
+ TI"
7
+ F"�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-b30bab11ab83/vendor/closure-library/closure/goog/i18n/bidiformatter.jsI"content_type;
8
+ FI"application/javascript;
9
+ FI"
10
+ mtime;
11
+ FI"2012-01-03T00:06:51+00:00;
12
+ FI" body;
13
+ FI"�L// Copyright 2009 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 Utility for formatting text for display in a potentially
29
+ * opposite-directionality context without garbling.
30
+ * Mostly a port of http://go/formatter.cc.
31
+ */
32
+
33
+
34
+
35
+ goog.provide('goog.i18n.BidiFormatter');
36
+
37
+ goog.require('goog.i18n.bidi');
38
+ goog.require('goog.string');
39
+
40
+
41
+
42
+ /**
43
+ * Utility class for formatting text for display in a potentially
44
+ * opposite-directionality context without garbling. Provides the following
45
+ * functionality:
46
+ *
47
+ * 1. BiDi Wrapping
48
+ * When text in one language is mixed into a document in another, opposite-
49
+ * directionality language, e.g. when an English business name is embedded in a
50
+ * Hebrew web page, both the inserted string and the text following it may be
51
+ * displayed incorrectly unless the inserted string is explicitly separated
52
+ * from the surrounding text in a "wrapper" that declares its directionality at
53
+ * the start and then resets it back at the end. This wrapping can be done in
54
+ * HTML mark-up (e.g. a 'span dir=rtl' tag) or - only in contexts where mark-up
55
+ * can not be used - in Unicode BiDi formatting codes (LRE|RLE and PDF).
56
+ * Providing such wrapping services is the basic purpose of the BiDi formatter.
57
+ *
58
+ * 2. Directionality estimation
59
+ * How does one know whether a string about to be inserted into surrounding
60
+ * text has the same directionality? Well, in many cases, one knows that this
61
+ * must be the case when writing the code doing the insertion, e.g. when a
62
+ * localized message is inserted into a localized page. In such cases there is
63
+ * no need to involve the BiDi formatter at all. In the remaining cases, e.g.
64
+ * when the string is user-entered or comes from a database, the language of
65
+ * the string (and thus its directionality) is not known a priori, and must be
66
+ * estimated at run-time. The BiDi formatter does this automatically.
67
+ *
68
+ * 3. Escaping
69
+ * When wrapping plain text - i.e. text that is not already HTML or HTML-
70
+ * escaped - in HTML mark-up, the text must first be HTML-escaped to prevent XSS
71
+ * attacks and other nasty business. This of course is always true, but the
72
+ * escaping can not be done after the string has already been wrapped in
73
+ * mark-up, so the BiDi formatter also serves as a last chance and includes
74
+ * escaping services.
75
+ *
76
+ * Thus, in a single call, the formatter will escape the input string as
77
+ * specified, determine its directionality, and wrap it as necessary. It is
78
+ * then up to the caller to insert the return value in the output.
79
+ *
80
+ * See http://wiki/Main/TemplatesAndBiDi for more information.
81
+ *
82
+ * @param {goog.i18n.bidi.Dir|number|boolean} contextDir The context
83
+ * directionality. May be supplied either as a goog.i18n.bidi.Dir constant,
84
+ * as a number (positive = LRT, negative = RTL, 0 = unknown) or as a boolean
85
+ * (true = RTL, false = LTR).
86
+ * @param {boolean=} opt_alwaysSpan Whether {@link #spanWrap} should always
87
+ * use a 'span' tag, even when the input directionality is neutral or
88
+ * matches the context, so that the DOM structure of the output does not
89
+ * depend on the combination of directionalities. Default: false.
90
+ * @constructor
91
+ */
92
+ goog.i18n.BidiFormatter = function(contextDir, opt_alwaysSpan) {
93
+ /**
94
+ * The overall directionality of the context in which the formatter is being
95
+ * used.
96
+ * @type {goog.i18n.bidi.Dir}
97
+ * @private
98
+ */
99
+ this.contextDir_ = goog.i18n.bidi.toDir(contextDir);
100
+
101
+ /**
102
+ * Whether {@link #spanWrap} and similar methods should always use the same
103
+ * span structure, regardless of the combination of directionalities, for a
104
+ * stable DOM structure.
105
+ * @type {boolean}
106
+ * @private
107
+ */
108
+ this.alwaysSpan_ = !!opt_alwaysSpan;
109
+ };
110
+
111
+
112
+ /**
113
+ * @return {goog.i18n.bidi.Dir} The context directionality.
114
+ */
115
+ goog.i18n.BidiFormatter.prototype.getContextDir = function() {
116
+ return this.contextDir_;
117
+ };
118
+
119
+
120
+ /**
121
+ * @return {boolean} Whether alwaysSpan is set.
122
+ */
123
+ goog.i18n.BidiFormatter.prototype.getAlwaysSpan = function() {
124
+ return this.alwaysSpan_;
125
+ };
126
+
127
+
128
+ /**
129
+ * @param {goog.i18n.bidi.Dir|number|boolean} contextDir The context
130
+ * directionality. May be supplied either as a goog.i18n.bidi.Dir constant,
131
+ * as a number (positive = LRT, negative = RTL, 0 = unknown) or as a boolean
132
+ * (true = RTL, false = LTR).
133
+ */
134
+ goog.i18n.BidiFormatter.prototype.setContextDir = function(contextDir) {
135
+ this.contextDir_ = goog.i18n.bidi.toDir(contextDir);
136
+ };
137
+
138
+
139
+ /**
140
+ * @param {boolean} alwaysSpan Whether {@link #spanWrap} should always use a
141
+ * 'span' tag, even when the input directionality is neutral or matches the
142
+ * context, so that the DOM structure of the output does not depend on the
143
+ * combination of directionalities.
144
+ */
145
+ goog.i18n.BidiFormatter.prototype.setAlwaysSpan = function(alwaysSpan) {
146
+ this.alwaysSpan_ = alwaysSpan;
147
+ };
148
+
149
+
150
+ /**
151
+ * Returns the directionality of input argument {@code str}.
152
+ * Identical to {@link goog.i18n.bidi.estimateDirection}.
153
+ *
154
+ * @param {string} str The input text.
155
+ * @param {boolean=} opt_isHtml Whether {@code str} is HTML / HTML-escaped.
156
+ * Default: false.
157
+ * @return {goog.i18n.bidi.Dir} Estimated overall directionality of {@code str}.
158
+ */
159
+ goog.i18n.BidiFormatter.prototype.estimateDirection =
160
+ goog.i18n.bidi.estimateDirection;
161
+
162
+
163
+ /**
164
+ * Returns true if two given directionalities are opposite.
165
+ * Note: the implementation is based on the numeric values of the Dir enum.
166
+ *
167
+ * @param {goog.i18n.bidi.Dir} dir1 1st directionality.
168
+ * @param {goog.i18n.bidi.Dir} dir2 2nd directionality.
169
+ * @return {boolean} Whether the directionalities are opposite.
170
+ * @private
171
+ */
172
+ goog.i18n.BidiFormatter.prototype.areDirectionalitiesOpposite_ = function(dir1,
173
+ dir2) {
174
+ return dir1 * dir2 < 0;
175
+ };
176
+
177
+
178
+ /**
179
+ * Returns a unicode BiDi mark matching the context directionality (LRM or
180
+ * RLM) if {@code opt_dirReset}, and if either the directionality or the exit
181
+ * directionality of {@code str} is opposite to the context directionality.
182
+ * Otherwise returns the empty string.
183
+ *
184
+ * @param {string} str The input text.
185
+ * @param {goog.i18n.bidi.Dir} dir {@code str}'s overall directionality.
186
+ * @param {boolean=} opt_isHtml Whether {@code str} is HTML / HTML-escaped.
187
+ * Default: false.
188
+ * @param {boolean=} opt_dirReset Whether to perform the reset. Default: false.
189
+ * @return {string} A unicode BiDi mark or the empty string.
190
+ * @private
191
+ */
192
+ goog.i18n.BidiFormatter.prototype.dirResetIfNeeded_ = function(str, dir,
193
+ opt_isHtml, opt_dirReset) {
194
+ // endsWithRtl and endsWithLtr are called only if needed (short-circuit).
195
+ if (opt_dirReset &&
196
+ (this.areDirectionalitiesOpposite_(dir, this.contextDir_) ||
197
+ (this.contextDir_ == goog.i18n.bidi.Dir.LTR &&
198
+ goog.i18n.bidi.endsWithRtl(str, opt_isHtml)) ||
199
+ (this.contextDir_ == goog.i18n.bidi.Dir.RTL &&
200
+ goog.i18n.bidi.endsWithLtr(str, opt_isHtml)))) {
201
+ return this.contextDir_ == goog.i18n.bidi.Dir.LTR ?
202
+ goog.i18n.bidi.Format.LRM : goog.i18n.bidi.Format.RLM;
203
+ } else {
204
+ return '';
205
+ }
206
+ };
207
+
208
+
209
+ /**
210
+ * Returns "rtl" if {@code str}'s estimated directionality is RTL, and "ltr" if
211
+ * it is LTR. In case it's UNKNOWN, returns "rtl" if the context directionality
212
+ * is RTL, and "ltr" otherwise.
213
+ * Needed for GXP, which can't handle dirAttr.
214
+ * Example use case:
215
+ * <td expr:dir='bidiFormatter.dirAttrValue(foo)'><gxp:eval expr='foo'></td>
216
+ *
217
+ * @param {string} str Text whose directionality is to be estimated.
218
+ * @param {boolean=} opt_isHtml Whether {@code str} is HTML / HTML-escaped.
219
+ * Default: false.
220
+ * @return {string} "rtl" or "ltr", according to the logic described above.
221
+ */
222
+ goog.i18n.BidiFormatter.prototype.dirAttrValue = function(str, opt_isHtml) {
223
+ return this.knownDirAttrValue(this.estimateDirection(str, opt_isHtml));
224
+ };
225
+
226
+
227
+ /**
228
+ * Returns "rtl" if the given directionality is RTL, and "ltr" if it is LTR. In
229
+ * case it's UNKNOWN, returns "rtl" if the context directionality is RTL, and
230
+ * "ltr" otherwise.
231
+ *
232
+ * @param {goog.i18n.bidi.Dir} dir A directionality.
233
+ * @return {string} "rtl" or "ltr", according to the logic described above.
234
+ */
235
+ goog.i18n.BidiFormatter.prototype.knownDirAttrValue = function(dir) {
236
+ if (dir == goog.i18n.bidi.Dir.UNKNOWN) {
237
+ dir = this.contextDir_;
238
+ }
239
+
240
+ return dir == goog.i18n.bidi.Dir.RTL ? 'rtl' : 'ltr';
241
+ };
242
+
243
+
244
+ /**
245
+ * Returns "dir=ltr" or "dir=rtl", depending on {@code str}'s estimated
246
+ * directionality, if it is not the same as the context directionality.
247
+ * Otherwise, returns the empty string.
248
+ *
249
+ * @param {string} str Text whose directionality is to be estimated.
250
+ * @param {boolean=} opt_isHtml Whether {@code str} is HTML / HTML-escaped.
251
+ * Default: false.
252
+ * @return {string} "dir=rtl" for RTL text in non-RTL context; "dir=ltr" for LTR
253
+ * text in non-LTR context; else, the empty string.
254
+ */
255
+ goog.i18n.BidiFormatter.prototype.dirAttr = function(str, opt_isHtml) {
256
+ return this.knownDirAttr(this.estimateDirection(str, opt_isHtml));
257
+ };
258
+
259
+
260
+ /**
261
+ * Returns "dir=ltr" or "dir=rtl", depending on the given directionality, if it
262
+ * is not the same as the context directionality. Otherwise, returns the empty
263
+ * string.
264
+ *
265
+ * @param {goog.i18n.bidi.Dir} dir A directionality.
266
+ * @return {string} "dir=rtl" for RTL text in non-RTL context; "dir=ltr" for LTR
267
+ * text in non-LTR context; else, the empty string.
268
+ */
269
+ goog.i18n.BidiFormatter.prototype.knownDirAttr = function(dir) {
270
+ if (dir != this.contextDir_) {
271
+ return dir == goog.i18n.bidi.Dir.RTL ? 'dir=rtl' :
272
+ dir == goog.i18n.bidi.Dir.LTR ? 'dir=ltr' : '';
273
+ }
274
+ return '';
275
+ };
276
+
277
+
278
+ /**
279
+ * Formats a string of unknown directionality for use in HTML output of the
280
+ * context directionality, so an opposite-directionality string is neither
281
+ * garbled nor garbles what follows it.
282
+ * The algorithm: estimates the directionality of input argument {@code str}. In
283
+ * case its directionality doesn't match the context directionality, wraps it
284
+ * with a 'span' tag and adds a "dir" attribute (either 'dir=rtl' or 'dir=ltr').
285
+ * If setAlwaysSpan(true) was used, the input is always wrapped with 'span',
286
+ * skipping just the dir attribute when it's not needed.
287
+ *
288
+ * If {@code opt_dirReset}, and if the overall directionality or the exit
289
+ * directionality of {@code str} are opposite to the context directionality, a
290
+ * trailing unicode BiDi mark matching the context directionality is appened
291
+ * (LRM or RLM).
292
+ *
293
+ * If !{@code opt_isHtml}, HTML-escapes {@code str} regardless of wrapping.
294
+ *
295
+ * @param {string} str The input text.
296
+ * @param {boolean=} opt_isHtml Whether {@code str} is HTML / HTML-escaped.
297
+ * Default: false.
298
+ * @param {boolean=} opt_dirReset Whether to append a trailing unicode bidi mark
299
+ * matching the context directionality, when needed, to prevent the possible
300
+ * garbling of whatever may follow {@code str}. Default: true.
301
+ * @return {string} Input text after applying the above processing.
302
+ */
303
+ goog.i18n.BidiFormatter.prototype.spanWrap = function(str, opt_isHtml,
304
+ opt_dirReset) {
305
+ var dir = this.estimateDirection(str, opt_isHtml);
306
+ return this.spanWrapWithKnownDir(dir, str, opt_isHtml, opt_dirReset);
307
+ };
308
+
309
+
310
+ /**
311
+ * Formats a string of given directionality for use in HTML output of the
312
+ * context directionality, so an opposite-directionality string is neither
313
+ * garbled nor garbles what follows it.
314
+ * The algorithm: If {@code dir} doesn't match the context directionality, wraps
315
+ * {@code str} with a 'span' tag and adds a "dir" attribute (either 'dir=rtl' or
316
+ * 'dir=ltr'). If setAlwaysSpan(true) was used, the input is always wrapped with
317
+ * 'span', skipping just the dir attribute when it's not needed.
318
+ *
319
+ * If {@code opt_dirReset}, and if {@code dir} or the exit directionality of
320
+ * {@code str} are opposite to the context directionality, a trailing unicode
321
+ * BiDi mark matching the context directionality is appened (LRM or RLM).
322
+ *
323
+ * If !{@code opt_isHtml}, HTML-escapes {@code str} regardless of wrapping.
324
+ *
325
+ * @param {goog.i18n.bidi.Dir} dir {@code str}'s overall directionality.
326
+ * @param {string} str The input text.
327
+ * @param {boolean=} opt_isHtml Whether {@code str} is HTML / HTML-escaped.
328
+ * Default: false.
329
+ * @param {boolean=} opt_dirReset Whether to append a trailing unicode bidi mark
330
+ * matching the context directionality, when needed, to prevent the possible
331
+ * garbling of whatever may follow {@code str}. Default: true.
332
+ * @return {string} Input text after applying the above processing.
333
+ */
334
+ goog.i18n.BidiFormatter.prototype.spanWrapWithKnownDir = function(dir, str,
335
+ opt_isHtml, opt_dirReset) {
336
+ opt_dirReset = opt_dirReset || (opt_dirReset == undefined);
337
+ // Whether to add the "dir" attribute.
338
+ var dirCondition = dir != goog.i18n.bidi.Dir.UNKNOWN && dir !=
339
+ this.contextDir_;
340
+ if (!opt_isHtml) {
341
+ str = goog.string.htmlEscape(str);
342
+ }
343
+
344
+ var result = [];
345
+ if (this.alwaysSpan_ || dirCondition) { // Wrap is needed
346
+ result.push('<span');
347
+ if (dirCondition) {
348
+ result.push(dir == goog.i18n.bidi.Dir.RTL ? ' dir=rtl' : ' dir=ltr');
349
+ }
350
+ result.push('>' + str + '</span>');
351
+ } else {
352
+ result.push(str);
353
+ }
354
+
355
+ result.push(this.dirResetIfNeeded_(str, dir, true, opt_dirReset));
356
+ return result.join('');
357
+ };
358
+
359
+
360
+ /**
361
+ * Formats a string of unknown directionality for use in plain-text output of
362
+ * the context directionality, so an opposite-directionality string is neither
363
+ * garbled nor garbles what follows it.
364
+ * As opposed to {@link #spanWrap}, this makes use of unicode BiDi formatting
365
+ * characters. In HTML, its *only* valid use is inside of elements that do not
366
+ * allow mark-up, e.g. an 'option' tag.
367
+ * The algorithm: estimates the directionality of input argument {@code str}.
368
+ * In case it doesn't match the context directionality, wraps it with Unicode
369
+ * BiDi formatting characters: RLE{@code str}PDF for RTL text, and
370
+ * LRE{@code str}PDF for LTR text.
371
+ *
372
+ * If {@code opt_dirReset}, and if the overall directionality or the exit
373
+ * directionality of {@code str} are opposite to the context directionality, a
374
+ * trailing unicode BiDi mark matching the context directionality is appended
375
+ * (LRM or RLM).
376
+ *
377
+ * Does *not* do HTML-escaping regardless of the value of {@code opt_isHtml}.
378
+ * The return value can be HTML-escaped as necessary.
379
+ *
380
+ * @param {string} str The input text.
381
+ * @param {boolean=} opt_isHtml Whether {@code str} is HTML / HTML-escaped.
382
+ * Default: false.
383
+ * @param {boolean=} opt_dirReset Whether to append a trailing unicode bidi mark
384
+ * matching the context directionality, when needed, to prevent the possible
385
+ * garbling of whatever may follow {@code str}. Default: true.
386
+ * @return {string} Input text after applying the above processing.
387
+ */
388
+ goog.i18n.BidiFormatter.prototype.unicodeWrap = function(str, opt_isHtml,
389
+ opt_dirReset) {
390
+ var dir = this.estimateDirection(str, opt_isHtml);
391
+ return this.unicodeWrapWithKnownDir(dir, str, opt_isHtml, opt_dirReset);
392
+ };
393
+
394
+
395
+ /**
396
+ * Formats a string of given directionality for use in plain-text output of the
397
+ * context directionality, so an opposite-directionality string is neither
398
+ * garbled nor garbles what follows it.
399
+ * As opposed to {@link #spanWrapWithKnownDir}, makes use of unicode BiDi
400
+ * formatting characters. In HTML, its *only* valid use is inside of elements
401
+ * that do not allow mark-up, e.g. an 'option' tag.
402
+ * The algorithm: If {@code dir} doesn't match the context directionality, wraps
403
+ * {@code str} with Unicode BiDi formatting characters: RLE{@code str}PDF for
404
+ * RTL text, and LRE{@code str}PDF for LTR text.
405
+ *
406
+ * If {@code opt_dirReset}, and if the overall directionality or the exit
407
+ * directionality of {@code str} are opposite to the context directionality, a
408
+ * trailing unicode BiDi mark matching the context directionality is appended
409
+ * (LRM or RLM).
410
+ *
411
+ * Does *not* do HTML-escaping regardless of the value of {@code opt_isHtml}.
412
+ * The return value can be HTML-escaped as necessary.
413
+ *
414
+ * @param {goog.i18n.bidi.Dir} dir {@code str}'s overall directionality.
415
+ * @param {string} str The input text.
416
+ * @param {boolean=} opt_isHtml Whether {@code str} is HTML / HTML-escaped.
417
+ * Default: false.
418
+ * @param {boolean=} opt_dirReset Whether to append a trailing unicode bidi mark
419
+ * matching the context directionality, when needed, to prevent the possible
420
+ * garbling of whatever may follow {@code str}. Default: true.
421
+ * @return {string} Input text after applying the above processing.
422
+ */
423
+ goog.i18n.BidiFormatter.prototype.unicodeWrapWithKnownDir = function(dir, str,
424
+ opt_isHtml, opt_dirReset) {
425
+ opt_dirReset = opt_dirReset || (opt_dirReset == undefined);
426
+ var result = [];
427
+ if (dir != goog.i18n.bidi.Dir.UNKNOWN && dir != this.contextDir_) {
428
+ result.push(dir == goog.i18n.bidi.Dir.RTL ? goog.i18n.bidi.Format.RLE :
429
+ goog.i18n.bidi.Format.LRE);
430
+ result.push(str);
431
+ result.push(goog.i18n.bidi.Format.PDF);
432
+ } else {
433
+ result.push(str);
434
+ }
435
+
436
+ result.push(this.dirResetIfNeeded_(str, dir, opt_isHtml, opt_dirReset));
437
+ return result.join('');
438
+ };
439
+
440
+
441
+ /**
442
+ * Returns a Unicode BiDi mark matching the context directionality (LRM or RLM)
443
+ * if the directionality or the exit directionality of {@code str} are opposite
444
+ * to the context directionality. Otherwise returns the empty string.
445
+ *
446
+ * @param {string} str The input text.
447
+ * @param {boolean=} opt_isHtml Whether {@code str} is HTML / HTML-escaped.
448
+ * Default: false.
449
+ * @return {string} A Unicode bidi mark matching the global directionality or
450
+ * the empty string.
451
+ */
452
+ goog.i18n.BidiFormatter.prototype.markAfter = function(str, opt_isHtml) {
453
+ return this.dirResetIfNeeded_(str,
454
+ this.estimateDirection(str, opt_isHtml), opt_isHtml, true);
455
+ };
456
+
457
+
458
+ /**
459
+ * Returns the Unicode BiDi mark matching the context directionality (LRM for
460
+ * LTR context directionality, RLM for RTL context directionality), or the
461
+ * empty string for neutral / unknown context directionality.
462
+ *
463
+ * @return {string} LRM for LTR context directionality and RLM for RTL context
464
+ * directionality.
465
+ */
466
+ goog.i18n.BidiFormatter.prototype.mark = function() {
467
+ switch (this.contextDir_) {
468
+ case (goog.i18n.bidi.Dir.LTR):
469
+ return goog.i18n.bidi.Format.LRM;
470
+ case (goog.i18n.bidi.Dir.RTL):
471
+ return goog.i18n.bidi.Format.RLM;
472
+ default:
473
+ return '';
474
+ }
475
+ };
476
+
477
+
478
+ /**
479
+ * Returns 'right' for RTL context directionality. Otherwise (LTR or neutral /
480
+ * unknown context directionality) returns 'left'.
481
+ *
482
+ * @return {string} 'right' for RTL context directionality and 'left' for other
483
+ * context directionality.
484
+ */
485
+ goog.i18n.BidiFormatter.prototype.startEdge = function() {
486
+ return this.contextDir_ == goog.i18n.bidi.Dir.RTL ?
487
+ goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT;
488
+ };
489
+
490
+
491
+ /**
492
+ * Returns 'left' for RTL context directionality. Otherwise (LTR or neutral /
493
+ * unknown context directionality) returns 'right'.
494
+ *
495
+ * @return {string} 'left' for RTL context directionality and 'right' for other
496
+ * context directionality.
497
+ */
498
+ goog.i18n.BidiFormatter.prototype.endEdge = function() {
499
+ return this.contextDir_ == goog.i18n.bidi.Dir.RTL ?
500
+ goog.i18n.bidi.LEFT : goog.i18n.bidi.RIGHT;
501
+ };
502
+ ;
503
+ FI"asset_paths;
504
+ F["�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-b30bab11ab83/vendor/closure-library/closure/goog/i18n/bidiformatter.jsI"dependency_paths;
505
+ F[{I" path;
506
+ F"�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-b30bab11ab83/vendor/closure-library/closure/goog/i18n/bidiformatter.jsI"
507
+ mtime;
508
+ FIu: Time
509
+ T: offsetiI"hexdigest;
510
+ F"%0b9779d9cba2108c276d1dfb3ae6ab7fI"
511
+ F"%46dde6621c301f4928e3b34efee9e3b5