sass-twitter-bootstrap 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (243) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +14 -0
  4. data/LICENSE +176 -0
  5. data/Makefile +94 -0
  6. data/README.md +217 -0
  7. data/Rakefile +52 -0
  8. data/bootstrap-2.0.4.css +4661 -0
  9. data/bootstrap-2.0.4.min.css +9 -0
  10. data/bootstrap-responsive-2.0.4.css +932 -0
  11. data/bootstrap-responsive-2.0.4.min.css +9 -0
  12. data/docs/assets/css/bootstrap-responsive.css +932 -0
  13. data/docs/assets/css/bootstrap.css +4661 -0
  14. data/docs/assets/css/docs.css +846 -0
  15. data/docs/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
  16. data/docs/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
  17. data/docs/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
  18. data/docs/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
  19. data/docs/assets/ico/favicon.ico +0 -0
  20. data/docs/assets/img/bird.png +0 -0
  21. data/docs/assets/img/bootstrap-mdo-sfmoma-01.jpg +0 -0
  22. data/docs/assets/img/bootstrap-mdo-sfmoma-02.jpg +0 -0
  23. data/docs/assets/img/bootstrap-mdo-sfmoma-03.jpg +0 -0
  24. data/docs/assets/img/browsers.png +0 -0
  25. data/docs/assets/img/example-sites/fleetio.png +0 -0
  26. data/docs/assets/img/example-sites/jshint.png +0 -0
  27. data/docs/assets/img/example-sites/kippt.png +0 -0
  28. data/docs/assets/img/example-sites/soundready.png +0 -0
  29. data/docs/assets/img/examples/bootstrap-example-fluid.jpg +0 -0
  30. data/docs/assets/img/examples/bootstrap-example-hero.jpg +0 -0
  31. data/docs/assets/img/examples/bootstrap-example-starter.jpg +0 -0
  32. data/docs/assets/img/github-16px.png +0 -0
  33. data/docs/assets/img/glyphicons-halflings-white.png +0 -0
  34. data/docs/assets/img/glyphicons-halflings.png +0 -0
  35. data/docs/assets/img/glyphicons/glyphicons_009_magic.png +0 -0
  36. data/docs/assets/img/glyphicons/glyphicons_042_group.png +0 -0
  37. data/docs/assets/img/glyphicons/glyphicons_079_podium.png +0 -0
  38. data/docs/assets/img/glyphicons/glyphicons_082_roundabout.png +0 -0
  39. data/docs/assets/img/glyphicons/glyphicons_155_show_thumbnails.png +0 -0
  40. data/docs/assets/img/glyphicons/glyphicons_163_iphone.png +0 -0
  41. data/docs/assets/img/glyphicons/glyphicons_214_resize_small.png +0 -0
  42. data/docs/assets/img/glyphicons/glyphicons_266_book_open.png +0 -0
  43. data/docs/assets/img/grid-18px-masked.png +0 -0
  44. data/docs/assets/img/icon-css3.png +0 -0
  45. data/docs/assets/img/icon-github.png +0 -0
  46. data/docs/assets/img/icon-html5.png +0 -0
  47. data/docs/assets/img/icon-twitter.png +0 -0
  48. data/docs/assets/img/less-logo-large.png +0 -0
  49. data/docs/assets/img/less-small.png +0 -0
  50. data/docs/assets/img/responsive-illustrations.png +0 -0
  51. data/docs/assets/js/README.md +106 -0
  52. data/docs/assets/js/application.js +184 -0
  53. data/docs/assets/js/bootstrap-alert.js +90 -0
  54. data/docs/assets/js/bootstrap-button.js +96 -0
  55. data/docs/assets/js/bootstrap-carousel.js +169 -0
  56. data/docs/assets/js/bootstrap-collapse.js +157 -0
  57. data/docs/assets/js/bootstrap-dropdown.js +100 -0
  58. data/docs/assets/js/bootstrap-modal.js +218 -0
  59. data/docs/assets/js/bootstrap-popover.js +98 -0
  60. data/docs/assets/js/bootstrap-scrollspy.js +151 -0
  61. data/docs/assets/js/bootstrap-tab.js +135 -0
  62. data/docs/assets/js/bootstrap-tooltip.js +275 -0
  63. data/docs/assets/js/bootstrap-transition.js +61 -0
  64. data/docs/assets/js/bootstrap-typeahead.js +285 -0
  65. data/docs/assets/js/bootstrap.js +1825 -0
  66. data/docs/assets/js/bootstrap.min.js +6 -0
  67. data/docs/assets/js/google-code-prettify/prettify.css +30 -0
  68. data/docs/assets/js/google-code-prettify/prettify.js +28 -0
  69. data/docs/assets/js/jquery.js +9252 -0
  70. data/docs/base-css.html +1710 -0
  71. data/docs/build/index.js +44 -0
  72. data/docs/build/node_modules/.bin/hulk +93 -0
  73. data/docs/build/node_modules/hogan.js/.git_ignore +1 -0
  74. data/docs/build/node_modules/hogan.js/.gitmodules +3 -0
  75. data/docs/build/node_modules/hogan.js/LICENSE +177 -0
  76. data/docs/build/node_modules/hogan.js/Makefile +62 -0
  77. data/docs/build/node_modules/hogan.js/README.md +93 -0
  78. data/docs/build/node_modules/hogan.js/bin/hulk +93 -0
  79. data/docs/build/node_modules/hogan.js/lib/compiler.js +348 -0
  80. data/docs/build/node_modules/hogan.js/lib/hogan.js +20 -0
  81. data/docs/build/node_modules/hogan.js/lib/template.js +233 -0
  82. data/docs/build/node_modules/hogan.js/package.json +20 -0
  83. data/docs/build/node_modules/hogan.js/test/html/list.html +8 -0
  84. data/docs/build/node_modules/hogan.js/test/index.html +13 -0
  85. data/docs/build/node_modules/hogan.js/test/index.js +848 -0
  86. data/docs/build/node_modules/hogan.js/test/mustache.js +90 -0
  87. data/docs/build/node_modules/hogan.js/test/spec.js +77 -0
  88. data/docs/build/node_modules/hogan.js/test/spec/Changes +31 -0
  89. data/docs/build/node_modules/hogan.js/test/spec/README.md +65 -0
  90. data/docs/build/node_modules/hogan.js/test/spec/Rakefile +27 -0
  91. data/docs/build/node_modules/hogan.js/test/spec/TESTING.md +46 -0
  92. data/docs/build/node_modules/hogan.js/test/spec/specs/comments.json +1 -0
  93. data/docs/build/node_modules/hogan.js/test/spec/specs/comments.yml +103 -0
  94. data/docs/build/node_modules/hogan.js/test/spec/specs/delimiters.json +1 -0
  95. data/docs/build/node_modules/hogan.js/test/spec/specs/delimiters.yml +158 -0
  96. data/docs/build/node_modules/hogan.js/test/spec/specs/interpolation.json +1 -0
  97. data/docs/build/node_modules/hogan.js/test/spec/specs/interpolation.yml +230 -0
  98. data/docs/build/node_modules/hogan.js/test/spec/specs/inverted.json +1 -0
  99. data/docs/build/node_modules/hogan.js/test/spec/specs/inverted.yml +193 -0
  100. data/docs/build/node_modules/hogan.js/test/spec/specs/partials.json +1 -0
  101. data/docs/build/node_modules/hogan.js/test/spec/specs/partials.yml +109 -0
  102. data/docs/build/node_modules/hogan.js/test/spec/specs/sections.json +1 -0
  103. data/docs/build/node_modules/hogan.js/test/spec/specs/sections.yml +256 -0
  104. data/docs/build/node_modules/hogan.js/test/spec/specs/~lambdas.json +1 -0
  105. data/docs/build/node_modules/hogan.js/test/spec/specs/~lambdas.yml +149 -0
  106. data/docs/build/node_modules/hogan.js/test/templates/list.mustache +8 -0
  107. data/docs/build/node_modules/hogan.js/tools/release.js +74 -0
  108. data/docs/build/node_modules/hogan.js/tools/web_templates.js +32 -0
  109. data/docs/build/node_modules/hogan.js/web/1.0.0/hogan.js +500 -0
  110. data/docs/build/node_modules/hogan.js/web/1.0.0/hogan.min.js +14 -0
  111. data/docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.js +500 -0
  112. data/docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.min.js +14 -0
  113. data/docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.js +545 -0
  114. data/docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.min.js +5 -0
  115. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.amd.js +576 -0
  116. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.common.js +576 -0
  117. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.js +572 -0
  118. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.amd.js +5 -0
  119. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.common.js +5 -0
  120. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.js +5 -0
  121. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.mustache.js +5 -0
  122. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.mustache.js +619 -0
  123. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.js +233 -0
  124. data/docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.min.js +5 -0
  125. data/docs/build/node_modules/hogan.js/web/favicon.ico +0 -0
  126. data/docs/build/node_modules/hogan.js/web/images/logo.png +0 -0
  127. data/docs/build/node_modules/hogan.js/web/images/noise.png +0 -0
  128. data/docs/build/node_modules/hogan.js/web/images/small-hogan-icon.png +0 -0
  129. data/docs/build/node_modules/hogan.js/web/images/stripes.png +0 -0
  130. data/docs/build/node_modules/hogan.js/web/index.html.mustache +139 -0
  131. data/docs/build/node_modules/hogan.js/web/stylesheets/layout.css +206 -0
  132. data/docs/build/node_modules/hogan.js/web/stylesheets/skeleton.css +236 -0
  133. data/docs/build/node_modules/hogan.js/wrappers/amd.js.mustache +21 -0
  134. data/docs/build/node_modules/hogan.js/wrappers/common.js.mustache +21 -0
  135. data/docs/build/node_modules/hogan.js/wrappers/js.mustache +17 -0
  136. data/docs/build/node_modules/hogan.js/wrappers/mustache.js.mustache +64 -0
  137. data/docs/build/package.json +6 -0
  138. data/docs/components.html +1931 -0
  139. data/docs/download.html +454 -0
  140. data/docs/examples.html +147 -0
  141. data/docs/examples/fluid.html +162 -0
  142. data/docs/examples/hero.html +109 -0
  143. data/docs/examples/starter-template.html +79 -0
  144. data/docs/index.html +259 -0
  145. data/docs/javascript.html +1520 -0
  146. data/docs/less.html +1060 -0
  147. data/docs/scaffolding.html +671 -0
  148. data/docs/templates/layout.mustache +146 -0
  149. data/docs/templates/pages/base-css.mustache +1594 -0
  150. data/docs/templates/pages/components.mustache +1815 -0
  151. data/docs/templates/pages/download.mustache +338 -0
  152. data/docs/templates/pages/examples.mustache +31 -0
  153. data/docs/templates/pages/index.mustache +144 -0
  154. data/docs/templates/pages/javascript.mustache +1405 -0
  155. data/docs/templates/pages/less.mustache +944 -0
  156. data/docs/templates/pages/scaffolding.mustache +555 -0
  157. data/docs/templates/pages/upgrading.mustache +194 -0
  158. data/docs/upgrading.html +310 -0
  159. data/js/tests/index.html +54 -0
  160. data/js/tests/phantom.js +63 -0
  161. data/js/tests/server.js +14 -0
  162. data/js/tests/unit/bootstrap-alert.js +56 -0
  163. data/js/tests/unit/bootstrap-button.js +77 -0
  164. data/js/tests/unit/bootstrap-carousel.js +28 -0
  165. data/js/tests/unit/bootstrap-collapse.js +54 -0
  166. data/js/tests/unit/bootstrap-dropdown.js +87 -0
  167. data/js/tests/unit/bootstrap-modal.js +114 -0
  168. data/js/tests/unit/bootstrap-phantom.js +21 -0
  169. data/js/tests/unit/bootstrap-popover.js +93 -0
  170. data/js/tests/unit/bootstrap-scrollspy.js +31 -0
  171. data/js/tests/unit/bootstrap-tab.js +61 -0
  172. data/js/tests/unit/bootstrap-tooltip.js +155 -0
  173. data/js/tests/unit/bootstrap-transition.js +13 -0
  174. data/js/tests/unit/bootstrap-typeahead.js +148 -0
  175. data/js/tests/vendor/jquery.js +9252 -0
  176. data/js/tests/vendor/qunit.css +232 -0
  177. data/js/tests/vendor/qunit.js +1510 -0
  178. data/lib/sass-twitter-bootstrap.rb +9 -0
  179. data/lib/sass/twitter/bootstrap/rails.rb +14 -0
  180. data/lib/sass/twitter/bootstrap/version.rb +7 -0
  181. data/package.json +25 -0
  182. data/sass-twitter-bootstrap.gemspec +19 -0
  183. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  184. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  185. data/vendor/assets/javascripts/README.md +112 -0
  186. data/vendor/assets/javascripts/twitter/bootstrap-alert.js +90 -0
  187. data/vendor/assets/javascripts/twitter/bootstrap-button.js +96 -0
  188. data/vendor/assets/javascripts/twitter/bootstrap-carousel.js +169 -0
  189. data/vendor/assets/javascripts/twitter/bootstrap-collapse.js +157 -0
  190. data/vendor/assets/javascripts/twitter/bootstrap-dropdown.js +100 -0
  191. data/vendor/assets/javascripts/twitter/bootstrap-modal.js +218 -0
  192. data/vendor/assets/javascripts/twitter/bootstrap-popover.js +98 -0
  193. data/vendor/assets/javascripts/twitter/bootstrap-scrollspy.js +151 -0
  194. data/vendor/assets/javascripts/twitter/bootstrap-tab.js +135 -0
  195. data/vendor/assets/javascripts/twitter/bootstrap-tooltip.js +275 -0
  196. data/vendor/assets/javascripts/twitter/bootstrap-transition.js +61 -0
  197. data/vendor/assets/javascripts/twitter/bootstrap-typeahead.js +285 -0
  198. data/vendor/assets/javascripts/twitter/bootstrap.js +12 -0
  199. data/vendor/assets/stylesheets/tests/css-tests.css +52 -0
  200. data/vendor/assets/stylesheets/tests/css-tests.html +917 -0
  201. data/vendor/assets/stylesheets/tests/forms.html +179 -0
  202. data/vendor/assets/stylesheets/tests/navbar.html +108 -0
  203. data/vendor/assets/stylesheets/twitter/_accordion.scss +33 -0
  204. data/vendor/assets/stylesheets/twitter/_alerts.scss +58 -0
  205. data/vendor/assets/stylesheets/twitter/_breadcrumbs.scss +24 -0
  206. data/vendor/assets/stylesheets/twitter/_button-groups.scss +191 -0
  207. data/vendor/assets/stylesheets/twitter/_buttons.scss +191 -0
  208. data/vendor/assets/stylesheets/twitter/_carousel.scss +121 -0
  209. data/vendor/assets/stylesheets/twitter/_close.scss +29 -0
  210. data/vendor/assets/stylesheets/twitter/_code.scss +57 -0
  211. data/vendor/assets/stylesheets/twitter/_component-animations.scss +20 -0
  212. data/vendor/assets/stylesheets/twitter/_dropdowns.scss +143 -0
  213. data/vendor/assets/stylesheets/twitter/_forms.scss +582 -0
  214. data/vendor/assets/stylesheets/twitter/_grid.scss +5 -0
  215. data/vendor/assets/stylesheets/twitter/_hero-unit.scss +22 -0
  216. data/vendor/assets/stylesheets/twitter/_labels-badges.scss +52 -0
  217. data/vendor/assets/stylesheets/twitter/_layouts.scss +17 -0
  218. data/vendor/assets/stylesheets/twitter/_mixins.scss +643 -0
  219. data/vendor/assets/stylesheets/twitter/_modals.scss +90 -0
  220. data/vendor/assets/stylesheets/twitter/_navbar.scss +358 -0
  221. data/vendor/assets/stylesheets/twitter/_navs.scss +363 -0
  222. data/vendor/assets/stylesheets/twitter/_pager.scss +36 -0
  223. data/vendor/assets/stylesheets/twitter/_pagination.scss +56 -0
  224. data/vendor/assets/stylesheets/twitter/_popovers.scss +49 -0
  225. data/vendor/assets/stylesheets/twitter/_progress-bars.scss +117 -0
  226. data/vendor/assets/stylesheets/twitter/_reset.scss +131 -0
  227. data/vendor/assets/stylesheets/twitter/_responsive-1200px-min.scss +26 -0
  228. data/vendor/assets/stylesheets/twitter/_responsive-767px-max.scss +149 -0
  229. data/vendor/assets/stylesheets/twitter/_responsive-768px-979px.scss +17 -0
  230. data/vendor/assets/stylesheets/twitter/_responsive-navbar.scss +153 -0
  231. data/vendor/assets/stylesheets/twitter/_responsive-utilities.scss +41 -0
  232. data/vendor/assets/stylesheets/twitter/_scaffolding.scss +29 -0
  233. data/vendor/assets/stylesheets/twitter/_sprites.scss +191 -0
  234. data/vendor/assets/stylesheets/twitter/_tables.scss +155 -0
  235. data/vendor/assets/stylesheets/twitter/_thumbnails.scss +47 -0
  236. data/vendor/assets/stylesheets/twitter/_tooltip.scss +35 -0
  237. data/vendor/assets/stylesheets/twitter/_type.scss +232 -0
  238. data/vendor/assets/stylesheets/twitter/_utilities.scss +23 -0
  239. data/vendor/assets/stylesheets/twitter/_variables.scss +204 -0
  240. data/vendor/assets/stylesheets/twitter/_wells.scss +27 -0
  241. data/vendor/assets/stylesheets/twitter/bootstrap.scss +62 -0
  242. data/vendor/assets/stylesheets/twitter/responsive.scss +48 -0
  243. metadata +304 -0
