sass-twitter-bootstrap 0.1.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. data/lib/{sass-twitter-bootstrap.rb → sass/twitter/bootstrap.rb} +1 -1
  2. data/lib/sass/twitter/bootstrap/rails.rb +1 -5
  3. data/lib/sass/twitter/bootstrap/rails/engine.rb +12 -0
  4. data/lib/sass/twitter/bootstrap/version.rb +1 -1
  5. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  6. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  7. data/vendor/assets/javascripts/twitter/bootstrap-alert.js +32 -28
  8. data/vendor/assets/javascripts/twitter/bootstrap-button.js +33 -29
  9. data/vendor/assets/javascripts/twitter/bootstrap-carousel.js +21 -33
  10. data/vendor/assets/javascripts/twitter/bootstrap-collapse.js +26 -47
  11. data/vendor/assets/javascripts/twitter/bootstrap-dropdown.js +10 -18
  12. data/vendor/assets/javascripts/twitter/bootstrap-modal.js +17 -25
  13. data/vendor/assets/javascripts/twitter/bootstrap-popover.js +10 -13
  14. data/vendor/assets/javascripts/twitter/bootstrap-scrollspy.js +18 -44
  15. data/vendor/assets/javascripts/twitter/bootstrap-tab.js +7 -12
  16. data/vendor/assets/javascripts/twitter/bootstrap-tooltip.js +35 -40
  17. data/vendor/assets/javascripts/twitter/bootstrap-transition.js +20 -30
  18. data/vendor/assets/javascripts/twitter/bootstrap-typeahead.js +15 -29
  19. data/vendor/assets/stylesheets/tests/buttons.html +139 -0
  20. data/vendor/assets/stylesheets/tests/css-tests.css +99 -1
  21. data/vendor/assets/stylesheets/tests/css-tests.html +519 -37
  22. data/vendor/assets/stylesheets/tests/forms-responsive.html +71 -0
  23. data/vendor/assets/stylesheets/tests/navbar-fixed-top.html +104 -0
  24. data/vendor/assets/stylesheets/tests/navbar-static-top.html +107 -0
  25. data/vendor/assets/stylesheets/tests/navbar.html +38 -39
  26. data/vendor/assets/stylesheets/twitter/_accordion.scss +0 -5
  27. data/vendor/assets/stylesheets/twitter/_alerts.scss +15 -3
  28. data/vendor/assets/stylesheets/twitter/_breadcrumbs.scss +0 -2
  29. data/vendor/assets/stylesheets/twitter/_button-groups.scss +32 -76
  30. data/vendor/assets/stylesheets/twitter/_buttons.scss +25 -33
  31. data/vendor/assets/stylesheets/twitter/_close.scss +1 -12
  32. data/vendor/assets/stylesheets/twitter/_code.scss +8 -8
  33. data/vendor/assets/stylesheets/twitter/_component-animations.scss +7 -9
  34. data/vendor/assets/stylesheets/twitter/_dropdowns.scss +45 -58
  35. data/vendor/assets/stylesheets/twitter/_forms.scss +146 -206
  36. data/vendor/assets/stylesheets/twitter/_grid.scss +5 -2
  37. data/vendor/assets/stylesheets/twitter/_hero-unit.scss +1 -3
  38. data/vendor/assets/stylesheets/twitter/_labels.scss +32 -0
  39. data/vendor/assets/stylesheets/twitter/_layouts.scss +2 -2
  40. data/vendor/assets/stylesheets/twitter/_mixins.scss +208 -273
  41. data/vendor/assets/stylesheets/twitter/_modals.scss +8 -14
  42. data/vendor/assets/stylesheets/twitter/_navbar.scss +73 -132
  43. data/vendor/assets/stylesheets/twitter/_navs.scss +43 -53
  44. data/vendor/assets/stylesheets/twitter/_pager.scss +0 -6
  45. data/vendor/assets/stylesheets/twitter/_pagination.scss +0 -1
  46. data/vendor/assets/stylesheets/twitter/_progress-bars.scss +6 -28
  47. data/vendor/assets/stylesheets/twitter/_reset.scss +4 -9
  48. data/vendor/assets/stylesheets/twitter/_scaffolding.scss +8 -4
  49. data/vendor/assets/stylesheets/twitter/_sprites.scss +7 -40
  50. data/vendor/assets/stylesheets/twitter/_tables.scss +33 -38
  51. data/vendor/assets/stylesheets/twitter/_thumbnails.scss +2 -14
  52. data/vendor/assets/stylesheets/twitter/_tooltip.scss +1 -1
  53. data/vendor/assets/stylesheets/twitter/_type.scss +14 -28
  54. data/vendor/assets/stylesheets/twitter/_variables.scss +19 -116
  55. data/vendor/assets/stylesheets/twitter/_wells.scss +0 -10
  56. data/vendor/assets/stylesheets/twitter/bootstrap.scss +7 -3
  57. data/vendor/assets/stylesheets/twitter/responsive.scss +301 -15
  58. metadata +25 -190
  59. data/.gitignore +0 -4
  60. data/Gemfile +0 -3
  61. data/Gemfile.lock +0 -14
  62. data/LICENSE +0 -176
  63. data/Makefile +0 -94
  64. data/README.md +0 -217
  65. data/Rakefile +0 -52
  66. data/bootstrap-2.0.4.css +0 -4661
  67. data/bootstrap-2.0.4.min.css +0 -9
  68. data/bootstrap-responsive-2.0.4.css +0 -932
  69. data/bootstrap-responsive-2.0.4.min.css +0 -9
  70. data/docs/assets/css/bootstrap-responsive.css +0 -932
  71. data/docs/assets/css/bootstrap.css +0 -4661
  72. data/docs/assets/css/docs.css +0 -846
  73. data/docs/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
  74. data/docs/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
  75. data/docs/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
  76. data/docs/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
  77. data/docs/assets/ico/favicon.ico +0 -0
  78. data/docs/assets/img/bird.png +0 -0
  79. data/docs/assets/img/bootstrap-mdo-sfmoma-01.jpg +0 -0
  80. data/docs/assets/img/bootstrap-mdo-sfmoma-02.jpg +0 -0
  81. data/docs/assets/img/bootstrap-mdo-sfmoma-03.jpg +0 -0
  82. data/docs/assets/img/browsers.png +0 -0
  83. data/docs/assets/img/example-sites/fleetio.png +0 -0
  84. data/docs/assets/img/example-sites/jshint.png +0 -0
  85. data/docs/assets/img/example-sites/kippt.png +0 -0
  86. data/docs/assets/img/example-sites/soundready.png +0 -0
  87. data/docs/assets/img/examples/bootstrap-example-fluid.jpg +0 -0
  88. data/docs/assets/img/examples/bootstrap-example-hero.jpg +0 -0
  89. data/docs/assets/img/examples/bootstrap-example-starter.jpg +0 -0
  90. data/docs/assets/img/github-16px.png +0 -0
  91. data/docs/assets/img/glyphicons-halflings-white.png +0 -0
  92. data/docs/assets/img/glyphicons-halflings.png +0 -0
  93. data/docs/assets/img/glyphicons/glyphicons_009_magic.png +0 -0
  94. data/docs/assets/img/glyphicons/glyphicons_042_group.png +0 -0
  95. data/docs/assets/img/glyphicons/glyphicons_079_podium.png +0 -0
  96. data/docs/assets/img/glyphicons/glyphicons_082_roundabout.png +0 -0
  97. data/docs/assets/img/glyphicons/glyphicons_155_show_thumbnails.png +0 -0
  98. data/docs/assets/img/glyphicons/glyphicons_163_iphone.png +0 -0
  99. data/docs/assets/img/glyphicons/glyphicons_214_resize_small.png +0 -0
  100. data/docs/assets/img/glyphicons/glyphicons_266_book_open.png +0 -0
  101. data/docs/assets/img/grid-18px-masked.png +0 -0
  102. data/docs/assets/img/icon-css3.png +0 -0
  103. data/docs/assets/img/icon-github.png +0 -0
  104. data/docs/assets/img/icon-html5.png +0 -0
  105. data/docs/assets/img/icon-twitter.png +0 -0
  106. data/docs/assets/img/less-logo-large.png +0 -0
  107. data/docs/assets/img/less-small.png +0 -0
  108. data/docs/assets/img/responsive-illustrations.png +0 -0
  109. data/docs/assets/js/README.md +0 -106
  110. data/docs/assets/js/application.js +0 -184
  111. data/docs/assets/js/bootstrap-alert.js +0 -90
  112. data/docs/assets/js/bootstrap-button.js +0 -96
  113. data/docs/assets/js/bootstrap-carousel.js +0 -169
  114. data/docs/assets/js/bootstrap-collapse.js +0 -157
  115. data/docs/assets/js/bootstrap-dropdown.js +0 -100
  116. data/docs/assets/js/bootstrap-modal.js +0 -218
  117. data/docs/assets/js/bootstrap-popover.js +0 -98
  118. data/docs/assets/js/bootstrap-scrollspy.js +0 -151
  119. data/docs/assets/js/bootstrap-tab.js +0 -135
  120. data/docs/assets/js/bootstrap-tooltip.js +0 -275
  121. data/docs/assets/js/bootstrap-transition.js +0 -61
  122. data/docs/assets/js/bootstrap-typeahead.js +0 -285
  123. data/docs/assets/js/bootstrap.js +0 -1825
  124. data/docs/assets/js/bootstrap.min.js +0 -6
  125. data/docs/assets/js/google-code-prettify/prettify.css +0 -30
  126. data/docs/assets/js/google-code-prettify/prettify.js +0 -28
  127. data/docs/assets/js/jquery.js +0 -9252
  128. data/docs/base-css.html +0 -1710
  129. data/docs/build/index.js +0 -44
  130. data/docs/build/node_modules/.bin/hulk +0 -93
  131. data/docs/build/node_modules/hogan.js/.git_ignore +0 -1
  132. data/docs/build/node_modules/hogan.js/.gitmodules +0 -3
  133. data/docs/build/node_modules/hogan.js/LICENSE +0 -177
  134. data/docs/build/node_modules/hogan.js/Makefile +0 -62
  135. data/docs/build/node_modules/hogan.js/README.md +0 -93
  136. data/docs/build/node_modules/hogan.js/bin/hulk +0 -93
  137. data/docs/build/node_modules/hogan.js/lib/compiler.js +0 -348
  138. data/docs/build/node_modules/hogan.js/lib/hogan.js +0 -20
  139. data/docs/build/node_modules/hogan.js/lib/template.js +0 -233
  140. data/docs/build/node_modules/hogan.js/package.json +0 -20
  141. data/docs/build/node_modules/hogan.js/test/html/list.html +0 -8
  142. data/docs/build/node_modules/hogan.js/test/index.html +0 -13
  143. data/docs/build/node_modules/hogan.js/test/index.js +0 -848
  144. data/docs/build/node_modules/hogan.js/test/mustache.js +0 -90
  145. data/docs/build/node_modules/hogan.js/test/spec.js +0 -77
  146. data/docs/build/node_modules/hogan.js/test/spec/Changes +0 -31
  147. data/docs/build/node_modules/hogan.js/test/spec/README.md +0 -65
  148. data/docs/build/node_modules/hogan.js/test/spec/Rakefile +0 -27
  149. data/docs/build/node_modules/hogan.js/test/spec/TESTING.md +0 -46
  150. data/docs/build/node_modules/hogan.js/test/spec/specs/comments.json +0 -1
  151. data/docs/build/node_modules/hogan.js/test/spec/specs/comments.yml +0 -103
  152. data/docs/build/node_modules/hogan.js/test/spec/specs/delimiters.json +0 -1
  153. data/docs/build/node_modules/hogan.js/test/spec/specs/delimiters.yml +0 -158
  154. data/docs/build/node_modules/hogan.js/test/spec/specs/interpolation.json +0 -1
  155. data/docs/build/node_modules/hogan.js/test/spec/specs/interpolation.yml +0 -230
  156. data/docs/build/node_modules/hogan.js/test/spec/specs/inverted.json +0 -1
  157. data/docs/build/node_modules/hogan.js/test/spec/specs/inverted.yml +0 -193
  158. data/docs/build/node_modules/hogan.js/test/spec/specs/partials.json +0 -1
  159. data/docs/build/node_modules/hogan.js/test/spec/specs/partials.yml +0 -109
  160. data/docs/build/node_modules/hogan.js/test/spec/specs/sections.json +0 -1
  161. data/docs/build/node_modules/hogan.js/test/spec/specs/sections.yml +0 -256
  162. data/docs/build/node_modules/hogan.js/test/spec/specs/~lambdas.json +0 -1
  163. data/docs/build/node_modules/hogan.js/test/spec/specs/~lambdas.yml +0 -149
  164. data/docs/build/node_modules/hogan.js/test/templates/list.mustache +0 -8
  165. data/docs/build/node_modules/hogan.js/tools/release.js +0 -74
  166. data/docs/build/node_modules/hogan.js/tools/web_templates.js +0 -32
  167. data/docs/build/node_modules/hogan.js/web/1.0.0/hogan.js +0 -500
  168. data/docs/build/node_modules/hogan.js/web/1.0.0/hogan.min.js +0 -14
  169. data/docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.js +0 -500
  170. data/docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.min.js +0 -14
  171. data/docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.js +0 -545
  172. data/docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.min.js +0 -5
  173. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.amd.js +0 -576
  174. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.common.js +0 -576
  175. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.js +0 -572
  176. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.amd.js +0 -5
  177. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.common.js +0 -5
  178. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.js +0 -5
  179. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.mustache.js +0 -5
  180. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.mustache.js +0 -619
  181. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.js +0 -233
  182. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.min.js +0 -5
  183. data/docs/build/node_modules/hogan.js/web/favicon.ico +0 -0
  184. data/docs/build/node_modules/hogan.js/web/images/logo.png +0 -0
  185. data/docs/build/node_modules/hogan.js/web/images/noise.png +0 -0
  186. data/docs/build/node_modules/hogan.js/web/images/small-hogan-icon.png +0 -0
  187. data/docs/build/node_modules/hogan.js/web/images/stripes.png +0 -0
  188. data/docs/build/node_modules/hogan.js/web/index.html.mustache +0 -139
  189. data/docs/build/node_modules/hogan.js/web/stylesheets/layout.css +0 -206
  190. data/docs/build/node_modules/hogan.js/web/stylesheets/skeleton.css +0 -236
  191. data/docs/build/node_modules/hogan.js/wrappers/amd.js.mustache +0 -21
  192. data/docs/build/node_modules/hogan.js/wrappers/common.js.mustache +0 -21
  193. data/docs/build/node_modules/hogan.js/wrappers/js.mustache +0 -17
  194. data/docs/build/node_modules/hogan.js/wrappers/mustache.js.mustache +0 -64
  195. data/docs/build/package.json +0 -6
  196. data/docs/components.html +0 -1931
  197. data/docs/download.html +0 -454
  198. data/docs/examples.html +0 -147
  199. data/docs/examples/fluid.html +0 -162
  200. data/docs/examples/hero.html +0 -109
  201. data/docs/examples/starter-template.html +0 -79
  202. data/docs/index.html +0 -259
  203. data/docs/javascript.html +0 -1520
  204. data/docs/less.html +0 -1060
  205. data/docs/scaffolding.html +0 -671
  206. data/docs/templates/layout.mustache +0 -146
  207. data/docs/templates/pages/base-css.mustache +0 -1594
  208. data/docs/templates/pages/components.mustache +0 -1815
  209. data/docs/templates/pages/download.mustache +0 -338
  210. data/docs/templates/pages/examples.mustache +0 -31
  211. data/docs/templates/pages/index.mustache +0 -144
  212. data/docs/templates/pages/javascript.mustache +0 -1405
  213. data/docs/templates/pages/less.mustache +0 -944
  214. data/docs/templates/pages/scaffolding.mustache +0 -555
  215. data/docs/templates/pages/upgrading.mustache +0 -194
  216. data/docs/upgrading.html +0 -310
  217. data/js/tests/index.html +0 -54
  218. data/js/tests/phantom.js +0 -63
  219. data/js/tests/server.js +0 -14
  220. data/js/tests/unit/bootstrap-alert.js +0 -56
  221. data/js/tests/unit/bootstrap-button.js +0 -77
  222. data/js/tests/unit/bootstrap-carousel.js +0 -28
  223. data/js/tests/unit/bootstrap-collapse.js +0 -54
  224. data/js/tests/unit/bootstrap-dropdown.js +0 -87
  225. data/js/tests/unit/bootstrap-modal.js +0 -114
  226. data/js/tests/unit/bootstrap-phantom.js +0 -21
  227. data/js/tests/unit/bootstrap-popover.js +0 -93
  228. data/js/tests/unit/bootstrap-scrollspy.js +0 -31
  229. data/js/tests/unit/bootstrap-tab.js +0 -61
  230. data/js/tests/unit/bootstrap-tooltip.js +0 -155
  231. data/js/tests/unit/bootstrap-transition.js +0 -13
  232. data/js/tests/unit/bootstrap-typeahead.js +0 -148
  233. data/js/tests/vendor/jquery.js +0 -9252
  234. data/js/tests/vendor/qunit.css +0 -232
  235. data/js/tests/vendor/qunit.js +0 -1510
  236. data/package.json +0 -25
  237. data/sass-twitter-bootstrap.gemspec +0 -19
  238. data/vendor/assets/javascripts/README.md +0 -112
  239. data/vendor/assets/javascripts/twitter/bootstrap.js +0 -12
  240. data/vendor/assets/stylesheets/twitter/_labels-badges.scss +0 -52
  241. data/vendor/assets/stylesheets/twitter/_responsive-1200px-min.scss +0 -26
  242. data/vendor/assets/stylesheets/twitter/_responsive-767px-max.scss +0 -149
  243. data/vendor/assets/stylesheets/twitter/_responsive-768px-979px.scss +0 -17
  244. data/vendor/assets/stylesheets/twitter/_responsive-navbar.scss +0 -153
  245. data/vendor/assets/stylesheets/twitter/_responsive-utilities.scss +0 -41
