bootstrapped-rails 1.1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (289) hide show
  1. data/.DS_Store +0 -0
  2. data/.gitignore +4 -0
  3. data/Gemfile +4 -0
  4. data/Rakefile +1 -0
  5. data/bootstrapped-rails.gemspec +24 -0
  6. data/lib/.DS_Store +0 -0
  7. data/lib/bootstrapped-rails.rb +11 -0
  8. data/lib/bootstrapped-rails/.DS_Store +0 -0
  9. data/lib/bootstrapped-rails/engine.rb +6 -0
  10. data/lib/bootstrapped-rails/ie_hex_str.rb +16 -0
  11. data/lib/bootstrapped-rails/railtie.rb +6 -0
  12. data/lib/bootstrapped-rails/version.rb +5 -0
  13. data/vendor/.DS_Store +0 -0
  14. data/vendor/images/.DS_Store +0 -0
  15. data/vendor/images/glyphicons-halflings-white.png +0 -0
  16. data/vendor/images/glyphicons-halflings.png +0 -0
  17. data/vendor/javascripts/.DS_Store +0 -0
  18. data/vendor/javascripts/bootstrapped.js +1 -0
  19. data/vendor/javascripts/bootstrapped/.DS_Store +0 -0
  20. data/vendor/javascripts/bootstrapped/bootstrap-alert.js +91 -0
  21. data/vendor/javascripts/bootstrapped/bootstrap-button.js +98 -0
  22. data/vendor/javascripts/bootstrapped/bootstrap-carousel.js +154 -0
  23. data/vendor/javascripts/bootstrapped/bootstrap-collapse.js +136 -0
  24. data/vendor/javascripts/bootstrapped/bootstrap-dropdown.js +92 -0
  25. data/vendor/javascripts/bootstrapped/bootstrap-modal.js +209 -0
  26. data/vendor/javascripts/bootstrapped/bootstrap-popover.js +95 -0
  27. data/vendor/javascripts/bootstrapped/bootstrap-scrollspy.js +125 -0
  28. data/vendor/javascripts/bootstrapped/bootstrap-tab.js +130 -0
  29. data/vendor/javascripts/bootstrapped/bootstrap-tooltip.js +270 -0
  30. data/vendor/javascripts/bootstrapped/bootstrap-transition.js +51 -0
  31. data/vendor/javascripts/bootstrapped/bootstrap-typeahead.js +271 -0
  32. data/vendor/stylesheets/.DS_Store +0 -0
  33. data/vendor/stylesheets/bootstrapped-rails.css +3 -0
  34. data/vendor/stylesheets/bootstrapped/.DS_Store +0 -0
  35. data/vendor/stylesheets/bootstrapped/accordion.scss +28 -0
  36. data/vendor/stylesheets/bootstrapped/alerts.scss +70 -0
  37. data/vendor/stylesheets/bootstrapped/bootstrap.scss +62 -0
  38. data/vendor/stylesheets/bootstrapped/breadcrumbs.scss +22 -0
  39. data/vendor/stylesheets/bootstrapped/button-groups.scss +147 -0
  40. data/vendor/stylesheets/bootstrapped/buttons.scss +183 -0
  41. data/vendor/stylesheets/bootstrapped/carousel.scss +121 -0
  42. data/vendor/stylesheets/bootstrapped/close.scss +18 -0
  43. data/vendor/stylesheets/bootstrapped/code.scss +44 -0
  44. data/vendor/stylesheets/bootstrapped/component-animations.scss +18 -0
  45. data/vendor/stylesheets/bootstrapped/dropdowns.scss +131 -0
  46. data/vendor/stylesheets/bootstrapped/forms.scss +516 -0
  47. data/vendor/stylesheets/bootstrapped/grid.scss +8 -0
  48. data/vendor/stylesheets/bootstrapped/hero-unit.scss +20 -0
  49. data/vendor/stylesheets/bootstrapped/labels.scss +16 -0
  50. data/vendor/stylesheets/bootstrapped/layouts.scss +17 -0
  51. data/vendor/stylesheets/bootstrapped/mixins.scss +511 -0
  52. data/vendor/stylesheets/bootstrapped/modals.scss +72 -0
  53. data/vendor/stylesheets/bootstrapped/navbar.scss +292 -0
  54. data/vendor/stylesheets/bootstrapped/navs.scss +344 -0
  55. data/vendor/stylesheets/bootstrapped/pager.scss +30 -0
  56. data/vendor/stylesheets/bootstrapped/pagination.scss +55 -0
  57. data/vendor/stylesheets/bootstrapped/popovers.scss +49 -0
  58. data/vendor/stylesheets/bootstrapped/progress-bars.scss +95 -0
  59. data/vendor/stylesheets/bootstrapped/reset.scss +126 -0
  60. data/vendor/stylesheets/bootstrapped/responsive.scss +323 -0
  61. data/vendor/stylesheets/bootstrapped/scaffolding.scss +29 -0
  62. data/vendor/stylesheets/bootstrapped/sprites.scss +158 -0
  63. data/vendor/stylesheets/bootstrapped/tables.scss +130 -0
  64. data/vendor/stylesheets/bootstrapped/thumbnails.scss +35 -0
  65. data/vendor/stylesheets/bootstrapped/tooltip.scss +35 -0
  66. data/vendor/stylesheets/bootstrapped/type.scss +217 -0
  67. data/vendor/stylesheets/bootstrapped/utilities.scss +23 -0
  68. data/vendor/stylesheets/bootstrapped/variables.scss +99 -0
  69. data/vendor/stylesheets/bootstrapped/wells.scss +17 -0
  70. data/vendor/twitter/.gitignore +33 -0
  71. data/vendor/twitter/LICENSE +13 -0
  72. data/vendor/twitter/Makefile +59 -0
  73. data/vendor/twitter/README.md +94 -0
  74. data/vendor/twitter/docs/assets/bootstrap.zip +0 -0
  75. data/vendor/twitter/docs/assets/css/bootstrap-responsive.css +567 -0
  76. data/vendor/twitter/docs/assets/css/bootstrap.css +3365 -0
  77. data/vendor/twitter/docs/assets/css/docs.css +790 -0
  78. data/vendor/twitter/docs/assets/ico/bootstrap-apple-114x114.png +0 -0
  79. data/vendor/twitter/docs/assets/ico/bootstrap-apple-57x57.png +0 -0
  80. data/vendor/twitter/docs/assets/ico/bootstrap-apple-72x72.png +0 -0
  81. data/vendor/twitter/docs/assets/ico/favicon.ico +0 -0
  82. data/vendor/twitter/docs/assets/img/bird.png +0 -0
  83. data/vendor/twitter/docs/assets/img/bootstrap-mdo-sfmoma-01.jpg +0 -0
  84. data/vendor/twitter/docs/assets/img/bootstrap-mdo-sfmoma-02.jpg +0 -0
  85. data/vendor/twitter/docs/assets/img/bootstrap-mdo-sfmoma-03.jpg +0 -0
  86. data/vendor/twitter/docs/assets/img/browsers.png +0 -0
  87. data/vendor/twitter/docs/assets/img/example-diagram-01.png +0 -0
  88. data/vendor/twitter/docs/assets/img/example-diagram-02.png +0 -0
  89. data/vendor/twitter/docs/assets/img/example-diagram-03.png +0 -0
  90. data/vendor/twitter/docs/assets/img/example-sites/bartop.png +0 -0
  91. data/vendor/twitter/docs/assets/img/example-sites/fleetio.png +0 -0
  92. data/vendor/twitter/docs/assets/img/example-sites/jshint.png +0 -0
  93. data/vendor/twitter/docs/assets/img/example-sites/kippt.png +0 -0
  94. data/vendor/twitter/docs/assets/img/example-sites/railwayjs.png +0 -0
  95. data/vendor/twitter/docs/assets/img/example-sites/totalwireframe.png +0 -0
  96. data/vendor/twitter/docs/assets/img/examples/bootstrap-example-fluid.jpg +0 -0
  97. data/vendor/twitter/docs/assets/img/examples/bootstrap-example-hero.jpg +0 -0
  98. data/vendor/twitter/docs/assets/img/examples/bootstrap-example-starter.jpg +0 -0
  99. data/vendor/twitter/docs/assets/img/github-16px.png +0 -0
  100. data/vendor/twitter/docs/assets/img/glyphicons-halflings-white.png +0 -0
  101. data/vendor/twitter/docs/assets/img/glyphicons-halflings.png +0 -0
  102. data/vendor/twitter/docs/assets/img/glyphicons/glyphicons_009_magic.png +0 -0
  103. data/vendor/twitter/docs/assets/img/glyphicons/glyphicons_042_group.png +0 -0
  104. data/vendor/twitter/docs/assets/img/glyphicons/glyphicons_079_podium.png +0 -0
  105. data/vendor/twitter/docs/assets/img/glyphicons/glyphicons_082_roundabout.png +0 -0
  106. data/vendor/twitter/docs/assets/img/glyphicons/glyphicons_155_show_thumbnails.png +0 -0
  107. data/vendor/twitter/docs/assets/img/glyphicons/glyphicons_163_iphone.png +0 -0
  108. data/vendor/twitter/docs/assets/img/glyphicons/glyphicons_214_resize_small.png +0 -0
  109. data/vendor/twitter/docs/assets/img/glyphicons/glyphicons_266_book_open.png +0 -0
  110. data/vendor/twitter/docs/assets/img/grid-18px-masked.png +0 -0
  111. data/vendor/twitter/docs/assets/img/icon-css3.png +0 -0
  112. data/vendor/twitter/docs/assets/img/icon-github.png +0 -0
  113. data/vendor/twitter/docs/assets/img/icon-html5.png +0 -0
  114. data/vendor/twitter/docs/assets/img/icon-twitter.png +0 -0
  115. data/vendor/twitter/docs/assets/img/less-logo-large.png +0 -0
  116. data/vendor/twitter/docs/assets/img/less-small.png +0 -0
  117. data/vendor/twitter/docs/assets/img/responsive-illustrations.png +0 -0
  118. data/vendor/twitter/docs/assets/js/README.md +106 -0
  119. data/vendor/twitter/docs/assets/js/application.js +180 -0
  120. data/vendor/twitter/docs/assets/js/bootstrap-alert.js +91 -0
  121. data/vendor/twitter/docs/assets/js/bootstrap-button.js +98 -0
  122. data/vendor/twitter/docs/assets/js/bootstrap-carousel.js +154 -0
  123. data/vendor/twitter/docs/assets/js/bootstrap-collapse.js +136 -0
  124. data/vendor/twitter/docs/assets/js/bootstrap-dropdown.js +92 -0
  125. data/vendor/twitter/docs/assets/js/bootstrap-modal.js +209 -0
  126. data/vendor/twitter/docs/assets/js/bootstrap-popover.js +95 -0
  127. data/vendor/twitter/docs/assets/js/bootstrap-scrollspy.js +125 -0
  128. data/vendor/twitter/docs/assets/js/bootstrap-tab.js +130 -0
  129. data/vendor/twitter/docs/assets/js/bootstrap-tooltip.js +270 -0
  130. data/vendor/twitter/docs/assets/js/bootstrap-transition.js +51 -0
  131. data/vendor/twitter/docs/assets/js/bootstrap-typeahead.js +271 -0
  132. data/vendor/twitter/docs/assets/js/google-code-prettify/prettify.css +30 -0
  133. data/vendor/twitter/docs/assets/js/google-code-prettify/prettify.js +28 -0
  134. data/vendor/twitter/docs/assets/js/jquery.js +9252 -0
  135. data/vendor/twitter/docs/base-css.html +1582 -0
  136. data/vendor/twitter/docs/build/index.js +33 -0
  137. data/vendor/twitter/docs/build/node_modules/.bin/hulk +93 -0
  138. data/vendor/twitter/docs/build/node_modules/hogan.js/.git_ignore +1 -0
  139. data/vendor/twitter/docs/build/node_modules/hogan.js/.gitmodules +3 -0
  140. data/vendor/twitter/docs/build/node_modules/hogan.js/LICENSE +177 -0
  141. data/vendor/twitter/docs/build/node_modules/hogan.js/Makefile +62 -0
  142. data/vendor/twitter/docs/build/node_modules/hogan.js/README.md +93 -0
  143. data/vendor/twitter/docs/build/node_modules/hogan.js/bin/hulk +93 -0
  144. data/vendor/twitter/docs/build/node_modules/hogan.js/lib/compiler.js +348 -0
  145. data/vendor/twitter/docs/build/node_modules/hogan.js/lib/hogan.js +20 -0
  146. data/vendor/twitter/docs/build/node_modules/hogan.js/lib/template.js +233 -0
  147. data/vendor/twitter/docs/build/node_modules/hogan.js/package.json +20 -0
  148. data/vendor/twitter/docs/build/node_modules/hogan.js/test/html/list.html +8 -0
  149. data/vendor/twitter/docs/build/node_modules/hogan.js/test/index.html +13 -0
  150. data/vendor/twitter/docs/build/node_modules/hogan.js/test/index.js +848 -0
  151. data/vendor/twitter/docs/build/node_modules/hogan.js/test/mustache.js +90 -0
  152. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec.js +77 -0
  153. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/Changes +31 -0
  154. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/README.md +65 -0
  155. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/Rakefile +27 -0
  156. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/TESTING.md +46 -0
  157. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/comments.json +1 -0
  158. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/comments.yml +103 -0
  159. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/delimiters.json +1 -0
  160. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/delimiters.yml +158 -0
  161. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/interpolation.json +1 -0
  162. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/interpolation.yml +230 -0
  163. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/inverted.json +1 -0
  164. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/inverted.yml +193 -0
  165. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/partials.json +1 -0
  166. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/partials.yml +109 -0
  167. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/sections.json +1 -0
  168. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/sections.yml +256 -0
  169. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/~lambdas.json +1 -0
  170. data/vendor/twitter/docs/build/node_modules/hogan.js/test/spec/specs/~lambdas.yml +149 -0
  171. data/vendor/twitter/docs/build/node_modules/hogan.js/test/templates/list.mustache +8 -0
  172. data/vendor/twitter/docs/build/node_modules/hogan.js/tools/release.js +74 -0
  173. data/vendor/twitter/docs/build/node_modules/hogan.js/tools/web_templates.js +32 -0
  174. data/vendor/twitter/docs/build/node_modules/hogan.js/web/1.0.0/hogan.js +500 -0
  175. data/vendor/twitter/docs/build/node_modules/hogan.js/web/1.0.0/hogan.min.js +14 -0
  176. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.js +500 -0
  177. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.min.js +14 -0
  178. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.js +545 -0
  179. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.min.js +5 -0
  180. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.amd.js +576 -0
  181. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.common.js +576 -0
  182. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.js +572 -0
  183. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.amd.js +5 -0
  184. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.common.js +5 -0
  185. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.js +5 -0
  186. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.mustache.js +5 -0
  187. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.mustache.js +619 -0
  188. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.js +233 -0
  189. data/vendor/twitter/docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.min.js +5 -0
  190. data/vendor/twitter/docs/build/node_modules/hogan.js/web/favicon.ico +0 -0
  191. data/vendor/twitter/docs/build/node_modules/hogan.js/web/images/logo.png +0 -0
  192. data/vendor/twitter/docs/build/node_modules/hogan.js/web/images/noise.png +0 -0
  193. data/vendor/twitter/docs/build/node_modules/hogan.js/web/images/small-hogan-icon.png +0 -0
  194. data/vendor/twitter/docs/build/node_modules/hogan.js/web/images/stripes.png +0 -0
  195. data/vendor/twitter/docs/build/node_modules/hogan.js/web/index.html.mustache +139 -0
  196. data/vendor/twitter/docs/build/node_modules/hogan.js/web/stylesheets/layout.css +206 -0
  197. data/vendor/twitter/docs/build/node_modules/hogan.js/web/stylesheets/skeleton.css +236 -0
  198. data/vendor/twitter/docs/build/node_modules/hogan.js/wrappers/amd.js.mustache +21 -0
  199. data/vendor/twitter/docs/build/node_modules/hogan.js/wrappers/common.js.mustache +21 -0
  200. data/vendor/twitter/docs/build/node_modules/hogan.js/wrappers/js.mustache +17 -0
  201. data/vendor/twitter/docs/build/node_modules/hogan.js/wrappers/mustache.js.mustache +64 -0
  202. data/vendor/twitter/docs/build/package.json +6 -0
  203. data/vendor/twitter/docs/components.html +1517 -0
  204. data/vendor/twitter/docs/download.html +362 -0
  205. data/vendor/twitter/docs/examples.html +145 -0
  206. data/vendor/twitter/docs/examples/fluid.html +150 -0
  207. data/vendor/twitter/docs/examples/hero.html +107 -0
  208. data/vendor/twitter/docs/examples/starter-template.html +77 -0
  209. data/vendor/twitter/docs/index.html +249 -0
  210. data/vendor/twitter/docs/javascript.html +1465 -0
  211. data/vendor/twitter/docs/less.html +795 -0
  212. data/vendor/twitter/docs/scaffolding.html +438 -0
  213. data/vendor/twitter/docs/templates/layout.mustache +132 -0
  214. data/vendor/twitter/docs/templates/pages/base-css.mustache +1468 -0
  215. data/vendor/twitter/docs/templates/pages/components.mustache +1403 -0
  216. data/vendor/twitter/docs/templates/pages/download.mustache +248 -0
  217. data/vendor/twitter/docs/templates/pages/examples.mustache +31 -0
  218. data/vendor/twitter/docs/templates/pages/index.mustache +136 -0
  219. data/vendor/twitter/docs/templates/pages/javascript.mustache +1352 -0
  220. data/vendor/twitter/docs/templates/pages/less.mustache +681 -0
  221. data/vendor/twitter/docs/templates/pages/scaffolding.mustache +324 -0
  222. data/vendor/twitter/docs/templates/pages/upgrading.mustache +183 -0
  223. data/vendor/twitter/docs/upgrading.html +297 -0
  224. data/vendor/twitter/img/glyphicons-halflings-white.png +0 -0
  225. data/vendor/twitter/img/glyphicons-halflings.png +0 -0
  226. data/vendor/twitter/js/README.md +106 -0
  227. data/vendor/twitter/js/bootstrap-alert.js +91 -0
  228. data/vendor/twitter/js/bootstrap-button.js +98 -0
  229. data/vendor/twitter/js/bootstrap-carousel.js +154 -0
  230. data/vendor/twitter/js/bootstrap-collapse.js +136 -0
  231. data/vendor/twitter/js/bootstrap-dropdown.js +92 -0
  232. data/vendor/twitter/js/bootstrap-modal.js +209 -0
  233. data/vendor/twitter/js/bootstrap-popover.js +95 -0
  234. data/vendor/twitter/js/bootstrap-scrollspy.js +125 -0
  235. data/vendor/twitter/js/bootstrap-tab.js +130 -0
  236. data/vendor/twitter/js/bootstrap-tooltip.js +270 -0
  237. data/vendor/twitter/js/bootstrap-transition.js +51 -0
  238. data/vendor/twitter/js/bootstrap-typeahead.js +271 -0
  239. data/vendor/twitter/js/tests/index.html +49 -0
  240. data/vendor/twitter/js/tests/unit/bootstrap-alert.js +41 -0
  241. data/vendor/twitter/js/tests/unit/bootstrap-button.js +54 -0
  242. data/vendor/twitter/js/tests/unit/bootstrap-collapse.js +25 -0
  243. data/vendor/twitter/js/tests/unit/bootstrap-dropdown.js +53 -0
  244. data/vendor/twitter/js/tests/unit/bootstrap-modal.js +85 -0
  245. data/vendor/twitter/js/tests/unit/bootstrap-popover.js +93 -0
  246. data/vendor/twitter/js/tests/unit/bootstrap-scrollspy.js +31 -0
  247. data/vendor/twitter/js/tests/unit/bootstrap-tab.js +45 -0
  248. data/vendor/twitter/js/tests/unit/bootstrap-tooltip.js +62 -0
  249. data/vendor/twitter/js/tests/unit/bootstrap-transition.js +13 -0
  250. data/vendor/twitter/js/tests/unit/bootstrap-typeahead.js +128 -0
  251. data/vendor/twitter/js/tests/vendor/jquery.js +9252 -0
  252. data/vendor/twitter/js/tests/vendor/qunit.css +232 -0
  253. data/vendor/twitter/js/tests/vendor/qunit.js +1510 -0
  254. data/vendor/twitter/scss/accordion.scss +28 -0
  255. data/vendor/twitter/scss/alerts.scss +70 -0
  256. data/vendor/twitter/scss/bootstrap.scss +62 -0
  257. data/vendor/twitter/scss/breadcrumbs.scss +22 -0
  258. data/vendor/twitter/scss/button-groups.scss +147 -0
  259. data/vendor/twitter/scss/buttons.scss +168 -0
  260. data/vendor/twitter/scss/carousel.scss +121 -0
  261. data/vendor/twitter/scss/close.scss +18 -0
  262. data/vendor/twitter/scss/code.scss +44 -0
  263. data/vendor/twitter/scss/component-animations.scss +18 -0
  264. data/vendor/twitter/scss/dropdowns.scss +131 -0
  265. data/vendor/twitter/scss/forms.scss +516 -0
  266. data/vendor/twitter/scss/grid.scss +8 -0
  267. data/vendor/twitter/scss/hero-unit.scss +20 -0
  268. data/vendor/twitter/scss/labels.scss +16 -0
  269. data/vendor/twitter/scss/layouts.scss +17 -0
  270. data/vendor/twitter/scss/mixins.scss +500 -0
  271. data/vendor/twitter/scss/modals.scss +72 -0
  272. data/vendor/twitter/scss/navbar.scss +292 -0
  273. data/vendor/twitter/scss/navs.scss +344 -0
  274. data/vendor/twitter/scss/pager.scss +30 -0
  275. data/vendor/twitter/scss/pagination.scss +55 -0
  276. data/vendor/twitter/scss/popovers.scss +49 -0
  277. data/vendor/twitter/scss/progress-bars.scss +95 -0
  278. data/vendor/twitter/scss/reset.scss +126 -0
  279. data/vendor/twitter/scss/responsive.scss +323 -0
  280. data/vendor/twitter/scss/scaffolding.scss +29 -0
  281. data/vendor/twitter/scss/sprites.scss +158 -0
  282. data/vendor/twitter/scss/tables.scss +130 -0
  283. data/vendor/twitter/scss/thumbnails.scss +35 -0
  284. data/vendor/twitter/scss/tooltip.scss +35 -0
  285. data/vendor/twitter/scss/type.scss +217 -0
  286. data/vendor/twitter/scss/utilities.scss +23 -0
  287. data/vendor/twitter/scss/variables.scss +99 -0
  288. data/vendor/twitter/scss/wells.scss +17 -0
  289. metadata +368 -0