@@ -0,0 +1 @@
1
+ {"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Set Delimiter tags are used to change the tag delimiters for all content\nfollowing the tag in the current compilation unit.\n\nThe tag's content MUST be any two non-whitespace sequences (separated by\nwhitespace) EXCEPT an equals sign ('=') followed by the current closing\ndelimiter.\n\nSet Delimiter tags SHOULD be treated as standalone when appropriate.\n","tests":[{"name":"Pair Behavior","data":{"text":"Hey!"},"expected":"(Hey!)","template":"{{=<% %>=}}(<%text%>)","desc":"The equals sign (used on both sides) should permit delimiter changes."},{"name":"Special Characters","data":{"text":"It worked!"},"expected":"(It worked!)","template":"({{=[ ]=}}[text])","desc":"Characters with special meaning regexen should be valid delimiters."},{"name":"Sections","data":{"section":true,"data":"I got interpolated."},"expected":"[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n","template":"[\n{{#section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|\n]\n","desc":"Delimiters set outside sections should persist."},{"name":"Inverted Sections","data":{"section":false,"data":"I got interpolated."},"expected":"[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n","template":"[\n{{^section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|^section|\n {{data}}\n |data|\n|/section|\n]\n","desc":"Delimiters set outside inverted sections should persist."},{"name":"Partial Inheritence","data":{"value":"yes"},"expected":"[ .yes. ]\n[ .yes. ]\n","template":"[ {{>include}} ]\n{{= | | =}}\n[ |>include| ]\n","desc":"Delimiters set in a parent template should not affect a partial.","partials":{"include":".{{value}}."}},{"name":"Post-Partial Behavior","data":{"value":"yes"},"expected":"[ .yes. .yes. ]\n[ .yes. .|value|. ]\n","template":"[ {{>include}} ]\n[ .{{value}}. .|value|. ]\n","desc":"Delimiters set in a partial should not affect the parent template.","partials":{"include":".{{value}}. {{= | | =}} .|value|."}},{"name":"Surrounding Whitespace","data":{},"expected":"| |","template":"| {{=@ @=}} |","desc":"Surrounding whitespace should be left untouched."},{"name":"Outlying Whitespace (Inline)","data":{},"expected":" | \n","template":" | {{=@ @=}}\n","desc":"Whitespace should be left untouched."},{"name":"Standalone Tag","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n{{=@ @=}}\nEnd.\n","desc":"Standalone lines should be removed from the template."},{"name":"Indented Standalone Tag","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n {{=@ @=}}\nEnd.\n","desc":"Indented standalone lines should be removed from the template."},{"name":"Standalone Line Endings","data":{},"expected":"|\r\n|","template":"|\r\n{{= @ @ =}}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags."},{"name":"Standalone Without Previous Line","data":{},"expected":"=","template":" {{=@ @=}}\n=","desc":"Standalone tags should not require a newline to precede them."},{"name":"Standalone Without Newline","data":{},"expected":"=\n","template":"=\n {{=@ @=}}","desc":"Standalone tags should not require a newline to follow them."},{"name":"Pair with Padding","data":{},"expected":"||","template":"|{{= @ @ =}}|","desc":"Superfluous in-tag whitespace should be ignored."}]}
@@ -0,0 +1,158 @@
1
+ overview: |
2
+ Set Delimiter tags are used to change the tag delimiters for all content
3
+ following the tag in the current compilation unit.
4
+
5
+ The tag's content MUST be any two non-whitespace sequences (separated by
6
+ whitespace) EXCEPT an equals sign ('=') followed by the current closing
7
+ delimiter.
8
+
9
+ Set Delimiter tags SHOULD be treated as standalone when appropriate.
10
+ tests:
11
+ - name: Pair Behavior
12
+ desc: The equals sign (used on both sides) should permit delimiter changes.
13
+ data: { text: 'Hey!' }
14
+ template: '{{=<% %>=}}(<%text%>)'
15
+ expected: '(Hey!)'
16
+
17
+ - name: Special Characters
18
+ desc: Characters with special meaning regexen should be valid delimiters.
19
+ data: { text: 'It worked!' }
20
+ template: '({{=[ ]=}}[text])'
21
+ expected: '(It worked!)'
22
+
23
+ - name: Sections
24
+ desc: Delimiters set outside sections should persist.
25
+ data: { section: true, data: 'I got interpolated.' }
26
+ template: |
27
+ [
28
+ {{#section}}
29
+ {{data}}
30
+ |data|
31
+ {{/section}}
32
+
33
+ {{= | | =}}
34
+ |#section|
35
+ {{data}}
36
+ |data|
37
+ |/section|
38
+ ]
39
+ expected: |
40
+ [
41
+ I got interpolated.
42
+ |data|
43
+
44
+ {{data}}
45
+ I got interpolated.
46
+ ]
47
+
48
+ - name: Inverted Sections
49
+ desc: Delimiters set outside inverted sections should persist.
50
+ data: { section: false, data: 'I got interpolated.' }
51
+ template: |
52
+ [
53
+ {{^section}}
54
+ {{data}}
55
+ |data|
56
+ {{/section}}
57
+
58
+ {{= | | =}}
59
+ |^section|
60
+ {{data}}
61
+ |data|
62
+ |/section|
63
+ ]
64
+ expected: |
65
+ [
66
+ I got interpolated.
67
+ |data|
68
+
69
+ {{data}}
70
+ I got interpolated.
71
+ ]
72
+
73
+ - name: Partial Inheritence
74
+ desc: Delimiters set in a parent template should not affect a partial.
75
+ data: { value: 'yes' }
76
+ partials:
77
+ include: '.{{value}}.'
78
+ template: |
79
+ [ {{>include}} ]
80
+ {{= | | =}}
81
+ [ |>include| ]
82
+ expected: |
83
+ [ .yes. ]
84
+ [ .yes. ]
85
+
86
+ - name: Post-Partial Behavior
87
+ desc: Delimiters set in a partial should not affect the parent template.
88
+ data: { value: 'yes' }
89
+ partials:
90
+ include: '.{{value}}. {{= | | =}} .|value|.'
91
+ template: |
92
+ [ {{>include}} ]
93
+ [ .{{value}}. .|value|. ]
94
+ expected: |
95
+ [ .yes. .yes. ]
96
+ [ .yes. .|value|. ]
97
+
98
+ # Whitespace Sensitivity
99
+
100
+ - name: Surrounding Whitespace
101
+ desc: Surrounding whitespace should be left untouched.
102
+ data: { }
103
+ template: '| {{=@ @=}} |'
104
+ expected: '| |'
105
+
106
+ - name: Outlying Whitespace (Inline)
107
+ desc: Whitespace should be left untouched.
108
+ data: { }
109
+ template: " | {{=@ @=}}\n"
110
+ expected: " | \n"
111
+
112
+ - name: Standalone Tag
113
+ desc: Standalone lines should be removed from the template.
114
+ data: { }
115
+ template: |
116
+ Begin.
117
+ {{=@ @=}}
118
+ End.
119
+ expected: |
120
+ Begin.
121
+ End.
122
+
123
+ - name: Indented Standalone Tag
124
+ desc: Indented standalone lines should be removed from the template.
125
+ data: { }
126
+ template: |
127
+ Begin.
128
+ {{=@ @=}}
129
+ End.
130
+ expected: |
131
+ Begin.
132
+ End.
133
+
134
+ - name: Standalone Line Endings
135
+ desc: '"\r\n" should be considered a newline for standalone tags.'
136
+ data: { }
137
+ template: "|\r\n{{= @ @ =}}\r\n|"
138
+ expected: "|\r\n|"
139
+
140
+ - name: Standalone Without Previous Line
141
+ desc: Standalone tags should not require a newline to precede them.
142
+ data: { }
143
+ template: " {{=@ @=}}\n="
144
+ expected: "="
145
+
146
+ - name: Standalone Without Newline
147
+ desc: Standalone tags should not require a newline to follow them.
148
+ data: { }
149
+ template: "=\n {{=@ @=}}"
150
+ expected: "=\n"
151
+
152
+ # Whitespace Insensitivity
153
+
154
+ - name: Pair with Padding
155
+ desc: Superfluous in-tag whitespace should be ignored.
156
+ data: { }
157
+ template: '|{{= @ @ =}}|'
158
+ expected: '||'
@@ -0,0 +1 @@
1
+ {"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Interpolation tags are used to integrate dynamic content into the template.\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 data to replace the tag. A single period (`.`)\nindicates that the item currently sitting atop the context stack should be\nused; otherwise, name resolution is as follows:\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, the data is the value returned by the\n method with the given name.\n 5) 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.\nData should be coerced into a string (and escaped, if appropriate) before\ninterpolation.\n\nThe Interpolation tags MUST NOT be treated as standalone.\n","tests":[{"name":"No Interpolation","data":{},"expected":"Hello from {Mustache}!\n","template":"Hello from {Mustache}!\n","desc":"Mustache-free templates should render as-is."},{"name":"Basic Interpolation","data":{"subject":"world"},"expected":"Hello, world!\n","template":"Hello, {{subject}}!\n","desc":"Unadorned tags should interpolate content into the template."},{"name":"HTML Escaping","data":{"forbidden":"& \" < >"},"expected":"These characters should be HTML escaped: &amp; &quot; &lt; &gt;\n","template":"These characters should be HTML escaped: {{forbidden}}\n","desc":"Basic interpolation should be HTML escaped."},{"name":"Triple Mustache","data":{"forbidden":"& \" < >"},"expected":"These characters should not be HTML escaped: & \" < >\n","template":"These characters should not be HTML escaped: {{{forbidden}}}\n","desc":"Triple mustaches should interpolate without HTML escaping."},{"name":"Ampersand","data":{"forbidden":"& \" < >"},"expected":"These characters should not be HTML escaped: & \" < >\n","template":"These characters should not be HTML escaped: {{&forbidden}}\n","desc":"Ampersand should interpolate without HTML escaping."},{"name":"Basic Integer Interpolation","data":{"mph":85},"expected":"\"85 miles an hour!\"","template":"\"{{mph}} miles an hour!\"","desc":"Integers should interpolate seamlessly."},{"name":"Triple Mustache Integer Interpolation","data":{"mph":85},"expected":"\"85 miles an hour!\"","template":"\"{{{mph}}} miles an hour!\"","desc":"Integers should interpolate seamlessly."},{"name":"Ampersand Integer Interpolation","data":{"mph":85},"expected":"\"85 miles an hour!\"","template":"\"{{&mph}} miles an hour!\"","desc":"Integers should interpolate seamlessly."},{"name":"Basic Decimal Interpolation","data":{"power":1.21},"expected":"\"1.21 jiggawatts!\"","template":"\"{{power}} jiggawatts!\"","desc":"Decimals should interpolate seamlessly with proper significance."},{"name":"Triple Mustache Decimal Interpolation","data":{"power":1.21},"expected":"\"1.21 jiggawatts!\"","template":"\"{{{power}}} jiggawatts!\"","desc":"Decimals should interpolate seamlessly with proper significance."},{"name":"Ampersand Decimal Interpolation","data":{"power":1.21},"expected":"\"1.21 jiggawatts!\"","template":"\"{{&power}} jiggawatts!\"","desc":"Decimals should interpolate seamlessly with proper significance."},{"name":"Basic Context Miss Interpolation","data":{},"expected":"I () be seen!","template":"I ({{cannot}}) be seen!","desc":"Failed context lookups should default to empty strings."},{"name":"Triple Mustache Context Miss Interpolation","data":{},"expected":"I () be seen!","template":"I ({{{cannot}}}) be seen!","desc":"Failed context lookups should default to empty strings."},{"name":"Ampersand Context Miss Interpolation","data":{},"expected":"I () be seen!","template":"I ({{&cannot}}) be seen!","desc":"Failed context lookups should default to empty strings."},{"name":"Dotted Names - Basic Interpolation","data":{"person":{"name":"Joe"}},"expected":"\"Joe\" == \"Joe\"","template":"\"{{person.name}}\" == \"{{#person}}{{name}}{{/person}}\"","desc":"Dotted names should be considered a form of shorthand for sections."},{"name":"Dotted Names - Triple Mustache Interpolation","data":{"person":{"name":"Joe"}},"expected":"\"Joe\" == \"Joe\"","template":"\"{{{person.name}}}\" == \"{{#person}}{{{name}}}{{/person}}\"","desc":"Dotted names should be considered a form of shorthand for sections."},{"name":"Dotted Names - Ampersand Interpolation","data":{"person":{"name":"Joe"}},"expected":"\"Joe\" == \"Joe\"","template":"\"{{&person.name}}\" == \"{{#person}}{{&name}}{{/person}}\"","desc":"Dotted names should be considered a form of shorthand for sections."},{"name":"Dotted Names - Arbitrary Depth","data":{"a":{"b":{"c":{"d":{"e":{"name":"Phil"}}}}}},"expected":"\"Phil\" == \"Phil\"","template":"\"{{a.b.c.d.e.name}}\" == \"Phil\"","desc":"Dotted names should be functional to any level of nesting."},{"name":"Dotted Names - Broken Chains","data":{"a":{}},"expected":"\"\" == \"\"","template":"\"{{a.b.c}}\" == \"\"","desc":"Any falsey value prior to the last part of the name should yield ''."},{"name":"Dotted Names - Broken Chain Resolution","data":{"a":{"b":{}},"c":{"name":"Jim"}},"expected":"\"\" == \"\"","template":"\"{{a.b.c.name}}\" == \"\"","desc":"Each part of a dotted name should resolve only against its parent."},{"name":"Dotted Names - Initial Resolution","data":{"a":{"b":{"c":{"d":{"e":{"name":"Phil"}}}}},"b":{"c":{"d":{"e":{"name":"Wrong"}}}}},"expected":"\"Phil\" == \"Phil\"","template":"\"{{#a}}{{b.c.d.e.name}}{{/a}}\" == \"Phil\"","desc":"The first part of a dotted name should resolve as any other name."},{"name":"Interpolation - Surrounding Whitespace","data":{"string":"---"},"expected":"| --- |","template":"| {{string}} |","desc":"Interpolation should not alter surrounding whitespace."},{"name":"Triple Mustache - Surrounding Whitespace","data":{"string":"---"},"expected":"| --- |","template":"| {{{string}}} |","desc":"Interpolation should not alter surrounding whitespace."},{"name":"Ampersand - Surrounding Whitespace","data":{"string":"---"},"expected":"| --- |","template":"| {{&string}} |","desc":"Interpolation should not alter surrounding whitespace."},{"name":"Interpolation - Standalone","data":{"string":"---"},"expected":" ---\n","template":" {{string}}\n","desc":"Standalone interpolation should not alter surrounding whitespace."},{"name":"Triple Mustache - Standalone","data":{"string":"---"},"expected":" ---\n","template":" {{{string}}}\n","desc":"Standalone interpolation should not alter surrounding whitespace."},{"name":"Ampersand - Standalone","data":{"string":"---"},"expected":" ---\n","template":" {{&string}}\n","desc":"Standalone interpolation should not alter surrounding whitespace."},{"name":"Interpolation With Padding","data":{"string":"---"},"expected":"|---|","template":"|{{ string }}|","desc":"Superfluous in-tag whitespace should be ignored."},{"name":"Triple Mustache With Padding","data":{"string":"---"},"expected":"|---|","template":"|{{{ string }}}|","desc":"Superfluous in-tag whitespace should be ignored."},{"name":"Ampersand With Padding","data":{"string":"---"},"expected":"|---|","template":"|{{& string }}|","desc":"Superfluous in-tag whitespace should be ignored."}]}
@@ -0,0 +1,230 @@
1
+ overview: |
2
+ Interpolation tags are used to integrate dynamic content into the template.
3
+
4
+ The tag's content MUST be a non-whitespace character sequence NOT containing
5
+ the current closing delimiter.
6
+
7
+ This tag's content names the data to replace the tag. A single period (`.`)
8
+ indicates that the item currently sitting atop the context stack should be
9
+ used; otherwise, name resolution is as follows:
10
+ 1) Split the name on periods; the first part is the name to resolve, any
11
+ remaining parts should be retained.
12
+ 2) Walk the context stack from top to bottom, finding the first context
13
+ that is a) a hash containing the name as a key OR b) an object responding
14
+ to a method with the given name.
15
+ 3) If the context is a hash, the data is the value associated with the
16
+ name.
17
+ 4) If the context is an object, the data is the value returned by the
18
+ method with the given name.
19
+ 5) If any name parts were retained in step 1, each should be resolved
20
+ against a context stack containing only the result from the former
21
+ resolution. If any part fails resolution, the result should be considered
22
+ falsey, and should interpolate as the empty string.
23
+ Data should be coerced into a string (and escaped, if appropriate) before
24
+ interpolation.
25
+
26
+ The Interpolation tags MUST NOT be treated as standalone.
27
+ tests:
28
+ - name: No Interpolation
29
+ desc: Mustache-free templates should render as-is.
30
+ data: { }
31
+ template: |
32
+ Hello from {Mustache}!
33
+ expected: |
34
+ Hello from {Mustache}!
35
+
36
+ - name: Basic Interpolation
37
+ desc: Unadorned tags should interpolate content into the template.
38
+ data: { subject: "world" }
39
+ template: |
40
+ Hello, {{subject}}!
41
+ expected: |
42
+ Hello, world!
43
+
44
+ - name: HTML Escaping
45
+ desc: Basic interpolation should be HTML escaped.
46
+ data: { forbidden: '& " < >' }
47
+ template: |
48
+ These characters should be HTML escaped: {{forbidden}}
49
+ expected: |
50
+ These characters should be HTML escaped: &amp; &quot; &lt; &gt;
51
+
52
+ - name: Triple Mustache
53
+ desc: Triple mustaches should interpolate without HTML escaping.
54
+ data: { forbidden: '& " < >' }
55
+ template: |
56
+ These characters should not be HTML escaped: {{{forbidden}}}
57
+ expected: |
58
+ These characters should not be HTML escaped: & " < >
59
+
60
+ - name: Ampersand
61
+ desc: Ampersand should interpolate without HTML escaping.
62
+ data: { forbidden: '& " < >' }
63
+ template: |
64
+ These characters should not be HTML escaped: {{&forbidden}}
65
+ expected: |
66
+ These characters should not be HTML escaped: & " < >
67
+
68
+ - name: Basic Integer Interpolation
69
+ desc: Integers should interpolate seamlessly.
70
+ data: { mph: 85 }
71
+ template: '"{{mph}} miles an hour!"'
72
+ expected: '"85 miles an hour!"'
73
+
74
+ - name: Triple Mustache Integer Interpolation
75
+ desc: Integers should interpolate seamlessly.
76
+ data: { mph: 85 }
77
+ template: '"{{{mph}}} miles an hour!"'
78
+ expected: '"85 miles an hour!"'
79
+
80
+ - name: Ampersand Integer Interpolation
81
+ desc: Integers should interpolate seamlessly.
82
+ data: { mph: 85 }
83
+ template: '"{{&mph}} miles an hour!"'
84
+ expected: '"85 miles an hour!"'
85
+
86
+ - name: Basic Decimal Interpolation
87
+ desc: Decimals should interpolate seamlessly with proper significance.
88
+ data: { power: 1.210 }
89
+ template: '"{{power}} jiggawatts!"'
90
+ expected: '"1.21 jiggawatts!"'
91
+
92
+ - name: Triple Mustache Decimal Interpolation
93
+ desc: Decimals should interpolate seamlessly with proper significance.
94
+ data: { power: 1.210 }
95
+ template: '"{{{power}}} jiggawatts!"'
96
+ expected: '"1.21 jiggawatts!"'
97
+
98
+ - name: Ampersand Decimal Interpolation
99
+ desc: Decimals should interpolate seamlessly with proper significance.
100
+ data: { power: 1.210 }
101
+ template: '"{{&power}} jiggawatts!"'
102
+ expected: '"1.21 jiggawatts!"'
103
+
104
+ # Context Misses
105
+
106
+ - name: Basic Context Miss Interpolation
107
+ desc: Failed context lookups should default to empty strings.
108
+ data: { }
109
+ template: "I ({{cannot}}) be seen!"
110
+ expected: "I () be seen!"
111
+
112
+ - name: Triple Mustache Context Miss Interpolation
113
+ desc: Failed context lookups should default to empty strings.
114
+ data: { }
115
+ template: "I ({{{cannot}}}) be seen!"
116
+ expected: "I () be seen!"
117
+
118
+ - name: Ampersand Context Miss Interpolation
119
+ desc: Failed context lookups should default to empty strings.
120
+ data: { }
121
+ template: "I ({{&cannot}}) be seen!"
122
+ expected: "I () be seen!"
123
+
124
+ # Dotted Names
125
+
126
+ - name: Dotted Names - Basic Interpolation
127
+ desc: Dotted names should be considered a form of shorthand for sections.
128
+ data: { person: { name: 'Joe' } }
129
+ template: '"{{person.name}}" == "{{#person}}{{name}}{{/person}}"'
130
+ expected: '"Joe" == "Joe"'
131
+
132
+ - name: Dotted Names - Triple Mustache Interpolation
133
+ desc: Dotted names should be considered a form of shorthand for sections.
134
+ data: { person: { name: 'Joe' } }
135
+ template: '"{{{person.name}}}" == "{{#person}}{{{name}}}{{/person}}"'
136
+ expected: '"Joe" == "Joe"'
137
+
138
+ - name: Dotted Names - Ampersand Interpolation
139
+ desc: Dotted names should be considered a form of shorthand for sections.
140
+ data: { person: { name: 'Joe' } }
141
+ template: '"{{&person.name}}" == "{{#person}}{{&name}}{{/person}}"'
142
+ expected: '"Joe" == "Joe"'
143
+
144
+ - name: Dotted Names - Arbitrary Depth
145
+ desc: Dotted names should be functional to any level of nesting.
146
+ data:
147
+ a: { b: { c: { d: { e: { name: 'Phil' } } } } }
148
+ template: '"{{a.b.c.d.e.name}}" == "Phil"'
149
+ expected: '"Phil" == "Phil"'
150
+
151
+ - name: Dotted Names - Broken Chains
152
+ desc: Any falsey value prior to the last part of the name should yield ''.
153
+ data:
154
+ a: { }
155
+ template: '"{{a.b.c}}" == ""'
156
+ expected: '"" == ""'
157
+
158
+ - name: Dotted Names - Broken Chain Resolution
159
+ desc: Each part of a dotted name should resolve only against its parent.
160
+ data:
161
+ a: { b: { } }
162
+ c: { name: 'Jim' }
163
+ template: '"{{a.b.c.name}}" == ""'
164
+ expected: '"" == ""'
165
+
166
+ - name: Dotted Names - Initial Resolution
167
+ desc: The first part of a dotted name should resolve as any other name.
168
+ data:
169
+ a: { b: { c: { d: { e: { name: 'Phil' } } } } }
170
+ b: { c: { d: { e: { name: 'Wrong' } } } }
171
+ template: '"{{#a}}{{b.c.d.e.name}}{{/a}}" == "Phil"'
172
+ expected: '"Phil" == "Phil"'
173
+
174
+ # Whitespace Sensitivity
175
+
176
+ - name: Interpolation - Surrounding Whitespace
177
+ desc: Interpolation should not alter surrounding whitespace.
178
+ data: { string: '---' }
179
+ template: '| {{string}} |'
180
+ expected: '| --- |'
181
+
182
+ - name: Triple Mustache - Surrounding Whitespace
183
+ desc: Interpolation should not alter surrounding whitespace.
184
+ data: { string: '---' }
185
+ template: '| {{{string}}} |'
186
+ expected: '| --- |'
187
+
188
+ - name: Ampersand - Surrounding Whitespace
189
+ desc: Interpolation should not alter surrounding whitespace.
190
+ data: { string: '---' }
191
+ template: '| {{&string}} |'
192
+ expected: '| --- |'
193
+
194
+ - name: Interpolation - Standalone
195
+ desc: Standalone interpolation should not alter surrounding whitespace.
196
+ data: { string: '---' }
197
+ template: " {{string}}\n"
198
+ expected: " ---\n"
199
+
200
+ - name: Triple Mustache - Standalone
201
+ desc: Standalone interpolation should not alter surrounding whitespace.
202
+ data: { string: '---' }
203
+ template: " {{{string}}}\n"
204
+ expected: " ---\n"
205
+
206
+ - name: Ampersand - Standalone
207
+ desc: Standalone interpolation should not alter surrounding whitespace.
208
+ data: { string: '---' }
209
+ template: " {{&string}}\n"
210
+ expected: " ---\n"
211
+
212
+ # Whitespace Insensitivity
213
+
214
+ - name: Interpolation With Padding
215
+ desc: Superfluous in-tag whitespace should be ignored.
216
+ data: { string: "---" }
217
+ template: '|{{ string }}|'
218
+ expected: '|---|'
219
+
220
+ - name: Triple Mustache With Padding
221
+ desc: Superfluous in-tag whitespace should be ignored.
222
+ data: { string: "---" }
223
+ template: '|{{{ string }}}|'
224
+ expected: '|---|'
225
+
226
+ - name: Ampersand With Padding
227
+ desc: Superfluous in-tag whitespace should be ignored.
228
+ data: { string: "---" }
229
+ template: '|{{& string }}|'
230
+ expected: '|---|'
@@ -0,0 +1 @@
1
+ {"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Inverted Section tags and End Section tags are used in combination to wrap a\nsection of the template.\n\nThese tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Inverted Section tag MUST be\nfollowed by an End Section tag with the same content within the same\nsection.\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\nThis section MUST NOT be rendered unless the data list is empty.\n\nInverted Section and End Section tags SHOULD be treated as standalone when\nappropriate.\n","tests":[{"name":"Falsey","data":{"boolean":false},"expected":"\"This should be rendered.\"","template":"\"{{^boolean}}This should be rendered.{{/boolean}}\"","desc":"Falsey sections should have their contents rendered."},{"name":"Truthy","data":{"boolean":true},"expected":"\"\"","template":"\"{{^boolean}}This should not be rendered.{{/boolean}}\"","desc":"Truthy sections should have their contents omitted."},{"name":"Context","data":{"context":{"name":"Joe"}},"expected":"\"\"","template":"\"{{^context}}Hi {{name}}.{{/context}}\"","desc":"Objects and hashes should behave like truthy values."},{"name":"List","data":{"list":[{"n":1},{"n":2},{"n":3}]},"expected":"\"\"","template":"\"{{^list}}{{n}}{{/list}}\"","desc":"Lists should behave like truthy values."},{"name":"Empty List","data":{"list":[]},"expected":"\"Yay lists!\"","template":"\"{{^list}}Yay lists!{{/list}}\"","desc":"Empty lists should behave like falsey values."},{"name":"Doubled","data":{"two":"second","bool":false},"expected":"* first\n* second\n* third\n","template":"{{^bool}}\n* first\n{{/bool}}\n* {{two}}\n{{^bool}}\n* third\n{{/bool}}\n","desc":"Multiple inverted sections per template should be permitted."},{"name":"Nested (Falsey)","data":{"bool":false},"expected":"| A B C D E |","template":"| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |","desc":"Nested falsey sections should have their contents rendered."},{"name":"Nested (Truthy)","data":{"bool":true},"expected":"| A E |","template":"| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |","desc":"Nested truthy sections should be omitted."},{"name":"Context Misses","data":{},"expected":"[Cannot find key 'missing'!]","template":"[{{^missing}}Cannot find key 'missing'!{{/missing}}]","desc":"Failed context lookups should be considered falsey."},{"name":"Dotted Names - Truthy","data":{"a":{"b":{"c":true}}},"expected":"\"\" == \"\"","template":"\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"\"","desc":"Dotted names should be valid for Inverted Section tags."},{"name":"Dotted Names - Falsey","data":{"a":{"b":{"c":false}}},"expected":"\"Not Here\" == \"Not Here\"","template":"\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"","desc":"Dotted names should be valid for Inverted Section tags."},{"name":"Dotted Names - Broken Chains","data":{"a":{}},"expected":"\"Not Here\" == \"Not Here\"","template":"\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"","desc":"Dotted names that cannot be resolved should be considered falsey."},{"name":"Surrounding Whitespace","data":{"boolean":false},"expected":" | \t|\t | \n","template":" | {{^boolean}}\t|\t{{/boolean}} | \n","desc":"Inverted sections should not alter surrounding whitespace."},{"name":"Internal Whitespace","data":{"boolean":false},"expected":" | \n | \n","template":" | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n","desc":"Inverted should not alter internal whitespace."},{"name":"Indented Inline Sections","data":{"boolean":false},"expected":" NO\n WAY\n","template":" {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n","desc":"Single-line sections should not alter surrounding whitespace."},{"name":"Standalone Lines","data":{"boolean":false},"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":"Standalone Indented Lines","data":{"boolean":false},"expected":"| This Is\n|\n| A Line\n","template":"| This Is\n {{^boolean}}\n|\n {{/boolean}}\n| A Line\n","desc":"Standalone indented lines should be removed from the template."},{"name":"Standalone Line Endings","data":{"boolean":false},"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":false},"expected":"^\n/","template":" {{^boolean}}\n^{{/boolean}}\n/","desc":"Standalone tags should not require a newline to precede them."},{"name":"Standalone Without Newline","data":{"boolean":false},"expected":"^\n/\n","template":"^{{^boolean}}\n/\n {{/boolean}}","desc":"Standalone tags should not require a newline to follow them."},{"name":"Padding","data":{"boolean":false},"expected":"|=|","template":"|{{^ boolean }}={{/ boolean }}|","desc":"Superfluous in-tag whitespace should be ignored."}]}
@@ -0,0 +1,193 @@
1
+ overview: |
2
+ Inverted Section tags and End Section tags are used in combination to wrap a
3
+ section of the template.
4
+
5
+ These tags' content MUST be a non-whitespace character sequence NOT
6
+ containing the current closing delimiter; each Inverted Section tag MUST be
7
+ followed by an End Section tag with the same content within the same
8
+ section.
9
+
10
+ This tag's content names the data to replace the tag. Name resolution is as
11
+ follows:
12
+ 1) Split the name on periods; the first part is the name to resolve, any
13
+ remaining parts should be retained.
14
+ 2) Walk the context stack from top to bottom, finding the first context
15
+ that is a) a hash containing the name as a key OR b) an object responding
16
+ to a method with the given name.
17
+ 3) If the context is a hash, the data is the value associated with the
18
+ name.
19
+ 4) If the context is an object and the method with the given name has an
20
+ arity of 1, the method SHOULD be called with a String containing the
21
+ unprocessed contents of the sections; the data is the value returned.
22
+ 5) Otherwise, the data is the value returned by calling the method with
23
+ the given name.
24
+ 6) If any name parts were retained in step 1, each should be resolved
25
+ against a context stack containing only the result from the former
26
+ resolution. If any part fails resolution, the result should be considered
27
+ falsey, and should interpolate as the empty string.
28
+ If the data is not of a list type, it is coerced into a list as follows: if
29
+ the data is truthy (e.g. `!!data == true`), use a single-element list
30
+ containing the data, otherwise use an empty list.
31
+
32
+ This section MUST NOT be rendered unless the data list is empty.
33
+
34
+ Inverted Section and End Section tags SHOULD be treated as standalone when
35
+ appropriate.
36
+ tests:
37
+ - name: Falsey
38
+ desc: Falsey sections should have their contents rendered.
39
+ data: { boolean: false }
40
+ template: '"{{^boolean}}This should be rendered.{{/boolean}}"'
41
+ expected: '"This should be rendered."'
42
+
43
+ - name: Truthy
44
+ desc: Truthy sections should have their contents omitted.
45
+ data: { boolean: true }
46
+ template: '"{{^boolean}}This should not be rendered.{{/boolean}}"'
47
+ expected: '""'
48
+
49
+ - name: Context
50
+ desc: Objects and hashes should behave like truthy values.
51
+ data: { context: { name: 'Joe' } }
52
+ template: '"{{^context}}Hi {{name}}.{{/context}}"'
53
+ expected: '""'
54
+
55
+ - name: List
56
+ desc: Lists should behave like truthy values.
57
+ data: { list: [ { n: 1 }, { n: 2 }, { n: 3 } ] }
58
+ template: '"{{^list}}{{n}}{{/list}}"'
59
+ expected: '""'
60
+
61
+ - name: Empty List
62
+ desc: Empty lists should behave like falsey values.
63
+ data: { list: [ ] }
64
+ template: '"{{^list}}Yay lists!{{/list}}"'
65
+ expected: '"Yay lists!"'
66
+
67
+ - name: Doubled
68
+ desc: Multiple inverted sections per template should be permitted.
69
+ data: { bool: false, two: 'second' }
70
+ template: |
71
+ {{^bool}}
72
+ * first
73
+ {{/bool}}
74
+ * {{two}}
75
+ {{^bool}}
76
+ * third
77
+ {{/bool}}
78
+ expected: |
79
+ * first
80
+ * second
81
+ * third
82
+
83
+ - name: Nested (Falsey)
84
+ desc: Nested falsey sections should have their contents rendered.
85
+ data: { bool: false }
86
+ template: "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |"
87
+ expected: "| A B C D E |"
88
+
89
+ - name: Nested (Truthy)
90
+ desc: Nested truthy sections should be omitted.
91
+ data: { bool: true }
92
+ template: "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |"
93
+ expected: "| A E |"
94
+
95
+ - name: Context Misses
96
+ desc: Failed context lookups should be considered falsey.
97
+ data: { }
98
+ template: "[{{^missing}}Cannot find key 'missing'!{{/missing}}]"
99
+ expected: "[Cannot find key 'missing'!]"
100
+
101
+ # Dotted Names
102
+
103
+ - name: Dotted Names - Truthy
104
+ desc: Dotted names should be valid for Inverted Section tags.
105
+ data: { a: { b: { c: true } } }
106
+ template: '"{{^a.b.c}}Not Here{{/a.b.c}}" == ""'
107
+ expected: '"" == ""'
108
+
109
+ - name: Dotted Names - Falsey
110
+ desc: Dotted names should be valid for Inverted Section tags.
111
+ data: { a: { b: { c: false } } }
112
+ template: '"{{^a.b.c}}Not Here{{/a.b.c}}" == "Not Here"'
113
+ expected: '"Not Here" == "Not Here"'
114
+
115
+ - name: Dotted Names - Broken Chains
116
+ desc: Dotted names that cannot be resolved should be considered falsey.
117
+ data: { a: { } }
118
+ template: '"{{^a.b.c}}Not Here{{/a.b.c}}" == "Not Here"'
119
+ expected: '"Not Here" == "Not Here"'
120
+
121
+ # Whitespace Sensitivity
122
+
123
+ - name: Surrounding Whitespace
124
+ desc: Inverted sections should not alter surrounding whitespace.
125
+ data: { boolean: false }
126
+ template: " | {{^boolean}}\t|\t{{/boolean}} | \n"
127
+ expected: " | \t|\t | \n"
128
+
129
+ - name: Internal Whitespace
130
+ desc: Inverted should not alter internal whitespace.
131
+ data: { boolean: false }
132
+ template: " | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n"
133
+ expected: " | \n | \n"
134
+
135
+ - name: Indented Inline Sections
136
+ desc: Single-line sections should not alter surrounding whitespace.
137
+ data: { boolean: false }
138
+ template: " {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n"
139
+ expected: " NO\n WAY\n"
140
+
141
+ - name: Standalone Lines
142
+ desc: Standalone lines should be removed from the template.
143
+ data: { boolean: false }
144
+ template: |
145
+ | This Is
146
+ {{^boolean}}
147
+ |
148
+ {{/boolean}}
149
+ | A Line
150
+ expected: |
151
+ | This Is
152
+ |
153
+ | A Line
154
+
155
+ - name: Standalone Indented Lines
156
+ desc: Standalone indented lines should be removed from the template.
157
+ data: { boolean: false }
158
+ template: |
159
+ | This Is
160
+ {{^boolean}}
161
+ |
162
+ {{/boolean}}
163
+ | A Line
164
+ expected: |
165
+ | This Is
166
+ |
167
+ | A Line
168
+
169
+ - name: Standalone Line Endings
170
+ desc: '"\r\n" should be considered a newline for standalone tags.'
171
+ data: { boolean: false }
172
+ template: "|\r\n{{^boolean}}\r\n{{/boolean}}\r\n|"
173
+ expected: "|\r\n|"
174
+
175
+ - name: Standalone Without Previous Line
176
+ desc: Standalone tags should not require a newline to precede them.
177
+ data: { boolean: false }
178
+ template: " {{^boolean}}\n^{{/boolean}}\n/"
179
+ expected: "^\n/"
180
+
181
+ - name: Standalone Without Newline
182
+ desc: Standalone tags should not require a newline to follow them.
183
+ data: { boolean: false }
184
+ template: "^{{^boolean}}\n/\n {{/boolean}}"
185
+ expected: "^\n/\n"
186
+
187
+ # Whitespace Insensitivity
188
+
189
+ - name: Padding
190
+ desc: Superfluous in-tag whitespace should be ignored.
191
+ data: { boolean: false }
192
+ template: '|{{^ boolean }}={{/ boolean }}|'
193
+ expected: '|=|'