@@ -1,5 +0,0 @@
1
- /**
2
- * @preserve Copyright 2012 Twitter, Inc.
3
- * @license http://www.apache.org/licenses/LICENSE-2.0.txt
4
- */
5
- var HoganTemplate=function(){function a(a){this.text=a}function h(a){return a=String(a===null?"":a),g.test(a)?a.replace(b,"&amp;").replace(c,"&lt;").replace(d,"&gt;").replace(e,"&#39;").replace(f,"&quot;"):a}a.prototype={r:function(a,b,c){return""},v:h,render:function(b,c,d){return this.r(b,c,d)},rp:function(a,b,c,d){var e=c[a];return e?e.r(b,c,d):""},rs:function(a,b,c){var d="",e=a[a.length-1];if(!i(e))return d=c(a,b);for(var f=0;f<e.length;f++)a.push(e[f]),d+=c(a,b),a.pop();return d},s:function(a,b,c,d,e,f,g){var h;return i(a)&&a.length===0?!1:(!d&&typeof a=="function"&&(a=this.ls(a,b,c,e,f,g)),h=a===""||!!a,!d&&h&&b&&b.push(typeof a=="object"?a:b[b.length-1]),h)},d:function(a,b,c,d){var e=a.split("."),f=this.f(e[0],b,c,d),g=null;if(a==="."&&i(b[b.length-2]))return b[b.length-1];for(var h=1;h<e.length;h++)f&&typeof f=="object"&&e[h]in f?(g=f,f=f[e[h]]):f="";return d&&!f?!1:(!d&&typeof f=="function"&&(b.push(g),f=this.lv(f,b,c),b.pop()),f)},f:function(a,b,c,d){var e=!1,f=null,g=!1;for(var h=b.length-1;h>=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=a.call(b,d,function(a){return Hogan.compile(a,{delimiters:e}).render(b,c)}),g=Hogan.compile(f.toString(),{delimiters:e}).render(b,c);return this.b=g,!1},b:"",ls:function(a,b,c,d,e,f){var g=b[b.length-1],h=a.call(g);return a.length>0?this.ho(a,g,c,this.text.substring(d,e),f):typeof h=="function"?this.ho(h,g,c,this.text.substring(d,e),f):h},lv:function(a,b,c){var d=b[b.length-1];return Hogan.compile(a.call(d).toString()).render(d,c)}};var b=/&/g,c=/</g,d=/>/g,e=/\'/g,f=/\"/g,g=/[&<>\"\']/,i=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"};return a}(),Hogan=function(){function g(b,c){function u(){n.length>0&&(o.push(new String(n)),n="")}function v(){var b=!0;for(var c=r;c<o.length;c++){b=o[c].tag&&f[o[c].tag]<f._v||!o[c].tag&&o[c].match(a)===null;if(!b)return!1}return b}function w(a,b){u();if(a&&v())for(var c=r,d;c<o.length;c++)o[c].tag||((d=o[c+1])&&d.tag==">"&&(d.indent=o[c].toString()),o.splice(c,1));else b||o.push({tag:"\n"});p=!1,r=o.length}function x(a,b){var c="="+t,d=a.indexOf(c,b),e=h(a.substring(a.indexOf("=",b)+1,d)).split(" ");return s=e[0],t=e[1],d+c.length-1}var d=b.length,e=0,g=1,j=2,k=e,l=null,m=null,n="",o=[],p=!1,q=0,r=0,s="{{",t="}}";c&&(c=c.split(" "),s=c[0],t=c[1]);for(q=0;q<d;q++)k==e?i(s,b,q)?(--q,u(),k=g):b.charAt(q)=="\n"?w(p):n+=b.charAt(q):k==g?(q+=s.length-1,m=f[b.charAt(q+1)],l=m?b.charAt(q+1):"_v",l=="="?(q=x(b,q),k=e):(m&&q++,k=j),p=q):i(t,b,q)?(o.push({tag:l,n:h(n),otag:s,ctag:t,i:l=="/"?p-t.length:q+s.length}),n="",q+=t.length-1,k=e,l=="{"&&q++):n+=b.charAt(q);return w(p,!0),o}function h(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function i(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d<e;d++)if(b.charAt(c+d)!=a.charAt(d))return!1;return!0}function j(a,b,c,d){var e=[],f=null,g=null;while(a.length>0){g=a.shift();if(g.tag=="#"||g.tag=="^"||k(g,d))c.push(g),g.nodes=j(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!l(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function k(a,b){for(var c=0,d=b.length;c<d;c++)if(b[c].o==a.n)return a.tag="#",!0}function l(a,b,c){for(var d=0,e=c.length;d<e;d++)if(c[d].c==a&&c[d].o==b)return!0}function m(a,b,c){var d='i = i || "";var c = [cx];var b = i + "";var _ = this;'+p(a)+"return b;";if(c.asString)return"function(cx,p,i){"+d+";}";var e=new HoganTemplate(b);return e.r=new Function("cx","p","i",d),e}function n(a){return a.replace(e,"\\\\").replace(b,'\\"').replace(c,"\\n").replace(d,"\\r")}function o(a){return~a.indexOf(".")?"d":"f"}function p(a){var b="";for(var c=0,d=a.length;c<d;c++){var e=a[c].tag;e=="#"?b+=q(a[c].nodes,a[c].n,o(a[c].n),a[c].i,a[c].end,a[c].otag+" "+a[c].ctag):e=="^"?b+=r(a[c].nodes,a[c].n,o(a[c].n)):e=="<"||e==">"?b+=s(a[c]):e=="{"||e=="&"?b+=t(a[c].n,o(a[c].n)):e=="\n"?b+=v('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=u(a[c].n,o(a[c].n)):e===undefined&&(b+=v('"'+n(a[c])+'"'))}return b}function q(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+n(b)+'",c,p,1),'+"c,p,0,"+d+","+e+', "'+f+'")){'+"b += _.rs(c,p,"+'function(c,p){ var b = "";'+p(a)+"return b;});c.pop();}"+'else{b += _.b; _.b = ""};'}function r(a,b,c){return"if (!_.s(_."+c+'("'+n(b)+'",c,p,1),c,p,1,0,0,"")){'+p(a)+"};"}function s(a){return'b += _.rp("'+n(a.n)+'",c[c.length - 1],p,"'+(a.indent||"")+'");'}function t(a,b){return"b += (_."+b+'("'+n(a)+'",c,p,0));'}function u(a,b){return"b += (_.v(_."+b+'("'+n(a)+'",c,p,0)));'}function v(a){return"b += "+a+";"}var a=/\S/,b=/\"/g,c=/\n/g,d=/\r/g,e=/\\/g,f={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};return{scan:g,parse:function(a,b){return b=b||{},j(a,"",[],b.sectionTags||[])},cache:{},compile:function(a,b){b=b||{};var c=this.cache[a];return c?c:(c=m(this.parse(g(a,b.delimiters),b),a,b),this.cache[a]=c)}}}();typeof module!="undefined"&&module.exports?(module.exports=Hogan,module.exports.Template=HoganTemplate):typeof define=="function"&&define.amd?define(function(){return Hogan}):typeof exports!="undefined"&&(exports.Hogan=Hogan,exports.HoganTemplate=HoganTemplate)
@@ -1,576 +0,0 @@
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
-
17
-
18
- var Hogan = {};
19
-
20
- (function (Hogan) {
21
- Hogan.Template = function constructor(renderFunc, text, compiler) {
22
- if (renderFunc) {
23
- this.r = renderFunc;
24
- }
25
- this.c = compiler;
26
- this.text = text || '';
27
- }
28
-
29
- Hogan.Template.prototype = {
30
- // render: replaced by generated code.
31
- r: function (context, partials, indent) { return ''; },
32
-
33
- // variable escaping
34
- v: hoganEscape,
35
-
36
- render: function render(context, partials, indent) {
37
- return this.ri([context], partials || {}, indent);
38
- },
39
-
40
- // render internal -- a hook for overrides that catches partials too
41
- ri: function (context, partials, indent) {
42
- return this.r(context, partials, indent);
43
- },
44
-
45
- // tries to find a partial in the curent scope and render it
46
- rp: function(name, context, partials, indent) {
47
- var partial = partials[name];
48
-
49
- if (!partial) {
50
- return '';
51
- }
52
-
53
- if (this.c && typeof partial == 'string') {
54
- partial = this.c.compile(partial);
55
- }
56
-
57
- return partial.ri(context, partials, indent);
58
- },
59
-
60
- // render a section
61
- rs: function(context, partials, section) {
62
- var buf = '',
63
- tail = context[context.length - 1];
64
-
65
- if (!isArray(tail)) {
66
- return buf = section(context, partials);
67
- }
68
-
69
- for (var i = 0; i < tail.length; i++) {
70
- context.push(tail[i]);
71
- buf += section(context, partials);
72
- context.pop();
73
- }
74
-
75
- return buf;
76
- },
77
-
78
- // maybe start a section
79
- s: function(val, ctx, partials, inverted, start, end, tags) {
80
- var pass;
81
-
82
- if (isArray(val) && val.length === 0) {
83
- return false;
84
- }
85
-
86
- if (typeof val == 'function') {
87
- val = this.ls(val, ctx, partials, inverted, start, end, tags);
88
- }
89
-
90
- pass = (val === '') || !!val;
91
-
92
- if (!inverted && pass && ctx) {
93
- ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
94
- }
95
-
96
- return pass;
97
- },
98
-
99
- // find values with dotted names
100
- d: function(key, ctx, partials, returnFound) {
101
- var names = key.split('.'),
102
- val = this.f(names[0], ctx, partials, returnFound),
103
- cx = null;
104
-
105
- if (key === '.' && isArray(ctx[ctx.length - 2])) {
106
- return ctx[ctx.length - 1];
107
- }
108
-
109
- for (var i = 1; i < names.length; i++) {
110
- if (val && typeof val == 'object' && names[i] in val) {
111
- cx = val;
112
- val = val[names[i]];
113
- } else {
114
- val = '';
115
- }
116
- }
117
-
118
- if (returnFound && !val) {
119
- return false;
120
- }
121
-
122
- if (!returnFound && typeof val == 'function') {
123
- ctx.push(cx);
124
- val = this.lv(val, ctx, partials);
125
- ctx.pop();
126
- }
127
-
128
- return val;
129
- },
130
-
131
- // find values with normal names
132
- f: function(key, ctx, partials, returnFound) {
133
- var val = false,
134
- v = null,
135
- found = false;
136
-
137
- for (var i = ctx.length - 1; i >= 0; i--) {
138
- v = ctx[i];
139
- if (v && typeof v == 'object' && key in v) {
140
- val = v[key];
141
- found = true;
142
- break;
143
- }
144
- }
145
-
146
- if (!found) {
147
- return (returnFound) ? false : "";
148
- }
149
-
150
- if (!returnFound && typeof val == 'function') {
151
- val = this.lv(val, ctx, partials);
152
- }
153
-
154
- return val;
155
- },
156
-
157
- // higher order templates
158
- ho: function(val, cx, partials, text, tags) {
159
- var compiler = this.c;
160
- var t = val.call(cx, text, function(t) {
161
- return compiler.compile(t, {delimiters: tags}).render(cx, partials);
162
- });
163
- var s = compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials);
164
- this.b = s;
165
- return false;
166
- },
167
-
168
- // higher order template result buffer
169
- b: '',
170
-
171
- // lambda replace section
172
- ls: function(val, ctx, partials, inverted, start, end, tags) {
173
- var cx = ctx[ctx.length - 1],
174
- t = null;
175
-
176
- if (!inverted && this.c && val.length > 0) {
177
- return this.ho(val, cx, partials, this.text.substring(start, end), tags);
178
- }
179
-
180
- t = val.call(cx);
181
-
182
- if (typeof t == 'function') {
183
- if (inverted) {
184
- return true;
185
- } else if (this.c) {
186
- return this.ho(t, cx, partials, this.text.substring(start, end), tags);
187
- }
188
- }
189
-
190
- return t;
191
- },
192
-
193
- // lambda replace variable
194
- lv: function(val, ctx, partials) {
195
- var cx = ctx[ctx.length - 1];
196
- var result = val.call(cx);
197
- if (typeof result == 'function') {
198
- result = result.call(cx);
199
- }
200
- result = result.toString();
201
-
202
- if (this.c && ~result.indexOf("{{")) {
203
- return this.c.compile(result).render(cx, partials);
204
- }
205
-
206
- return result;
207
- }
208
-
209
- };
210
-
211
- var rAmp = /&/g,
212
- rLt = /</g,
213
- rGt = />/g,
214
- rApos =/\'/g,
215
- rQuot = /\"/g,
216
- hChars =/[&<>\"\']/;
217
-
218
- function hoganEscape(str) {
219
- str = String((str === null || str === undefined) ? '' : str);
220
- return hChars.test(str) ?
221
- str
222
- .replace(rAmp,'&amp;')
223
- .replace(rLt,'&lt;')
224
- .replace(rGt,'&gt;')
225
- .replace(rApos,'&#39;')
226
- .replace(rQuot, '&quot;') :
227
- str;
228
- }
229
-
230
- var isArray = Array.isArray || function(a) {
231
- return Object.prototype.toString.call(a) === '[object Array]';
232
- };
233
-
234
- })(typeof exports !== 'undefined' ? exports : Hogan);
235
-
236
-
237
-
238
-
239
- (function (Hogan) {
240
- // Setup regex assignments
241
- // remove whitespace according to Mustache spec
242
- var rIsWhitespace = /\S/,
243
- rQuot = /\"/g,
244
- rNewline = /\n/g,
245
- rCr = /\r/g,
246
- rSlash = /\\/g,
247
- tagTypes = {
248
- '#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
249
- '<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
250
- };
251
-
252
- Hogan.scan = function scan(text, delimiters) {
253
- var len = text.length,
254
- IN_TEXT = 0,
255
- IN_TAG_TYPE = 1,
256
- IN_TAG = 2,
257
- state = IN_TEXT,
258
- tagType = null,
259
- tag = null,
260
- buf = '',
261
- tokens = [],
262
- seenTag = false,
263
- i = 0,
264
- lineStart = 0,
265
- otag = '{{',
266
- ctag = '}}';
267
-
268
- function addBuf() {
269
- if (buf.length > 0) {
270
- tokens.push(new String(buf));
271
- buf = '';
272
- }
273
- }
274
-
275
- function lineIsWhitespace() {
276
- var isAllWhitespace = true;
277
- for (var j = lineStart; j < tokens.length; j++) {
278
- isAllWhitespace =
279
- (tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
280
- (!tokens[j].tag && tokens[j].match(rIsWhitespace) === null);
281
- if (!isAllWhitespace) {
282
- return false;
283
- }
284
- }
285
-
286
- return isAllWhitespace;
287
- }
288
-
289
- function filterLine(haveSeenTag, noNewLine) {
290
- addBuf();
291
-
292
- if (haveSeenTag && lineIsWhitespace()) {
293
- for (var j = lineStart, next; j < tokens.length; j++) {
294
- if (!tokens[j].tag) {
295
- if ((next = tokens[j+1]) && next.tag == '>') {
296
- // set indent to token value
297
- next.indent = tokens[j].toString()
298
- }
299
- tokens.splice(j, 1);
300
- }
301
- }
302
- } else if (!noNewLine) {
303
- tokens.push({tag:'\n'});
304
- }
305
-
306
- seenTag = false;
307
- lineStart = tokens.length;
308
- }
309
-
310
- function changeDelimiters(text, index) {
311
- var close = '=' + ctag,
312
- closeIndex = text.indexOf(close, index),
313
- delimiters = trim(
314
- text.substring(text.indexOf('=', index) + 1, closeIndex)
315
- ).split(' ');
316
-
317
- otag = delimiters[0];
318
- ctag = delimiters[1];
319
-
320
- return closeIndex + close.length - 1;
321
- }
322
-
323
- if (delimiters) {
324
- delimiters = delimiters.split(' ');
325
- otag = delimiters[0];
326
- ctag = delimiters[1];
327
- }
328
-
329
- for (i = 0; i < len; i++) {
330
- if (state == IN_TEXT) {
331
- if (tagChange(otag, text, i)) {
332
- --i;
333
- addBuf();
334
- state = IN_TAG_TYPE;
335
- } else {
336
- if (text.charAt(i) == '\n') {
337
- filterLine(seenTag);
338
- } else {
339
- buf += text.charAt(i);
340
- }
341
- }
342
- } else if (state == IN_TAG_TYPE) {
343
- i += otag.length - 1;
344
- tag = tagTypes[text.charAt(i + 1)];
345
- tagType = tag ? text.charAt(i + 1) : '_v';
346
- if (tagType == '=') {
347
- i = changeDelimiters(text, i);
348
- state = IN_TEXT;
349
- } else {
350
- if (tag) {
351
- i++;
352
- }
353
- state = IN_TAG;
354
- }
355
- seenTag = i;
356
- } else {
357
- if (tagChange(ctag, text, i)) {
358
- tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
359
- i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
360
- buf = '';
361
- i += ctag.length - 1;
362
- state = IN_TEXT;
363
- if (tagType == '{') {
364
- if (ctag == '}}') {
365
- i++;
366
- } else {
367
- cleanTripleStache(tokens[tokens.length - 1]);
368
- }
369
- }
370
- } else {
371
- buf += text.charAt(i);
372
- }
373
- }
374
- }
375
-
376
- filterLine(seenTag, true);
377
-
378
- return tokens;
379
- }
380
-
381
- function cleanTripleStache(token) {
382
- if (token.n.substr(token.n.length - 1) === '}') {
383
- token.n = token.n.substring(0, token.n.length - 1);
384
- }
385
- }
386
-
387
- function trim(s) {
388
- if (s.trim) {
389
- return s.trim();
390
- }
391
-
392
- return s.replace(/^\s*|\s*$/g, '');
393
- }
394
-
395
- function tagChange(tag, text, index) {
396
- if (text.charAt(index) != tag.charAt(0)) {
397
- return false;
398
- }
399
-
400
- for (var i = 1, l = tag.length; i < l; i++) {
401
- if (text.charAt(index + i) != tag.charAt(i)) {
402
- return false;
403
- }
404
- }
405
-
406
- return true;
407
- }
408
-
409
- function buildTree(tokens, kind, stack, customTags) {
410
- var instructions = [],
411
- opener = null,
412
- token = null;
413
-
414
- while (tokens.length > 0) {
415
- token = tokens.shift();
416
- if (token.tag == '#' || token.tag == '^' || isOpener(token, customTags)) {
417
- stack.push(token);
418
- token.nodes = buildTree(tokens, token.tag, stack, customTags);
419
- instructions.push(token);
420
- } else if (token.tag == '/') {
421
- if (stack.length === 0) {
422
- throw new Error('Closing tag without opener: /' + token.n);
423
- }
424
- opener = stack.pop();
425
- if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
426
- throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
427
- }
428
- opener.end = token.i;
429
- return instructions;
430
- } else {
431
- instructions.push(token);
432
- }
433
- }
434
-
435
- if (stack.length > 0) {
436
- throw new Error('missing closing tag: ' + stack.pop().n);
437
- }
438
-
439
- return instructions;
440
- }
441
-
442
- function isOpener(token, tags) {
443
- for (var i = 0, l = tags.length; i < l; i++) {
444
- if (tags[i].o == token.n) {
445
- token.tag = '#';
446
- return true;
447
- }
448
- }
449
- }
450
-
451
- function isCloser(close, open, tags) {
452
- for (var i = 0, l = tags.length; i < l; i++) {
453
- if (tags[i].c == close && tags[i].o == open) {
454
- return true;
455
- }
456
- }
457
- }
458
-
459
- function writeCode(tree) {
460
- return 'i = i || "";var b = i + "";var _ = this;' + walk(tree) + 'return b;';
461
- }
462
-
463
- Hogan.generate = function (code, text, options) {
464
- if (options.asString) {
465
- return 'function(c,p,i){' + code + ';}';
466
- }
467
-
468
- return new Hogan.Template(new Function('c', 'p', 'i', code), text, Hogan);
469
- }
470
-
471
- function esc(s) {
472
- return s.replace(rSlash, '\\\\')
473
- .replace(rQuot, '\\\"')
474
- .replace(rNewline, '\\n')
475
- .replace(rCr, '\\r');
476
- }
477
-
478
- function chooseMethod(s) {
479
- return (~s.indexOf('.')) ? 'd' : 'f';
480
- }
481
-
482
- function walk(tree) {
483
- var code = '';
484
- for (var i = 0, l = tree.length; i < l; i++) {
485
- var tag = tree[i].tag;
486
- if (tag == '#') {
487
- code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
488
- tree[i].i, tree[i].end, tree[i].otag + " " + tree[i].ctag);
489
- } else if (tag == '^') {
490
- code += invertedSection(tree[i].nodes, tree[i].n,
491
- chooseMethod(tree[i].n));
492
- } else if (tag == '<' || tag == '>') {
493
- code += partial(tree[i]);
494
- } else if (tag == '{' || tag == '&') {
495
- code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
496
- } else if (tag == '\n') {
497
- code += text('"\\n"' + (tree.length-1 == i ? '' : ' + i'));
498
- } else if (tag == '_v') {
499
- code += variable(tree[i].n, chooseMethod(tree[i].n));
500
- } else if (tag === undefined) {
501
- code += text('"' + esc(tree[i]) + '"');
502
- }
503
- }
504
- return code;
505
- }
506
-
507
- function section(nodes, id, method, start, end, tags) {
508
- return 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),' +
509
- 'c,p,0,' + start + ',' + end + ', "' + tags + '")){' +
510
- 'b += _.rs(c,p,' +
511
- 'function(c,p){ var b = "";' +
512
- walk(nodes) +
513
- 'return b;});c.pop();}' +
514
- 'else{b += _.b; _.b = ""};';
515
- }
516
-
517
- function invertedSection(nodes, id, method) {
518
- return 'if (!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0,"")){' +
519
- walk(nodes) +
520
- '};';
521
- }
522
-
523
- function partial(tok) {
524
- return 'b += _.rp("' + esc(tok.n) + '",c,p,"' + (tok.indent || '') + '");';
525
- }
526
-
527
- function tripleStache(id, method) {
528
- return 'b += (_.' + method + '("' + esc(id) + '",c,p,0));';
529
- }
530
-
531
- function variable(id, method) {
532
- return 'b += (_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
533
- }
534
-
535
- function text(id) {
536
- return 'b += ' + id + ';';
537
- }
538
-
539
- Hogan.parse = function(tokens, options) {
540
- options = options || {};
541
- return buildTree(tokens, '', [], options.sectionTags || []);
542
- },
543
-
544
- Hogan.cache = {};
545
-
546
- Hogan.compile = function(text, options) {
547
- // options
548
- //
549
- // asString: false (default)
550
- //
551
- // sectionTags: [{o: '_foo', c: 'foo'}]
552
- // An array of object with o and c fields that indicate names for custom
553
- // section tags. The example above allows parsing of {{_foo}}{{/foo}}.
554
- //
555
- // delimiters: A string that overrides the default delimiters.
556
- // Example: "<% %>"
557
- //
558
- options = options || {};
559
-
560
- var key = text + '||' + !!options.asString;
561
-
562
- var t = this.cache[key];
563
-
564
- if (t) {
565
- return t;
566
- }
567
-
568
- t = this.generate(writeCode(this.parse(this.scan(text, options.delimiters), options)), text, options);
569
- return this.cache[key] = t;
570
- };
571
- })(typeof exports !== 'undefined' ? exports : Hogan);
572
-
573
-
574
- if (typeof define === 'function' && define.amd) {
575
- define(Hogan);
576
- }