@@ -0,0 +1,233 @@
1
+ /*
2
+ * Copyright 2011 Twitter, Inc.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ var Hogan = {};
17
+
18
+ (function (Hogan) {
19
+ Hogan.Template = function constructor(renderFunc, text, compiler) {
20
+ if (renderFunc) {
21
+ this.r = renderFunc;
22
+ }
23
+ this.c = compiler;
24
+ this.text = text || '';
25
+ }
26
+
27
+ Hogan.Template.prototype = {
28
+ // render: replaced by generated code.
29
+ r: function (context, partials, indent) { return ''; },
30
+
31
+ // variable escaping
32
+ v: hoganEscape,
33
+
34
+ render: function render(context, partials, indent) {
35
+ return this.ri([context], partials || {}, indent);
36
+ },
37
+
38
+ // render internal -- a hook for overrides that catches partials too
39
+ ri: function (context, partials, indent) {
40
+ return this.r(context, partials, indent);
41
+ },
42
+
43
+ // tries to find a partial in the curent scope and render it
44
+ rp: function(name, context, partials, indent) {
45
+ var partial = partials[name];
46
+
47
+ if (!partial) {
48
+ return '';
49
+ }
50
+
51
+ if (this.c && typeof partial == 'string') {
52
+ partial = this.c.compile(partial);
53
+ }
54
+
55
+ return partial.ri(context, partials, indent);
56
+ },
57
+
58
+ // render a section
59
+ rs: function(context, partials, section) {
60
+ var buf = '',
61
+ tail = context[context.length - 1];
62
+
63
+ if (!isArray(tail)) {
64
+ return buf = section(context, partials);
65
+ }
66
+
67
+ for (var i = 0; i < tail.length; i++) {
68
+ context.push(tail[i]);
69
+ buf += section(context, partials);
70
+ context.pop();
71
+ }
72
+
73
+ return buf;
74
+ },
75
+
76
+ // maybe start a section
77
+ s: function(val, ctx, partials, inverted, start, end, tags) {
78
+ var pass;
79
+
80
+ if (isArray(val) && val.length === 0) {
81
+ return false;
82
+ }
83
+
84
+ if (typeof val == 'function') {
85
+ val = this.ls(val, ctx, partials, inverted, start, end, tags);
86
+ }
87
+
88
+ pass = (val === '') || !!val;
89
+
90
+ if (!inverted && pass && ctx) {
91
+ ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
92
+ }
93
+
94
+ return pass;
95
+ },
96
+
97
+ // find values with dotted names
98
+ d: function(key, ctx, partials, returnFound) {
99
+ var names = key.split('.'),
100
+ val = this.f(names[0], ctx, partials, returnFound),
101
+ cx = null;
102
+
103
+ if (key === '.' && isArray(ctx[ctx.length - 2])) {
104
+ return ctx[ctx.length - 1];
105
+ }
106
+
107
+ for (var i = 1; i < names.length; i++) {
108
+ if (val && typeof val == 'object' && names[i] in val) {
109
+ cx = val;
110
+ val = val[names[i]];
111
+ } else {
112
+ val = '';
113
+ }
114
+ }
115
+
116
+ if (returnFound && !val) {
117
+ return false;
118
+ }
119
+
120
+ if (!returnFound && typeof val == 'function') {
121
+ ctx.push(cx);
122
+ val = this.lv(val, ctx, partials);
123
+ ctx.pop();
124
+ }
125
+
126
+ return val;
127
+ },
128
+
129
+ // find values with normal names
130
+ f: function(key, ctx, partials, returnFound) {
131
+ var val = false,
132
+ v = null,
133
+ found = false;
134
+
135
+ for (var i = ctx.length - 1; i >= 0; i--) {
136
+ v = ctx[i];
137
+ if (v && typeof v == 'object' && key in v) {
138
+ val = v[key];
139
+ found = true;
140
+ break;
141
+ }
142
+ }
143
+
144
+ if (!found) {
145
+ return (returnFound) ? false : "";
146
+ }
147
+
148
+ if (!returnFound && typeof val == 'function') {
149
+ val = this.lv(val, ctx, partials);
150
+ }
151
+
152
+ return val;
153
+ },
154
+
155
+ // higher order templates
156
+ ho: function(val, cx, partials, text, tags) {
157
+ var compiler = this.c;
158
+ var t = val.call(cx, text, function(t) {
159
+ return compiler.compile(t, {delimiters: tags}).render(cx, partials);
160
+ });
161
+ var s = compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials);
162
+ this.b = s;
163
+ return false;
164
+ },
165
+
166
+ // higher order template result buffer
167
+ b: '',
168
+
169
+ // lambda replace section
170
+ ls: function(val, ctx, partials, inverted, start, end, tags) {
171
+ var cx = ctx[ctx.length - 1],
172
+ t = null;
173
+
174
+ if (!inverted && this.c && val.length > 0) {
175
+ return this.ho(val, cx, partials, this.text.substring(start, end), tags);
176
+ }
177
+
178
+ t = val.call(cx);
179
+
180
+ if (typeof t == 'function') {
181
+ if (inverted) {
182
+ return true;
183
+ } else if (this.c) {
184
+ return this.ho(t, cx, partials, this.text.substring(start, end), tags);
185
+ }
186
+ }
187
+
188
+ return t;
189
+ },
190
+
191
+ // lambda replace variable
192
+ lv: function(val, ctx, partials) {
193
+ var cx = ctx[ctx.length - 1];
194
+ var result = val.call(cx);
195
+ if (typeof result == 'function') {
196
+ result = result.call(cx);
197
+ }
198
+ result = result.toString();
199
+
200
+ if (this.c && ~result.indexOf("{{")) {
201
+ return this.c.compile(result).render(cx, partials);
202
+ }
203
+
204
+ return result;
205
+ }
206
+
207
+ };
208
+
209
+ var rAmp = /&/g,
210
+ rLt = /</g,
211
+ rGt = />/g,
212
+ rApos =/\'/g,
213
+ rQuot = /\"/g,
214
+ hChars =/[&<>\"\']/;
215
+
216
+ function hoganEscape(str) {
217
+ str = String((str === null || str === undefined) ? '' : str);
218
+ return hChars.test(str) ?
219
+ str
220
+ .replace(rAmp,'&amp;')
221
+ .replace(rLt,'&lt;')
222
+ .replace(rGt,'&gt;')
223
+ .replace(rApos,'&#39;')
224
+ .replace(rQuot, '&quot;') :
225
+ str;
226
+ }
227
+
228
+ var isArray = Array.isArray || function(a) {
229
+ return Object.prototype.toString.call(a) === '[object Array]';
230
+ };
231
+
232
+ })(typeof exports !== 'undefined' ? exports : Hogan);
233
+
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "hogan.js"
3
+ , "description": "A mustache compiler."
4
+ , "version": "1.0.5-dev"
5
+ , "keywords": ["mustache", "template"]
6
+ , "main": "./lib/hogan.js"
7
+ , "homepage": "http://twitter.github.com/hogan.js/"
8
+ , "author": "Twitter Inc."
9
+ , "repository": {
10
+ "type": "git"
11
+ , "url": "https://github.com/twitter/hogan.js.git"
12
+ }
13
+ , "licenses": [
14
+ { "type": "Apache-2.0"
15
+ , "url": "http://www.apache.org/licenses/LICENSE-2.0"
16
+ }
17
+ ]
18
+ , "devDependencies": { "uglify-js": "*" }
19
+ , "bin" : { "hulk" : "./bin/hulk" }
20
+ }
@@ -0,0 +1,8 @@
1
+ <ul>
2
+ <li></li>
3
+ <li></li>
4
+ <li></li>
5
+ <li></li>
6
+ <li></li>
7
+ <li></li>
8
+ </ul>
@@ -0,0 +1,13 @@
1
+ <html>
2
+ <head>
3
+ <title>test</title>
4
+ <script src="https://raw.github.com/douglascrockford/JSON-js/master/json2.js"></script>
5
+ </head>
6
+ <body>
7
+ <code id="console"></code>
8
+ <script>var Hogan = {};</script>
9
+ <script src="../lib/template.js"></script>
10
+ <script src="../lib/compiler.js"></script>
11
+ <script src="./index.js"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,848 @@
1
+ /*
2
+ * Copyright 2011 Twitter, Inc.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ var Hogan = Hogan || require('../lib/hogan')
17
+ , doc = this["document"]
18
+
19
+ function testScanTextNoTags() {
20
+ var text = "<h2>hi</h2>";
21
+ var tokens = Hogan.scan(text);
22
+ is(tokens.length, 1, "One token");
23
+ is(tokens[0]+'', text, "text is equal to first token");
24
+ }
25
+
26
+ function testScanOneTag() {
27
+ var text = "{{hmm}}";
28
+ var tokens = Hogan.scan(text);
29
+ is(tokens.length, 1, "One token");
30
+ is(tokens[0].n, "hmm", "First token content is variable name.");
31
+ }
32
+
33
+ function testScanMultipleTags() {
34
+ var text = "asdf{{hmm}}asdf2{{hmm2}}asdf3";
35
+ var tokens = Hogan.scan(text);
36
+ is(tokens.length, 5, "3 text tokens, 2 tag tokens.");
37
+ is(tokens[0]+'', "asdf", "first token is text");
38
+ is(tokens[1].n, "hmm", "second token is tag");
39
+ is(tokens[1].tag, "_v", "second token is a variable");
40
+ is(tokens[2]+'', "asdf2", "third token is text");
41
+ is(tokens[3].n, "hmm2", "fourth token is tag");
42
+ is(tokens[3].tag, "_v", "fourth token is a variable");
43
+ is(tokens[4]+'', "asdf3", "Fifth token is text");
44
+ }
45
+
46
+ function testScanSectionOpen() {
47
+ var text = "{{#hmm}}";
48
+ var tokens = Hogan.scan(text);
49
+ is(tokens.length, 1, "One token");
50
+ is(tokens[0].n, "hmm", "First token content is variable name.");
51
+ is(tokens[0].tag, "#", "First token is a section.");
52
+ }
53
+
54
+ function testScanSectionClose() {
55
+ var text = "{{/hmm}}";
56
+ var tokens = Hogan.scan(text);
57
+ is(tokens.length, 1, "One token");
58
+ is(tokens[0].n, "hmm", "First token content is variable name.");
59
+ is(tokens[0].tag, "/", "First token is a section.");
60
+ }
61
+
62
+ function testScanSection() {
63
+ var text = "{{#hmm}}{{/hmm}}";
64
+ var tokens = Hogan.scan(text);
65
+ is(tokens.length, 2, "One token");
66
+ is(tokens[0].n, "hmm", "First token content is variable name.");
67
+ is(tokens[0].tag, "#", "First token is a section.");
68
+ is(tokens[1].n, "hmm", "Second token content is variable name.");
69
+ is(tokens[1].tag, "/", "Second token is a section.");
70
+ }
71
+
72
+ function testScanSectionInContent() {
73
+ var text = "abc{{#hmm}}def{{/hmm}}ghi";
74
+ var tokens = Hogan.scan(text);
75
+ is(tokens.length, 5, "3 text tokens, 2 tag tokens.");
76
+ is(tokens[0]+'', "abc", "first token is text");
77
+ is(tokens[1].n, "hmm", "second token is tag");
78
+ is(tokens[1].tag, "#", "second token is a variable");
79
+ is(tokens[2]+'', "def", "third token is text");
80
+ is(tokens[3].n, "hmm", "fourth token is tag");
81
+ is(tokens[3].tag, "/", "fourth token is a variable");
82
+ is(tokens[4]+'', "ghi", "Fifth token is text");
83
+ }
84
+
85
+ function testScanNegativeSection() {
86
+ var text = "{{^hmm}}{{/hmm}}";
87
+ var tokens = Hogan.scan(text);
88
+ is(tokens.length, 2, "One token");
89
+ is(tokens[0].n, "hmm", "First token content is variable name.");
90
+ is(tokens[0].tag, "^", "First token is a negative section.");
91
+ is(tokens[1].n, "hmm", "First token content is variable name.");
92
+ is(tokens[1].tag, "/", "Second token is a section.");
93
+ }
94
+
95
+ function testScanPartial() {
96
+ var text = "{{>hmm}}";
97
+ var tokens = Hogan.scan(text);
98
+ is(tokens.length, 1, "One token");
99
+ is(tokens[0].n, "hmm", "First token content is variable name.");
100
+ is(tokens[0].tag, ">", "First token is a partial.");
101
+ }
102
+
103
+
104
+ function testScanBackwardPartial() {
105
+ var text = "{{<hmm}}";
106
+ var tokens = Hogan.scan(text);
107
+ is(tokens.length, 1, "One token");
108
+ is(tokens[0].n, "hmm", "First token content is variable name.");
109
+ is(tokens[0].tag, "<", "First token is a backward partial.");
110
+ }
111
+
112
+ function testScanAmpersandNoEscapeTag() {
113
+ var text = "{{&hmm}}";
114
+ var tokens = Hogan.scan(text);
115
+ is(tokens.length, 1, "One token");
116
+ is(tokens[0].n, "hmm", "First token content is variable name.");
117
+ is(tokens[0].tag, "&", "First token is an ampersand no-escape.");
118
+ }
119
+
120
+ function testScanTripleStache() {
121
+ var text = "{{{hmm}}}";
122
+ var tokens = Hogan.scan(text);
123
+ is(tokens.length, 1, "One token");
124
+ is(tokens[0].n, "hmm", "First token content is variable name.");
125
+ is(tokens[0].tag, "{", "First token is a triple-stache.");
126
+ }
127
+
128
+ function testScanSectionWithTripleStacheInside() {
129
+ var text = "a{{#yo}}b{{{hmm}}}c{{/yo}}d";
130
+ var tokens = Hogan.scan(text);
131
+ is(tokens.length, 7, "One token");
132
+ is(tokens[0]+'', "a", "First token content is correct text.");
133
+ is(tokens[1].n, "yo", "Second token content is correct text.");
134
+ is(tokens[1].tag, "#", "Second token is a section.");
135
+ is(tokens[2]+'', "b", "Third token content is correct text.");
136
+ is(tokens[3].n, "hmm", "Fourth token content is correct text.");
137
+ is(tokens[3].tag, "{", "Fourth token is a triple stache.");
138
+ is(tokens[4]+'', "c", "Fifth token content is correct text.");
139
+ is(tokens[5].n, "yo", "Sixth token content is correct text.");
140
+ is(tokens[5].tag, "/", "Sixth token is a close.");
141
+ is(tokens[6]+'', "d", "Seventh token content is correct text.");
142
+ }
143
+
144
+ function testScanSetDelimiter() {
145
+ var text = "a{{=<% %>=}}b";
146
+ var tokens = Hogan.scan(text);
147
+ is(tokens.length, 2, "change delimiter doesn't appear as token.");
148
+ is(tokens[0]+'', "a", "text before change delimiter is processed.");
149
+ is(tokens[1]+'', "b", "text after change delimiter is processed.");
150
+ }
151
+
152
+ function testScanResetDelimiter() {
153
+ var text = "a{{=<% %>=}}b<%hmm%>c<%={{ }}=%>d{{hmm}}";
154
+ var tokens = Hogan.scan(text);
155
+ is(tokens.length, 6, "8 tokens, delimiter changes don't count.");
156
+ is(tokens[0]+'', "a", "first token is correct.");
157
+ is(tokens[1]+'', "b", "third token is correct.");
158
+ is(tokens[2].tag, "_v", "third token is correct tag.");
159
+ is(tokens[2].n, "hmm", "third token is correct name.");
160
+ is(tokens[3]+'', "c", "fifth token is correct.");
161
+ is(tokens[4]+'', "d", "seventh token is correct.");
162
+ is(tokens[5].tag, "_v", "eighth token is correct tag.");
163
+ is(tokens[5].n, "hmm", "eighth token is correct name.");
164
+ }
165
+
166
+ function testSingleCharDelimiter() {
167
+ var text = '({{foo}} {{=[ ]=}}[text])';
168
+ var tokens = Hogan.scan(text);
169
+
170
+ var t = Hogan.compile(text);
171
+ s = t.render({foo: "bar", text: 'It worked!'});
172
+ is(s, '(bar It worked!)', "Hogan substitution worked after custom delimiters.");
173
+ }
174
+
175
+ function testSetDelimiterWithWhitespace() {
176
+ var text = "{{= | | =}}|foo|";
177
+ var t = Hogan.compile(text);
178
+ s = t.render({foo: "bar"});
179
+ is(s, 'bar', "custom delimiters with whitespace works.")
180
+ }
181
+
182
+ function testParseBasic() {
183
+ var text = "test";
184
+ var tree = Hogan.parse(Hogan.scan(text));
185
+ is(tree.length, 1, "one parse node");
186
+ is(tree[0]+'', "test", "text is correct");
187
+ }
188
+
189
+ function testParseVariables() {
190
+ var text = "test{{foo}}test!{{bar}}test!!{{baz}}test!!!";
191
+ var tree = Hogan.parse(Hogan.scan(text));
192
+ is(tree.length, 7, "one parse node");
193
+ is(tree[0]+'', "test", "first text is correct");
194
+ is(tree[2]+'', "test!", "second text is correct")
195
+ is(tree[4]+'', "test!!", "third text is correct")
196
+ is(tree[6]+'', "test!!!", "last text is correct")
197
+ is(tree[1].n, "foo", "first var is correct");
198
+ is(tree[3].n, "bar", "second var is correct");
199
+ is(tree[5].n, "baz", "third var is correct");
200
+ }
201
+
202
+ function testParseSection() {
203
+ var text = "a{{#foo}}b{{/foo}}c";
204
+ var tree = Hogan.parse(Hogan.scan(text));
205
+ is(tree.length, 3, "three nodes at base");
206
+ is(tree[0]+'', "a", "correct text in first node");
207
+ is(tree[1].hasOwnProperty('nodes'), true, "second node is a section");
208
+ is(tree[1].tag, '#', "second node is a section");
209
+ is(tree[1].n, "foo", "correct name for section");
210
+ is(tree[1].nodes[0]+'', "b", "correct text in section");
211
+ is(tree[2]+'', "c", "correct text in last node");
212
+ }
213
+
214
+ function testParseIndexes() {
215
+ var text = "abc{{#foo}}asdf{{bar}}asdf{{/foo}}def";
216
+ var tree = Hogan.parse(Hogan.scan(text));
217
+ is(text.substring(tree[1].i, tree[1].end), "asdf{{bar}}asdf", "section text indexes are correct");
218
+ }
219
+
220
+ function testParseNegativeSection() {
221
+ var text = "a{{^foo}}b{{/foo}}c";
222
+ var tree = Hogan.parse(Hogan.scan(text));
223
+
224
+ is(tree.length, 3, "three nodes at base");
225
+ is(tree[0]+'', "a", "correct text in first node");
226
+ is(tree[1].hasOwnProperty('nodes'), true, "second node is a section");
227
+ is(tree[1].tag, '^', "second node is a negative section");
228
+ is(tree[1].n, "foo", "correct name for section");
229
+ is(tree[1].nodes[0]+'', "b", "correct text in section");
230
+ is(tree[2]+'', "c", "correct text in last node");
231
+ }
232
+
233
+ function testParseNestedSections() {
234
+ var text = "{{#bar}}{{#foo}}c{{/foo}}{{/bar}}"
235
+ var tree = Hogan.parse(Hogan.scan(text));
236
+
237
+ is(tree.length, 1, "one node at base");
238
+ is(tree[0].tag, "#", "open section is first node");
239
+ is(tree[0].n, "bar", "first section name is 'bar'");
240
+ is(tree[0].nodes.length, 1, "first section contains one node.");
241
+ is(tree[0].nodes[0].n, "foo", "correct name for nested section");
242
+ is(tree[0].nodes[0].nodes[0]+'', "c", "correct text in nested section");
243
+ }
244
+
245
+ function testMissingClosingTag() {
246
+ var text = "a{{#foo}}bc";
247
+ var msg = '';
248
+ try {
249
+ var tree = Hogan.parse(Hogan.scan(text));
250
+ } catch (e) {
251
+ msg = e.message;
252
+ }
253
+ is(msg, "missing closing tag: foo", "Error is generated");
254
+ }
255
+
256
+ function testBadNesting() {
257
+ var text = "a{{#foo}}{{#bar}}b{{/foo}}{{/bar}}c";
258
+ var msg = '';
259
+ try {
260
+ var tree = Hogan.parse(Hogan.scan(text));
261
+ } catch (e) {
262
+ msg = e.message;
263
+ }
264
+ is(msg, "Nesting error: bar vs. foo", "Error is generated");
265
+ }
266
+
267
+ function testBasicOutput() {
268
+ var text = "test";
269
+ var t = Hogan.compile(text);
270
+ is(t.render(), text, "template renders one text node");
271
+ }
272
+
273
+ function testBasicOutputAsString() {
274
+ var text = "test";
275
+ var textFunc = Hogan.compile(text, true);
276
+ is(textFunc, "function(context, partials){this.buffer.push('test');};", "template renders correct text function.");
277
+ }
278
+
279
+ function testOneVariable() {
280
+ var text = "test {{foo}} test";
281
+ var t = Hogan.compile(text);
282
+ var s = t.render({foo:'bar'});
283
+ is(s, "test bar test", "basic variable substitution works.");
284
+ }
285
+
286
+ function testOneVariableAsString() {
287
+ var text = "test {{foo}} test";
288
+ var funcText = Hogan.compile(text, true);
289
+ is(funcText, "function(context, partials){this.buffer.push('test ');\nthis.buffer.push(this.find('foo', context));\nthis.buffer.push(' test');};",
290
+ "Function text is correct with variable substitution.");
291
+ }
292
+
293
+ function testRenderWithWhitespace() {
294
+ var text = "{{ string }}";
295
+ var t = Hogan.compile(text);
296
+ is(t.render({string: "---" }), "---", "tags with whitespace render correctly.");
297
+ }
298
+
299
+ function testRenderWithWhitespaceAroundTripleStache() {
300
+ var text = " {{{string}}}\n";
301
+ var t = Hogan.compile(text);
302
+ is(t.render({string: "---" }), " ---\n", "triple stache surrounded by whitespace render correctly.");
303
+ }
304
+
305
+ function testRenderWithWhitespaceAroundAmpersand() {
306
+ var text = " {{& string }}\n";
307
+ var t = Hogan.compile(text);
308
+ is(t.render({string: "---" }), " ---\n", "ampersand surrounded by whitespace render correctly.");
309
+ }
310
+
311
+ function testMultipleVariables() {
312
+ var text = "test {{foo}} test {{bar}} test {{baz}} test {{foo}} test";
313
+ var t = Hogan.compile(text);
314
+ var s = t.render({foo:'42', bar: '43', baz: '44'});
315
+ is(s, "test 42 test 43 test 44 test 42 test", "all variables render correctly.");
316
+ }
317
+
318
+ function testNumberValues() {
319
+ var text = "integer: {{foo}} float: {{bar}} negative: {{baz}}";
320
+ var t = Hogan.compile(text);
321
+ var s = t.render({foo: 42, bar: 42.42, baz: -42});
322
+ is(s, "integer: 42 float: 42.42 negative: -42", "numbers render correctly");
323
+ }
324
+
325
+ function testObjectRender() {
326
+ var text = "object: {{foo}}";
327
+ var t = Hogan.compile(text);
328
+ var s = t.render({foo: {}});
329
+ is(s, "object: [object Object]", "objects render default toString.");
330
+ }
331
+
332
+ function testObjectToStringRender() {
333
+ var text = "object: {{foo}}";
334
+ var t = Hogan.compile(text);
335
+ var s = t.render({foo: {toString: function(){ return "yo!"}}});
336
+ is(s, "object: yo!", "objects render supplied toString.");
337
+ }
338
+
339
+ function testArrayRender() {
340
+ var text = "array: {{foo}}";
341
+ var t = Hogan.compile(text);
342
+ var s = t.render({foo: ["a","b","c"]});
343
+ is(s, "array: a,b,c", "arrays render default toString.");
344
+ }
345
+
346
+ function testEscaping() {
347
+ var text = "{{foo}}";
348
+ var t = Hogan.compile(text);
349
+ var s = t.render();
350
+ var s = t.render({foo: "< > <div> \' \" &"});
351
+ is(s, "&lt; &gt; &lt;div&gt; &#39; &quot; &amp;", "input correctly escaped.");
352
+
353
+ var ec ={ "'": "&#39;", '"': "&quot;", "<": "&lt;", ">": "&gt;", "&": "&amp;"}
354
+ for (var char in ec) {
355
+ var s = t.render({foo: char + " just me"});
356
+ is(s, ec[char] + " just me", "input correctly escaped.");
357
+ }
358
+
359
+ }
360
+
361
+ function testMustacheInjection() {
362
+ var text = "{{foo}}";
363
+ var t = Hogan.compile(text);
364
+ s = t.render({foo:"{{{<42}}}"})
365
+ is(s, "{{{&lt;42}}}", "Can't inject mustache");
366
+ }
367
+
368
+ function testTripleStache() {
369
+ var text = "{{{foo}}}";
370
+ var t = Hogan.compile(text);
371
+ var s = t.render({foo: "< > <div> \' \" &"});
372
+ is(s, "< > <div> \' \" &", "input correctly not-escaped.");
373
+ }
374
+
375
+ function testAmpNoEscaping() {
376
+ var text = "{{&foo}}";
377
+ var t = Hogan.compile(text);
378
+ var s = t.render({foo: "< > <div> \' \" &"});
379
+ is(s, "< > <div> \' \" &", "input correctly not-escaped.");
380
+ }
381
+
382
+ function testPartial() {
383
+ var partialText = "this is text from the partial--the magic number {{foo}} is from a variable";
384
+ var p = Hogan.compile(partialText);
385
+
386
+ var text = "This template contains a partial ({{>testPartial}})."
387
+ var t = Hogan.compile(text);
388
+
389
+ var s = t.render({foo: 42}, {testPartial: p});
390
+ is(s, "This template contains a partial (this is text from the partial--the magic number 42 is from a variable).", "partials work");
391
+ }
392
+
393
+ function testNestedPartials() {
394
+ var partialText = "this is text from the partial--the magic number {{foo}} is from a variable";
395
+ var p = Hogan.compile(partialText);
396
+
397
+ var partialText2 = "This template contains a partial ({{>testPartial}})."
398
+ var p2 = Hogan.compile(partialText2);
399
+
400
+ var text = "This template contains a partial that contains a partial [{{>testPartial2}}]."
401
+ var t = Hogan.compile(text);
402
+
403
+ var s = t.render({foo: 42}, {testPartial: p, testPartial2: p2});
404
+ is(s, "This template contains a partial that contains a partial [This template contains a partial (this is text from the partial--the magic number 42 is from a variable).].", "nested partials work");
405
+ }
406
+
407
+ function testNegativeSection() {
408
+ var text = "This template {{^foo}}BOO {{/foo}}contains an inverted section."
409
+ var t = Hogan.compile(text);
410
+ var s = t.render();
411
+ is(s, "This template BOO contains an inverted section.", "inverted sections with no context work");
412
+
413
+ s = t.render({foo:[]});
414
+ is(s, "This template BOO contains an inverted section.", "inverted sections with empty list context work");
415
+
416
+ s = t.render({ foo:false });
417
+ is(s, "This template BOO contains an inverted section.", "inverted sections with false context work");
418
+
419
+ s = t.render({foo:''});
420
+ is(s, "This template contains an inverted section.", "inverted sections with empty string context work");
421
+
422
+ s = t.render({foo:true});
423
+ is(s, "This template contains an inverted section.", "inverted sections with true context work");
424
+
425
+ s = t.render({foo: function() { return false; }});
426
+ is(s, "This template BOO contains an inverted section.", "inverted sections with false returning method in context work");
427
+ }
428
+
429
+ function testSectionElision() {
430
+ var text = "This template {{#foo}}BOO {{/foo}}contains a section."
431
+ var t = Hogan.compile(text);
432
+ var s = t.render();
433
+ is(s, "This template contains a section.", "sections with no context work");
434
+
435
+ s = t.render({foo:[]});
436
+ is(s, "This template contains a section.", "sections with empty list context work");
437
+
438
+ s = t.render({foo:false});
439
+ is(s, "This template contains a section.", "sections with false context work");
440
+ }
441
+
442
+ function testSectionObjectContext() {
443
+ var text = "This template {{#foo}}{{bar}} {{/foo}}contains a section."
444
+ var t = Hogan.compile(text);
445
+ var s = t.render({foo:{bar:42}});
446
+ is(s, "This template 42 contains a section.", "sections with object context work");
447
+ }
448
+
449
+ function testSectionArrayContext() {
450
+ var text = "This template {{#foo}}{{bar}} {{/foo}}contains a section."
451
+ var t = Hogan.compile(text);
452
+ var s = t.render({foo:[{bar:42}, {bar:43}, {bar:44}]});
453
+ is(s, "This template 42 43 44 contains a section.", "sections with object ctx and array values work");
454
+ }
455
+
456
+ function testFalsyVariableNoRender() {
457
+ var text = "I ({{cannot}}) be seen!";
458
+ var t = Hogan.compile(text);
459
+ var s = t.render();
460
+ is(s, "I () be seen!", "missing value doesn't render.");
461
+ }
462
+
463
+ function testSectionExtensions() {
464
+ var text = "Test {{_//|__foo}}bar{{/foo}}";
465
+ var options = {sectionTags:[{o:'_//|__foo', c:'foo'}]};
466
+ var tree = Hogan.parse(Hogan.scan(text), options);
467
+ is(tree[1].tag, "#", "_//|__foo node transformed to section");
468
+ is(tree[1].n, "_//|__foo", "_//|__foo node transformed to section");
469
+
470
+ var t = Hogan.compile(text, options );
471
+ var s = t.render({'_//|__foo':true});
472
+ is(s, "Test bar", "Custom sections work");
473
+ }
474
+
475
+ function testMisnestedSectionExtensions() {
476
+ var text = "Test {{__foo}}bar{{/bar}}";
477
+ var options = {sectionTags:[{o:'__foo', c:'foo'}, {o:'__bar', c:'bar'}]};
478
+ var msg = '';
479
+ try {
480
+ var tree = Hogan.parse(Hogan.scan(text), options);
481
+ } catch (e) {
482
+ msg = e.message;
483
+ }
484
+ is(msg, "Nesting error: __foo vs. bar", "Error is generated");
485
+ }
486
+
487
+ function testNestedSection() {
488
+ var text = "{{#foo}}{{#bar}}{{baz}}{{/bar}}{{/foo}}";
489
+ var t = Hogan.compile(text);
490
+ var s = t.render({foo: 42, bar: 42, baz:42});
491
+ is(s, "42", "can reach up context stack");
492
+ }
493
+
494
+ function testDottedNames() {
495
+ var text = '"{{person.name}}" == "{{#person}}{{name}}{{/person}}"';
496
+ var t = Hogan.compile(text);
497
+ var s = t.render({person:{name:'Joe'}});
498
+ is(s, '"Joe" == "Joe"', "dotted names work");
499
+ }
500
+
501
+ function testImplicitIterator() {
502
+ var text = '{{#stuff}} {{.}} {{/stuff}}';
503
+ var t = Hogan.compile(text);
504
+ var s = t.render({stuff:[42,43,44]});
505
+ is(s, " 42 43 44 ", "implicit iterators work");
506
+ }
507
+
508
+ function testPartialsAndDelimiters() {
509
+ var text = '{{>include}}*\n{{= | | =}}\n*|>include|';
510
+ var partialText = ' .{{value}}. ';
511
+ var partial = Hogan.compile(partialText);
512
+ var t = Hogan.compile(text);
513
+ var s = t.render({value:"yes"}, {'include':partial});
514
+ is(s, " .yes. *\n* .yes. ", "partials work around delimiters");
515
+ }
516
+
517
+ function testStringPartials() {
518
+ var text = "foo{{>mypartial}}baz";
519
+ var partialText = " bar ";
520
+ var t = Hogan.compile(text);
521
+ var s = t.render({}, {'mypartial': partialText});
522
+ is(s, "foo bar baz", "string partial works.");
523
+ }
524
+
525
+ function testMissingPartials() {
526
+ var text = "foo{{>mypartial}} bar";
527
+ var t = Hogan.compile(text);
528
+ var s = t.render({});
529
+ is(s, "foo bar", "missing partial works.");
530
+ }
531
+
532
+ function testIndentedStandaloneComment() {
533
+ var text = 'Begin.\n {{! Indented Comment Block! }}\nEnd.';
534
+ var t = Hogan.compile(text);
535
+ var s = t.render();
536
+ is(s, 'Begin.\nEnd.', "Standalone comment blocks are removed.");
537
+ }
538
+
539
+ function testNewLineBetweenDelimiterChanges() {
540
+ var data = { section: true, data: 'I got interpolated.' };
541
+ var text = '\n{{#section}}\n {{data}}\n |data|\n{{/section}}x\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|';
542
+ var t = Hogan.compile(text);
543
+ var s = t.render(data);
544
+ is(s, '\n I got interpolated.\n |data|\nx\n\n {{data}}\n I got interpolated.\n', 'render correct')
545
+ }
546
+
547
+ function testMustacheJSApostrophe() {
548
+ var text = '{{apos}}{{control}}';
549
+ var t = Hogan.compile(text);
550
+ var s = t.render({'apos':"'", 'control':"X"});
551
+ is(s, '&#39;X', 'Apostrophe is escaped.');
552
+ }
553
+
554
+ function testMustacheJSArrayOfImplicitPartials() {
555
+ var text = 'Here is some stuff!\n{{#numbers}}\n{{>partial}}\n{{/numbers}}\n';
556
+ var partialText = '{{.}}\n';
557
+ var t = Hogan.compile(text);
558
+ var s = t.render({numbers:[1,2,3,4]}, {partial: partialText});
559
+ is(s, 'Here is some stuff!\n1\n2\n3\n4\n', 'Partials with implicit iterators work.');
560
+ }
561
+
562
+ function testMustacheJSArrayOfPartials() {
563
+ var text = 'Here is some stuff!\n{{#numbers}}\n{{>partial}}\n{{/numbers}}\n';
564
+ var partialText = '{{i}}\n';
565
+ var t = Hogan.compile(text);
566
+ var s = t.render({numbers:[{i:1},{i:2},{i:3},{i:4}]}, {partial: partialText});
567
+ is(s, 'Here is some stuff!\n1\n2\n3\n4\n', 'Partials with arrays work.');
568
+ }
569
+
570
+ function testMustacheJSArrayOfStrings() {
571
+ var text = '{{#strings}}{{.}} {{/strings}}';
572
+ var t = Hogan.compile(text);
573
+ var s = t.render({strings:['foo', 'bar', 'baz']});
574
+ is(s, 'foo bar baz ', 'array of strings works with implicit iterators.');
575
+ }
576
+
577
+ function testMustacheJSUndefinedString() {
578
+ var text = 'foo{{bar}}baz';
579
+ var t = Hogan.compile(text);
580
+ var s = t.render({bar:undefined});
581
+ is(s, 'foobaz', 'undefined value does not render.');
582
+ }
583
+
584
+ function testMustacheJSTripleStacheAltDelimiter() {
585
+ var text = '{{=<% %>=}}<% foo %> {{foo}} <%{bar}%> {{{bar}}}';
586
+ var t = Hogan.compile(text);
587
+ var s = t.render({foo:'yeah', bar:'hmm'});
588
+ is(s, 'yeah {{foo}} hmm {{{bar}}}', 'triple stache inside alternate delimiter works.');
589
+ }
590
+
591
+ /* shootout benchmark tests */
592
+
593
+ function testShootOutString() {
594
+ var text = "Hello World!";
595
+ var expected = "Hello World!"
596
+ var t = Hogan.compile(text)
597
+ var s = t.render({})
598
+ is(s, expected, "Shootout String compiled correctly");
599
+ }
600
+
601
+ function testShootOutReplace() {
602
+ var text = "Hello {{name}}! You have {{count}} new messages.";
603
+ var expected = "Hello Mick! You have 30 new messages.";
604
+ var t = Hogan.compile(text)
605
+ var s = t.render({ name: "Mick", count: 30 })
606
+ is(s, expected, "Shootout Replace compiled correctly");
607
+ }
608
+
609
+ function testShootOutArray() {
610
+ var text = "{{#names}}{{name}}{{/names}}";
611
+ var expected = "MoeLarryCurlyShemp";
612
+ var t = Hogan.compile(text);
613
+ var s = t.render({ names: [{name: "Moe"}, {name: "Larry"}, {name: "Curly"}, {name: "Shemp"}] })
614
+ is(s, expected, "Shootout Array compiled correctly");
615
+ }
616
+
617
+ function testShootOutObject() {
618
+ var text = "{{#person}}{{name}}{{age}}{{/person}}";
619
+ var expected = "Larry45";
620
+ var t = Hogan.compile(text)
621
+ var s = t.render({ person: { name: "Larry", age: 45 } })
622
+ is(s, expected, "Shootout Object compiled correctly");
623
+ }
624
+
625
+ function testShootOutPartial() {
626
+ var text = "{{#peeps}}{{>replace}}{{/peeps}}";
627
+ var t = Hogan.compile(text);
628
+ var partial = Hogan.compile(" Hello {{name}}! You have {{count}} new messages.");
629
+ var s = t.render({ peeps: [{name: "Moe", count: 15}, {name: "Larry", count: 5}, {name: "Curly", count: 2}] }, { replace: partial });
630
+ var expected = " Hello Moe! You have 15 new messages. Hello Larry! You have 5 new messages. Hello Curly! You have 2 new messages.";
631
+ is(s, expected, "Shootout Partial compiled correctly");
632
+ }
633
+
634
+ function testShootOutRecurse() {
635
+ var text = "{{name}}{{#kids}}{{>recursion}}{{/kids}}";
636
+ var t = Hogan.compile(text);
637
+ var partial = Hogan.compile("{{name}}{{#kids}}{{>recursion}}{{/kids}}");
638
+ var s = t.render({
639
+ name: '1',
640
+ kids: [
641
+ {
642
+ name: '1.1',
643
+ kids: [
644
+ { name: '1.1.1', kids: [] }
645
+ ]
646
+ }
647
+ ]
648
+ }, { recursion: partial });
649
+ var expected = "11.11.1.1";
650
+ is(s, expected, "Shootout Recurse compiled correctly");
651
+ }
652
+
653
+ function testShootOutFilter() {
654
+ var text = "{{#filter}}foo {{bar}}{{/filter}}";
655
+ var t = Hogan.compile(text);
656
+ var s = t.render({
657
+ filter: function() {
658
+ return function(text, render) {
659
+ return render(text).toUpperCase();
660
+ }
661
+ },
662
+ bar: "bar"
663
+ });
664
+ var expected = "FOO BAR"
665
+ is(s, expected, "Shootout Filter compiled correctly");
666
+ }
667
+
668
+ function testShootOutComplex() {
669
+ var text =
670
+ "<h1>{{header}}</h1>" +
671
+ "{{#hasItems}}" +
672
+ "<ul>" +
673
+ "{{#items}}" +
674
+ "{{#current}}" +
675
+ "<li><strong>{{name}}</strong></li>" +
676
+ "{{/current}}" +
677
+ "{{^current}}" +
678
+ "<li><a href=\"{{url}}\">{{name}}</a></li>" +
679
+ "{{/current}}" +
680
+ "{{/items}}" +
681
+ "</ul>" +
682
+ "{{/hasItems}}" +
683
+ "{{^hasItems}}" +
684
+ "<p>The list is empty.</p>" +
685
+ "{{/hasItems}}";
686
+
687
+ var expected = "<h1>Colors</h1><ul><li><strong>red</strong></li><li><a href=\"#Green\">green</a></li><li><a href=\"#Blue\">blue</a></li></ul>";
688
+ var t = Hogan.compile(text)
689
+ var s = t.render({
690
+ header: function() {
691
+ return "Colors";
692
+ },
693
+ items: [
694
+ {name: "red", current: true, url: "#Red"},
695
+ {name: "green", current: false, url: "#Green"},
696
+ {name: "blue", current: false, url: "#Blue"}
697
+ ],
698
+ hasItems: function() {
699
+ return this.items.length !== 0;
700
+ },
701
+ empty: function() {
702
+ return this.items.length === 0;
703
+ }
704
+ })
705
+
706
+ is(s, expected, "Shootout Complex compiled correctly");
707
+ }
708
+
709
+ function testRenderOutput() {
710
+ if (doc) return
711
+ var fs = require('fs');
712
+ var inPath = 'test/templates';
713
+ var outPath = 'test/html';
714
+
715
+ fs.readdirSync(inPath).forEach(function (file) {
716
+ var i = fs.readFileSync([inPath, file].join('/'), 'utf-8');
717
+ var t = Hogan.compile(i);
718
+ var r = t.render({});
719
+ var o = fs.readFileSync([outPath, file].join('/').replace(/mustache$/, 'html')).toString();
720
+ is(r === o, true, file + ' should correctly render html')
721
+ })
722
+ }
723
+
724
+ function testDefaultRenderImpl() {
725
+ var ht = new Hogan.Template();
726
+ is(ht.render() === '', true, 'default renderImpl returns an array.');
727
+ }
728
+
729
+
730
+ function appendText(el, text) {
731
+ var textNode = document.createTextNode(text);
732
+ el.appendChild(textNode);
733
+ el.appendChild(document.createElement('br'));
734
+ }
735
+
736
+ if (!this["output"]) {
737
+ var output = function (s) {
738
+ return doc ? appendText(doc.getElementById('console'), s) : console.log(s);
739
+ };
740
+ }
741
+ var passed = 0;
742
+ var failed = 0;
743
+
744
+ function is(got, expected, msg) {
745
+ if (got === expected) {
746
+ output("OK: " + msg);
747
+ ++passed;
748
+ } else {
749
+ output("FAIL: " + msg);
750
+ output("Expected |" + expected + "|");
751
+ output(" Got |" + got + "|");
752
+ ++failed;
753
+ }
754
+ }
755
+
756
+ function complete() {
757
+ output("\nTests Complete");
758
+ output("--------------");
759
+ output("Passed: " + passed);
760
+ output("Failed: " + failed);
761
+ output("\n");
762
+ }
763
+
764
+ function runTests() {
765
+ output("Tests Starting");
766
+ output("--------------");
767
+ testScanTextNoTags();
768
+ testScanOneTag();
769
+ testScanMultipleTags();
770
+ testScanSectionOpen();
771
+ testScanSectionClose();
772
+ testScanSection();
773
+ testScanSectionInContent();
774
+ testScanNegativeSection();
775
+ testScanPartial();
776
+ testScanBackwardPartial();
777
+ testScanAmpersandNoEscapeTag();
778
+ testScanTripleStache();
779
+ testScanSectionWithTripleStacheInside();
780
+ testScanSetDelimiter();
781
+ testScanResetDelimiter();
782
+ testSetDelimiterWithWhitespace();
783
+ testSingleCharDelimiter();
784
+ testParseBasic();
785
+ testParseVariables();
786
+ testParseSection();
787
+ testParseIndexes();
788
+ testParseNegativeSection();
789
+ testParseNestedSections();
790
+ testMissingClosingTag();
791
+ testBadNesting();
792
+ testBasicOutput();
793
+ //testBasicOutputAsString();
794
+ testOneVariable();
795
+ //testOneVariableAsString();
796
+ testMultipleVariables();
797
+ testNumberValues();
798
+ testObjectRender();
799
+ testObjectToStringRender();
800
+ testArrayRender();
801
+ testEscaping();
802
+ testMustacheInjection();
803
+ testTripleStache();
804
+ testAmpNoEscaping();
805
+ testPartial();
806
+ testNestedPartials();
807
+ testNegativeSection();
808
+ testSectionElision();
809
+ testSectionObjectContext();
810
+ testSectionArrayContext();
811
+ testRenderWithWhitespace();
812
+ testRenderWithWhitespaceAroundTripleStache();
813
+ testRenderWithWhitespaceAroundAmpersand();
814
+ testFalsyVariableNoRender();
815
+ testRenderOutput();
816
+ testDefaultRenderImpl();
817
+ testSectionExtensions();
818
+ testMisnestedSectionExtensions();
819
+ testNestedSection();
820
+ testShootOutString();
821
+ testShootOutReplace();
822
+ testShootOutArray();
823
+ testShootOutObject();
824
+ testShootOutPartial();
825
+ testShootOutRecurse();
826
+ testShootOutFilter();
827
+ testShootOutComplex();
828
+ testDottedNames();
829
+ testImplicitIterator();
830
+ testPartialsAndDelimiters();
831
+ testStringPartials();
832
+ testMissingPartials();
833
+ testIndentedStandaloneComment();
834
+ testNewLineBetweenDelimiterChanges();
835
+ testMustacheJSApostrophe();
836
+ testMustacheJSArrayOfImplicitPartials();
837
+ testMustacheJSArrayOfPartials();
838
+ testMustacheJSArrayOfStrings();
839
+ testMustacheJSUndefinedString();
840
+ testMustacheJSTripleStacheAltDelimiter();
841
+ complete();
842
+ }
843
+
844
+ if (doc) {
845
+ window.onload = runTests;
846
+ } else {
847
+ runTests();
848
+ }