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 +0,0 @@
1
- {"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Partial tags are used to expand an external template into the current\ntemplate.\n\nThe tag's content MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter.\n\nThis tag's content names the partial to inject. Set Delimiter tags MUST NOT\naffect the parsing of a partial. The partial MUST be rendered against the\ncontext stack local to the tag. If the named partial cannot be found, the\nempty string SHOULD be used instead, as in interpolations.\n\nPartial tags SHOULD be treated as standalone when appropriate. If this tag\nis used standalone, any whitespace preceding the tag should treated as\nindentation, and prepended to each line of the partial before rendering.\n","tests":[{"name":"Basic Behavior","data":{},"expected":"\"from partial\"","template":"\"{{>text}}\"","desc":"The greater-than operator should expand to the named partial.","partials":{"text":"from partial"}},{"name":"Failed Lookup","data":{},"expected":"\"\"","template":"\"{{>text}}\"","desc":"The empty string should be used when the named partial is not found.","partials":{}},{"name":"Context","data":{"text":"content"},"expected":"\"*content*\"","template":"\"{{>partial}}\"","desc":"The greater-than operator should operate within the current context.","partials":{"partial":"*{{text}}*"}},{"name":"Recursion","data":{"content":"X","nodes":[{"content":"Y","nodes":[]}]},"expected":"X<Y<>>","template":"{{>node}}","desc":"The greater-than operator should properly recurse.","partials":{"node":"{{content}}<{{#nodes}}{{>node}}{{/nodes}}>"}},{"name":"Surrounding Whitespace","data":{},"expected":"| \t|\t |","template":"| {{>partial}} |","desc":"The greater-than operator should not alter surrounding whitespace.","partials":{"partial":"\t|\t"}},{"name":"Inline Indentation","data":{"data":"|"},"expected":" | >\n>\n","template":" {{data}} {{> partial}}\n","desc":"Whitespace should be left untouched.","partials":{"partial":">\n>"}},{"name":"Standalone Line Endings","data":{},"expected":"|\r\n>|","template":"|\r\n{{>partial}}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags.","partials":{"partial":">"}},{"name":"Standalone Without Previous Line","data":{},"expected":" >\n >>","template":" {{>partial}}\n>","desc":"Standalone tags should not require a newline to precede them.","partials":{"partial":">\n>"}},{"name":"Standalone Without Newline","data":{},"expected":">\n >\n >","template":">\n {{>partial}}","desc":"Standalone tags should not require a newline to follow them.","partials":{"partial":">\n>"}},{"name":"Standalone Indentation","data":{"content":"<\n->"},"expected":"\\\n |\n <\n->\n |\n/\n","template":"\\\n {{>partial}}\n/\n","desc":"Each line of the partial should be indented before rendering.","partials":{"partial":"|\n{{{content}}}\n|\n"}},{"name":"Padding Whitespace","data":{"boolean":true},"expected":"|[]|","template":"|{{> partial }}|","desc":"Superfluous in-tag whitespace should be ignored.","partials":{"partial":"[]"}}]}
@@ -1,109 +0,0 @@
1
- overview: |
2
- Partial tags are used to expand an external template into the current
3
- template.
4
-
5
- The tag's content MUST be a non-whitespace character sequence NOT containing
6
- the current closing delimiter.
7
-
8
- This tag's content names the partial to inject. Set Delimiter tags MUST NOT
9
- affect the parsing of a partial. The partial MUST be rendered against the
10
- context stack local to the tag. If the named partial cannot be found, the
11
- empty string SHOULD be used instead, as in interpolations.
12
-
13
- Partial tags SHOULD be treated as standalone when appropriate. If this tag
14
- is used standalone, any whitespace preceding the tag should treated as
15
- indentation, and prepended to each line of the partial before rendering.
16
- tests:
17
- - name: Basic Behavior
18
- desc: The greater-than operator should expand to the named partial.
19
- data: { }
20
- template: '"{{>text}}"'
21
- partials: { text: 'from partial' }
22
- expected: '"from partial"'
23
-
24
- - name: Failed Lookup
25
- desc: The empty string should be used when the named partial is not found.
26
- data: { }
27
- template: '"{{>text}}"'
28
- partials: { }
29
- expected: '""'
30
-
31
- - name: Context
32
- desc: The greater-than operator should operate within the current context.
33
- data: { text: 'content' }
34
- template: '"{{>partial}}"'
35
- partials: { partial: '*{{text}}*' }
36
- expected: '"*content*"'
37
-
38
- - name: Recursion
39
- desc: The greater-than operator should properly recurse.
40
- data: { content: "X", nodes: [ { content: "Y", nodes: [] } ] }
41
- template: '{{>node}}'
42
- partials: { node: '{{content}}<{{#nodes}}{{>node}}{{/nodes}}>' }
43
- expected: 'X<Y<>>'
44
-
45
- # Whitespace Sensitivity
46
-
47
- - name: Surrounding Whitespace
48
- desc: The greater-than operator should not alter surrounding whitespace.
49
- data: { }
50
- template: '| {{>partial}} |'
51
- partials: { partial: "\t|\t" }
52
- expected: "| \t|\t |"
53
-
54
- - name: Inline Indentation
55
- desc: Whitespace should be left untouched.
56
- data: { data: '|' }
57
- template: " {{data}} {{> partial}}\n"
58
- partials: { partial: ">\n>" }
59
- expected: " | >\n>\n"
60
-
61
- - name: Standalone Line Endings
62
- desc: '"\r\n" should be considered a newline for standalone tags.'
63
- data: { }
64
- template: "|\r\n{{>partial}}\r\n|"
65
- partials: { partial: ">" }
66
- expected: "|\r\n>|"
67
-
68
- - name: Standalone Without Previous Line
69
- desc: Standalone tags should not require a newline to precede them.
70
- data: { }
71
- template: " {{>partial}}\n>"
72
- partials: { partial: ">\n>"}
73
- expected: " >\n >>"
74
-
75
- - name: Standalone Without Newline
76
- desc: Standalone tags should not require a newline to follow them.
77
- data: { }
78
- template: ">\n {{>partial}}"
79
- partials: { partial: ">\n>" }
80
- expected: ">\n >\n >"
81
-
82
- - name: Standalone Indentation
83
- desc: Each line of the partial should be indented before rendering.
84
- data: { content: "<\n->" }
85
- template: |
86
- \
87
- {{>partial}}
88
- /
89
- partials:
90
- partial: |
91
- |
92
- {{{content}}}
93
- |
94
- expected: |
95
- \
96
- |
97
- <
98
- ->
99
- |
100
- /
101
-
102
- # Whitespace Insensitivity
103
-
104
- - name: Padding Whitespace
105
- desc: Superfluous in-tag whitespace should be ignored.
106
- data: { boolean: true }
107
- template: "|{{> partial }}|"
108
- partials: { partial: "[]" }
109
- expected: '|[]|'
@@ -1 +0,0 @@
1
- {"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Section tags and End Section tags are used in combination to wrap a section\nof the template for iteration\n\nThese tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Section tag MUST be followed\nby an End Section tag with the same content within the same section.\n\nThis tag's content names the data to replace the tag. Name resolution is as\nfollows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object and the method with the given name has an\n arity of 1, the method SHOULD be called with a String containing the\n unprocessed contents of the sections; the data is the value returned.\n 5) Otherwise, the data is the value returned by calling the method with\n the given name.\n 6) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nIf the data is not of a list type, it is coerced into a list as follows: if\nthe data is truthy (e.g. `!!data == true`), use a single-element list\ncontaining the data, otherwise use an empty list.\n\nFor each element in the data list, the element MUST be pushed onto the\ncontext stack, the section MUST be rendered, and the element MUST be popped\noff the context stack.\n\nSection and End Section tags SHOULD be treated as standalone when\nappropriate.\n","tests":[{"name":"Truthy","data":{"boolean":true},"expected":"\"This should be rendered.\"","template":"\"{{#boolean}}This should be rendered.{{/boolean}}\"","desc":"Truthy sections should have their contents rendered."},{"name":"Falsey","data":{"boolean":false},"expected":"\"\"","template":"\"{{#boolean}}This should not be rendered.{{/boolean}}\"","desc":"Falsey sections should have their contents omitted."},{"name":"Context","data":{"context":{"name":"Joe"}},"expected":"\"Hi Joe.\"","template":"\"{{#context}}Hi {{name}}.{{/context}}\"","desc":"Objects and hashes should be pushed onto the context stack."},{"name":"Deeply Nested Contexts","data":{"a":{"one":1},"b":{"two":2},"c":{"three":3},"d":{"four":4},"e":{"five":5}},"expected":"1\n121\n12321\n1234321\n123454321\n1234321\n12321\n121\n1\n","template":"{{#a}}\n{{one}}\n{{#b}}\n{{one}}{{two}}{{one}}\n{{#c}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{#d}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{#e}}\n{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}\n{{/e}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{/d}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{/c}}\n{{one}}{{two}}{{one}}\n{{/b}}\n{{one}}\n{{/a}}\n","desc":"All elements on the context stack should be accessible."},{"name":"List","data":{"list":[{"item":1},{"item":2},{"item":3}]},"expected":"\"123\"","template":"\"{{#list}}{{item}}{{/list}}\"","desc":"Lists should be iterated; list items should visit the context stack."},{"name":"Empty List","data":{"list":[]},"expected":"\"\"","template":"\"{{#list}}Yay lists!{{/list}}\"","desc":"Empty lists should behave like falsey values."},{"name":"Doubled","data":{"two":"second","bool":true},"expected":"* first\n* second\n* third\n","template":"{{#bool}}\n* first\n{{/bool}}\n* {{two}}\n{{#bool}}\n* third\n{{/bool}}\n","desc":"Multiple sections per template should be permitted."},{"name":"Nested (Truthy)","data":{"bool":true},"expected":"| A B C D E |","template":"| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |","desc":"Nested truthy sections should have their contents rendered."},{"name":"Nested (Falsey)","data":{"bool":false},"expected":"| A E |","template":"| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |","desc":"Nested falsey sections should be omitted."},{"name":"Context Misses","data":{},"expected":"[]","template":"[{{#missing}}Found key 'missing'!{{/missing}}]","desc":"Failed context lookups should be considered falsey."},{"name":"Implicit Iterator - String","data":{"list":["a","b","c","d","e"]},"expected":"\"(a)(b)(c)(d)(e)\"","template":"\"{{#list}}({{.}}){{/list}}\"","desc":"Implicit iterators should directly interpolate strings."},{"name":"Implicit Iterator - Integer","data":{"list":[1,2,3,4,5]},"expected":"\"(1)(2)(3)(4)(5)\"","template":"\"{{#list}}({{.}}){{/list}}\"","desc":"Implicit iterators should cast integers to strings and interpolate."},{"name":"Implicit Iterator - Decimal","data":{"list":[1.1,2.2,3.3,4.4,5.5]},"expected":"\"(1.1)(2.2)(3.3)(4.4)(5.5)\"","template":"\"{{#list}}({{.}}){{/list}}\"","desc":"Implicit iterators should cast decimals to strings and interpolate."},{"name":"Dotted Names - Truthy","data":{"a":{"b":{"c":true}}},"expected":"\"Here\" == \"Here\"","template":"\"{{#a.b.c}}Here{{/a.b.c}}\" == \"Here\"","desc":"Dotted names should be valid for Section tags."},{"name":"Dotted Names - Falsey","data":{"a":{"b":{"c":false}}},"expected":"\"\" == \"\"","template":"\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"","desc":"Dotted names should be valid for Section tags."},{"name":"Dotted Names - Broken Chains","data":{"a":{}},"expected":"\"\" == \"\"","template":"\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"","desc":"Dotted names that cannot be resolved should be considered falsey."},{"name":"Surrounding Whitespace","data":{"boolean":true},"expected":" | \t|\t | \n","template":" | {{#boolean}}\t|\t{{/boolean}} | \n","desc":"Sections should not alter surrounding whitespace."},{"name":"Internal Whitespace","data":{"boolean":true},"expected":" | \n | \n","template":" | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n","desc":"Sections should not alter internal whitespace."},{"name":"Indented Inline Sections","data":{"boolean":true},"expected":" YES\n GOOD\n","template":" {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n","desc":"Single-line sections should not alter surrounding whitespace."},{"name":"Standalone Lines","data":{"boolean":true},"expected":"| This Is\n|\n| A Line\n","template":"| This Is\n{{#boolean}}\n|\n{{/boolean}}\n| A Line\n","desc":"Standalone lines should be removed from the template."},{"name":"Indented Standalone Lines","data":{"boolean":true},"expected":"| This Is\n|\n| A Line\n","template":"| This Is\n {{#boolean}}\n|\n {{/boolean}}\n| A Line\n","desc":"Indented standalone lines should be removed from the template."},{"name":"Standalone Line Endings","data":{"boolean":true},"expected":"|\r\n|","template":"|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags."},{"name":"Standalone Without Previous Line","data":{"boolean":true},"expected":"#\n/","template":" {{#boolean}}\n#{{/boolean}}\n/","desc":"Standalone tags should not require a newline to precede them."},{"name":"Standalone Without Newline","data":{"boolean":true},"expected":"#\n/\n","template":"#{{#boolean}}\n/\n {{/boolean}}","desc":"Standalone tags should not require a newline to follow them."},{"name":"Padding","data":{"boolean":true},"expected":"|=|","template":"|{{# boolean }}={{/ boolean }}|","desc":"Superfluous in-tag whitespace should be ignored."}]}
@@ -1,256 +0,0 @@
1
- overview: |
2
- Section tags and End Section tags are used in combination to wrap a section
3
- of the template for iteration
4
-
5
- These tags' content MUST be a non-whitespace character sequence NOT
6
- containing the current closing delimiter; each Section tag MUST be followed
7
- by an End Section tag with the same content within the same section.
8
-
9
- This tag's content names the data to replace the tag. Name resolution is as
10
- follows:
11
- 1) Split the name on periods; the first part is the name to resolve, any
12
- remaining parts should be retained.
13
- 2) Walk the context stack from top to bottom, finding the first context
14
- that is a) a hash containing the name as a key OR b) an object responding
15
- to a method with the given name.
16
- 3) If the context is a hash, the data is the value associated with the
17
- name.
18
- 4) If the context is an object and the method with the given name has an
19
- arity of 1, the method SHOULD be called with a String containing the
20
- unprocessed contents of the sections; the data is the value returned.
21
- 5) Otherwise, the data is the value returned by calling the method with
22
- the given name.
23
- 6) If any name parts were retained in step 1, each should be resolved
24
- against a context stack containing only the result from the former
25
- resolution. If any part fails resolution, the result should be considered
26
- falsey, and should interpolate as the empty string.
27
- If the data is not of a list type, it is coerced into a list as follows: if
28
- the data is truthy (e.g. `!!data == true`), use a single-element list
29
- containing the data, otherwise use an empty list.
30
-
31
- For each element in the data list, the element MUST be pushed onto the
32
- context stack, the section MUST be rendered, and the element MUST be popped
33
- off the context stack.
34
-
35
- Section and End Section tags SHOULD be treated as standalone when
36
- appropriate.
37
- tests:
38
- - name: Truthy
39
- desc: Truthy sections should have their contents rendered.
40
- data: { boolean: true }
41
- template: '"{{#boolean}}This should be rendered.{{/boolean}}"'
42
- expected: '"This should be rendered."'
43
-
44
- - name: Falsey
45
- desc: Falsey sections should have their contents omitted.
46
- data: { boolean: false }
47
- template: '"{{#boolean}}This should not be rendered.{{/boolean}}"'
48
- expected: '""'
49
-
50
- - name: Context
51
- desc: Objects and hashes should be pushed onto the context stack.
52
- data: { context: { name: 'Joe' } }
53
- template: '"{{#context}}Hi {{name}}.{{/context}}"'
54
- expected: '"Hi Joe."'
55
-
56
- - name: Deeply Nested Contexts
57
- desc: All elements on the context stack should be accessible.
58
- data:
59
- a: { one: 1 }
60
- b: { two: 2 }
61
- c: { three: 3 }
62
- d: { four: 4 }
63
- e: { five: 5 }
64
- template: |
65
- {{#a}}
66
- {{one}}
67
- {{#b}}
68
- {{one}}{{two}}{{one}}
69
- {{#c}}
70
- {{one}}{{two}}{{three}}{{two}}{{one}}
71
- {{#d}}
72
- {{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}
73
- {{#e}}
74
- {{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}
75
- {{/e}}
76
- {{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}
77
- {{/d}}
78
- {{one}}{{two}}{{three}}{{two}}{{one}}
79
- {{/c}}
80
- {{one}}{{two}}{{one}}
81
- {{/b}}
82
- {{one}}
83
- {{/a}}
84
- expected: |
85
- 1
86
- 121
87
- 12321
88
- 1234321
89
- 123454321
90
- 1234321
91
- 12321
92
- 121
93
- 1
94
-
95
- - name: List
96
- desc: Lists should be iterated; list items should visit the context stack.
97
- data: { list: [ { item: 1 }, { item: 2 }, { item: 3 } ] }
98
- template: '"{{#list}}{{item}}{{/list}}"'
99
- expected: '"123"'
100
-
101
- - name: Empty List
102
- desc: Empty lists should behave like falsey values.
103
- data: { list: [ ] }
104
- template: '"{{#list}}Yay lists!{{/list}}"'
105
- expected: '""'
106
-
107
- - name: Doubled
108
- desc: Multiple sections per template should be permitted.
109
- data: { bool: true, two: 'second' }
110
- template: |
111
- {{#bool}}
112
- * first
113
- {{/bool}}
114
- * {{two}}
115
- {{#bool}}
116
- * third
117
- {{/bool}}
118
- expected: |
119
- * first
120
- * second
121
- * third
122
-
123
- - name: Nested (Truthy)
124
- desc: Nested truthy sections should have their contents rendered.
125
- data: { bool: true }
126
- template: "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |"
127
- expected: "| A B C D E |"
128
-
129
- - name: Nested (Falsey)
130
- desc: Nested falsey sections should be omitted.
131
- data: { bool: false }
132
- template: "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |"
133
- expected: "| A E |"
134
-
135
- - name: Context Misses
136
- desc: Failed context lookups should be considered falsey.
137
- data: { }
138
- template: "[{{#missing}}Found key 'missing'!{{/missing}}]"
139
- expected: "[]"
140
-
141
- # Implicit Iterators
142
-
143
- - name: Implicit Iterator - String
144
- desc: Implicit iterators should directly interpolate strings.
145
- data:
146
- list: [ 'a', 'b', 'c', 'd', 'e' ]
147
- template: '"{{#list}}({{.}}){{/list}}"'
148
- expected: '"(a)(b)(c)(d)(e)"'
149
-
150
- - name: Implicit Iterator - Integer
151
- desc: Implicit iterators should cast integers to strings and interpolate.
152
- data:
153
- list: [ 1, 2, 3, 4, 5 ]
154
- template: '"{{#list}}({{.}}){{/list}}"'
155
- expected: '"(1)(2)(3)(4)(5)"'
156
-
157
- - name: Implicit Iterator - Decimal
158
- desc: Implicit iterators should cast decimals to strings and interpolate.
159
- data:
160
- list: [ 1.10, 2.20, 3.30, 4.40, 5.50 ]
161
- template: '"{{#list}}({{.}}){{/list}}"'
162
- expected: '"(1.1)(2.2)(3.3)(4.4)(5.5)"'
163
-
164
- # Dotted Names
165
-
166
- - name: Dotted Names - Truthy
167
- desc: Dotted names should be valid for Section tags.
168
- data: { a: { b: { c: true } } }
169
- template: '"{{#a.b.c}}Here{{/a.b.c}}" == "Here"'
170
- expected: '"Here" == "Here"'
171
-
172
- - name: Dotted Names - Falsey
173
- desc: Dotted names should be valid for Section tags.
174
- data: { a: { b: { c: false } } }
175
- template: '"{{#a.b.c}}Here{{/a.b.c}}" == ""'
176
- expected: '"" == ""'
177
-
178
- - name: Dotted Names - Broken Chains
179
- desc: Dotted names that cannot be resolved should be considered falsey.
180
- data: { a: { } }
181
- template: '"{{#a.b.c}}Here{{/a.b.c}}" == ""'
182
- expected: '"" == ""'
183
-
184
- # Whitespace Sensitivity
185
-
186
- - name: Surrounding Whitespace
187
- desc: Sections should not alter surrounding whitespace.
188
- data: { boolean: true }
189
- template: " | {{#boolean}}\t|\t{{/boolean}} | \n"
190
- expected: " | \t|\t | \n"
191
-
192
- - name: Internal Whitespace
193
- desc: Sections should not alter internal whitespace.
194
- data: { boolean: true }
195
- template: " | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n"
196
- expected: " | \n | \n"
197
-
198
- - name: Indented Inline Sections
199
- desc: Single-line sections should not alter surrounding whitespace.
200
- data: { boolean: true }
201
- template: " {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n"
202
- expected: " YES\n GOOD\n"
203
-
204
- - name: Standalone Lines
205
- desc: Standalone lines should be removed from the template.
206
- data: { boolean: true }
207
- template: |
208
- | This Is
209
- {{#boolean}}
210
- |
211
- {{/boolean}}
212
- | A Line
213
- expected: |
214
- | This Is
215
- |
216
- | A Line
217
-
218
- - name: Indented Standalone Lines
219
- desc: Indented standalone lines should be removed from the template.
220
- data: { boolean: true }
221
- template: |
222
- | This Is
223
- {{#boolean}}
224
- |
225
- {{/boolean}}
226
- | A Line
227
- expected: |
228
- | This Is
229
- |
230
- | A Line
231
-
232
- - name: Standalone Line Endings
233
- desc: '"\r\n" should be considered a newline for standalone tags.'
234
- data: { boolean: true }
235
- template: "|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|"
236
- expected: "|\r\n|"
237
-
238
- - name: Standalone Without Previous Line
239
- desc: Standalone tags should not require a newline to precede them.
240
- data: { boolean: true }
241
- template: " {{#boolean}}\n#{{/boolean}}\n/"
242
- expected: "#\n/"
243
-
244
- - name: Standalone Without Newline
245
- desc: Standalone tags should not require a newline to follow them.
246
- data: { boolean: true }
247
- template: "#{{#boolean}}\n/\n {{/boolean}}"
248
- expected: "#\n/\n"
249
-
250
- # Whitespace Insensitivity
251
-
252
- - name: Padding
253
- desc: Superfluous in-tag whitespace should be ignored.
254
- data: { boolean: true }
255
- template: '|{{# boolean }}={{/ boolean }}|'
256
- expected: '|=|'
@@ -1 +0,0 @@
1
- {"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Lambdas are a special-cased data type for use in interpolations and\nsections.\n\nWhen used as the data value for an Interpolation tag, the lambda MUST be\ntreatable as an arity 0 function, and invoked as such. The returned value\nMUST be rendered against the default delimiters, then interpolated in place\nof the lambda.\n\nWhen used as the data value for a Section tag, the lambda MUST be treatable\nas an arity 1 function, and invoked as such (passing a String containing the\nunprocessed section contents). The returned value MUST be rendered against\nthe current delimiters, then interpolated in place of the section.\n","tests":[{"name":"Interpolation","data":{"lambda":{"php":"return \"world\";","clojure":"(fn [] \"world\")","__tag__":"code","perl":"sub { \"world\" }","python":"lambda: \"world\"","ruby":"proc { \"world\" }","js":"function() { return \"world\" }"}},"expected":"Hello, world!","template":"Hello, {{lambda}}!","desc":"A lambda's return value should be interpolated."},{"name":"Interpolation - Expansion","data":{"planet":"world","lambda":{"php":"return \"{{planet}}\";","clojure":"(fn [] \"{{planet}}\")","__tag__":"code","perl":"sub { \"{{planet}}\" }","python":"lambda: \"{{planet}}\"","ruby":"proc { \"{{planet}}\" }","js":"function() { return \"{{planet}}\" }"}},"expected":"Hello, world!","template":"Hello, {{lambda}}!","desc":"A lambda's return value should be parsed."},{"name":"Interpolation - Alternate Delimiters","data":{"planet":"world","lambda":{"php":"return \"|planet| => {{planet}}\";","clojure":"(fn [] \"|planet| => {{planet}}\")","__tag__":"code","perl":"sub { \"|planet| => {{planet}}\" }","python":"lambda: \"|planet| => {{planet}}\"","ruby":"proc { \"|planet| => {{planet}}\" }","js":"function() { return \"|planet| => {{planet}}\" }"}},"expected":"Hello, (|planet| => world)!","template":"{{= | | =}}\nHello, (|&lambda|)!","desc":"A lambda's return value should parse with the default delimiters."},{"name":"Interpolation - Multiple Calls","data":{"lambda":{"php":"global $calls; return ++$calls;","clojure":"(def g (atom 0)) (fn [] (swap! g inc))","__tag__":"code","perl":"sub { no strict; $calls += 1 }","python":"lambda: globals().update(calls=globals().get(\"calls\",0)+1) or calls","ruby":"proc { $calls ||= 0; $calls += 1 }","js":"function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }"}},"expected":"1 == 2 == 3","template":"{{lambda}} == {{{lambda}}} == {{lambda}}","desc":"Interpolated lambdas should not be cached."},{"name":"Escaping","data":{"lambda":{"php":"return \">\";","clojure":"(fn [] \">\")","__tag__":"code","perl":"sub { \">\" }","python":"lambda: \">\"","ruby":"proc { \">\" }","js":"function() { return \">\" }"}},"expected":"<&gt;>","template":"<{{lambda}}{{{lambda}}}","desc":"Lambda results should be appropriately escaped."},{"name":"Section","data":{"x":"Error!","lambda":{"php":"return ($text == \"{{x}}\") ? \"yes\" : \"no\";","clojure":"(fn [text] (if (= text \"{{x}}\") \"yes\" \"no\"))","__tag__":"code","perl":"sub { $_[0] eq \"{{x}}\" ? \"yes\" : \"no\" }","python":"lambda text: text == \"{{x}}\" and \"yes\" or \"no\"","ruby":"proc { |text| text == \"{{x}}\" ? \"yes\" : \"no\" }","js":"function(txt) { return (txt == \"{{x}}\" ? \"yes\" : \"no\") }"}},"expected":"<yes>","template":"<{{#lambda}}{{x}}{{/lambda}}>","desc":"Lambdas used for sections should receive the raw section string."},{"name":"Section - Expansion","data":{"planet":"Earth","lambda":{"php":"return $text . \"{{planet}}\" . $text;","clojure":"(fn [text] (str text \"{{planet}}\" text))","__tag__":"code","perl":"sub { $_[0] . \"{{planet}}\" . $_[0] }","python":"lambda text: \"%s{{planet}}%s\" % (text, text)","ruby":"proc { |text| \"#{text}{{planet}}#{text}\" }","js":"function(txt) { return txt + \"{{planet}}\" + txt }"}},"expected":"<-Earth->","template":"<{{#lambda}}-{{/lambda}}>","desc":"Lambdas used for sections should have their results parsed."},{"name":"Section - Alternate Delimiters","data":{"planet":"Earth","lambda":{"php":"return $text . \"{{planet}} => |planet|\" . $text;","clojure":"(fn [text] (str text \"{{planet}} => |planet|\" text))","__tag__":"code","perl":"sub { $_[0] . \"{{planet}} => |planet|\" . $_[0] }","python":"lambda text: \"%s{{planet}} => |planet|%s\" % (text, text)","ruby":"proc { |text| \"#{text}{{planet}} => |planet|#{text}\" }","js":"function(txt) { return txt + \"{{planet}} => |planet|\" + txt }"}},"expected":"<-{{planet}} => Earth->","template":"{{= | | =}}<|#lambda|-|/lambda|>","desc":"Lambdas used for sections should parse with the current delimiters."},{"name":"Section - Multiple Calls","data":{"lambda":{"php":"return \"__\" . $text . \"__\";","clojure":"(fn [text] (str \"__\" text \"__\"))","__tag__":"code","perl":"sub { \"__\" . $_[0] . \"__\" }","python":"lambda text: \"__%s__\" % (text)","ruby":"proc { |text| \"__#{text}__\" }","js":"function(txt) { return \"__\" + txt + \"__\" }"}},"expected":"__FILE__ != __LINE__","template":"{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}","desc":"Lambdas used for sections should not be cached."},{"name":"Inverted Section","data":{"static":"static","lambda":{"php":"return false;","clojure":"(fn [text] false)","__tag__":"code","perl":"sub { 0 }","python":"lambda text: 0","ruby":"proc { |text| false }","js":"function(txt) { return false }"}},"expected":"<>","template":"<{{^lambda}}{{static}}{{/lambda}}>","desc":"Lambdas used for inverted sections should be considered truthy."}]}
@@ -1,149 +0,0 @@
1
- overview: |
2
- Lambdas are a special-cased data type for use in interpolations and
3
- sections.
4
-
5
- When used as the data value for an Interpolation tag, the lambda MUST be
6
- treatable as an arity 0 function, and invoked as such. The returned value
7
- MUST be rendered against the default delimiters, then interpolated in place
8
- of the lambda.
9
-
10
- When used as the data value for a Section tag, the lambda MUST be treatable
11
- as an arity 1 function, and invoked as such (passing a String containing the
12
- unprocessed section contents). The returned value MUST be rendered against
13
- the current delimiters, then interpolated in place of the section.
14
- tests:
15
- - name: Interpolation
16
- desc: A lambda's return value should be interpolated.
17
- data:
18
- lambda: !code
19
- ruby: 'proc { "world" }'
20
- perl: 'sub { "world" }'
21
- js: 'function() { return "world" }'
22
- php: 'return "world";'
23
- python: 'lambda: "world"'
24
- clojure: '(fn [] "world")'
25
- template: "Hello, {{lambda}}!"
26
- expected: "Hello, world!"
27
-
28
- - name: Interpolation - Expansion
29
- desc: A lambda's return value should be parsed.
30
- data:
31
- planet: "world"
32
- lambda: !code
33
- ruby: 'proc { "{{planet}}" }'
34
- perl: 'sub { "{{planet}}" }'
35
- js: 'function() { return "{{planet}}" }'
36
- php: 'return "{{planet}}";'
37
- python: 'lambda: "{{planet}}"'
38
- clojure: '(fn [] "{{planet}}")'
39
- template: "Hello, {{lambda}}!"
40
- expected: "Hello, world!"
41
-
42
- - name: Interpolation - Alternate Delimiters
43
- desc: A lambda's return value should parse with the default delimiters.
44
- data:
45
- planet: "world"
46
- lambda: !code
47
- ruby: 'proc { "|planet| => {{planet}}" }'
48
- perl: 'sub { "|planet| => {{planet}}" }'
49
- js: 'function() { return "|planet| => {{planet}}" }'
50
- php: 'return "|planet| => {{planet}}";'
51
- python: 'lambda: "|planet| => {{planet}}"'
52
- clojure: '(fn [] "|planet| => {{planet}}")'
53
- template: "{{= | | =}}\nHello, (|&lambda|)!"
54
- expected: "Hello, (|planet| => world)!"
55
-
56
- - name: Interpolation - Multiple Calls
57
- desc: Interpolated lambdas should not be cached.
58
- data:
59
- lambda: !code
60
- ruby: 'proc { $calls ||= 0; $calls += 1 }'
61
- perl: 'sub { no strict; $calls += 1 }'
62
- js: 'function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }'
63
- php: 'global $calls; return ++$calls;'
64
- python: 'lambda: globals().update(calls=globals().get("calls",0)+1) or calls'
65
- clojure: '(def g (atom 0)) (fn [] (swap! g inc))'
66
- template: '{{lambda}} == {{{lambda}}} == {{lambda}}'
67
- expected: '1 == 2 == 3'
68
-
69
- - name: Escaping
70
- desc: Lambda results should be appropriately escaped.
71
- data:
72
- lambda: !code
73
- ruby: 'proc { ">" }'
74
- perl: 'sub { ">" }'
75
- js: 'function() { return ">" }'
76
- php: 'return ">";'
77
- python: 'lambda: ">"'
78
- clojure: '(fn [] ">")'
79
- template: "<{{lambda}}{{{lambda}}}"
80
- expected: "<&gt;>"
81
-
82
- - name: Section
83
- desc: Lambdas used for sections should receive the raw section string.
84
- data:
85
- x: 'Error!'
86
- lambda: !code
87
- ruby: 'proc { |text| text == "{{x}}" ? "yes" : "no" }'
88
- perl: 'sub { $_[0] eq "{{x}}" ? "yes" : "no" }'
89
- js: 'function(txt) { return (txt == "{{x}}" ? "yes" : "no") }'
90
- php: 'return ($text == "{{x}}") ? "yes" : "no";'
91
- python: 'lambda text: text == "{{x}}" and "yes" or "no"'
92
- clojure: '(fn [text] (if (= text "{{x}}") "yes" "no"))'
93
- template: "<{{#lambda}}{{x}}{{/lambda}}>"
94
- expected: "<yes>"
95
-
96
- - name: Section - Expansion
97
- desc: Lambdas used for sections should have their results parsed.
98
- data:
99
- planet: "Earth"
100
- lambda: !code
101
- ruby: 'proc { |text| "#{text}{{planet}}#{text}" }'
102
- perl: 'sub { $_[0] . "{{planet}}" . $_[0] }'
103
- js: 'function(txt) { return txt + "{{planet}}" + txt }'
104
- php: 'return $text . "{{planet}}" . $text;'
105
- python: 'lambda text: "%s{{planet}}%s" % (text, text)'
106
- clojure: '(fn [text] (str text "{{planet}}" text))'
107
- template: "<{{#lambda}}-{{/lambda}}>"
108
- expected: "<-Earth->"
109
-
110
- - name: Section - Alternate Delimiters
111
- desc: Lambdas used for sections should parse with the current delimiters.
112
- data:
113
- planet: "Earth"
114
- lambda: !code
115
- ruby: 'proc { |text| "#{text}{{planet}} => |planet|#{text}" }'
116
- perl: 'sub { $_[0] . "{{planet}} => |planet|" . $_[0] }'
117
- js: 'function(txt) { return txt + "{{planet}} => |planet|" + txt }'
118
- php: 'return $text . "{{planet}} => |planet|" . $text;'
119
- python: 'lambda text: "%s{{planet}} => |planet|%s" % (text, text)'
120
- clojure: '(fn [text] (str text "{{planet}} => |planet|" text))'
121
- template: "{{= | | =}}<|#lambda|-|/lambda|>"
122
- expected: "<-{{planet}} => Earth->"
123
-
124
- - name: Section - Multiple Calls
125
- desc: Lambdas used for sections should not be cached.
126
- data:
127
- lambda: !code
128
- ruby: 'proc { |text| "__#{text}__" }'
129
- perl: 'sub { "__" . $_[0] . "__" }'
130
- js: 'function(txt) { return "__" + txt + "__" }'
131
- php: 'return "__" . $text . "__";'
132
- python: 'lambda text: "__%s__" % (text)'
133
- clojure: '(fn [text] (str "__" text "__"))'
134
- template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}'
135
- expected: '__FILE__ != __LINE__'
136
-
137
- - name: Inverted Section
138
- desc: Lambdas used for inverted sections should be considered truthy.
139
- data:
140
- static: 'static'
141
- lambda: !code
142
- ruby: 'proc { |text| false }'
143
- perl: 'sub { 0 }'
144
- js: 'function(txt) { return false }'
145
- php: 'return false;'
146
- python: 'lambda text: 0'
147
- clojure: '(fn [text] false)'
148
- template: "<{{^lambda}}{{static}}{{/lambda}}>"
149
- expected: "<>"