haml 3.2.0.alpha.10 → 3.2.0.alpha.13

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

Files changed (389) hide show
  1. data/.yardopts +19 -7
  2. data/CHANGELOG.md +1224 -0
  3. data/FAQ.md +157 -0
  4. data/README.md +99 -62
  5. data/REFERENCE.md +1404 -0
  6. data/Rakefile +52 -341
  7. data/init.rb +1 -18
  8. data/lib/haml.rb +6 -30
  9. data/lib/haml/buffer.rb +37 -16
  10. data/lib/haml/compiler.rb +52 -13
  11. data/lib/haml/engine.rb +61 -44
  12. data/lib/haml/exec.rb +21 -4
  13. data/lib/haml/filters.rb +136 -166
  14. data/lib/haml/helpers.rb +37 -10
  15. data/lib/haml/helpers/action_view_extensions.rb +2 -1
  16. data/lib/haml/helpers/action_view_mods.rb +67 -181
  17. data/lib/haml/helpers/rails_323_textarea_fix.rb +39 -0
  18. data/lib/haml/helpers/xss_mods.rb +9 -11
  19. data/lib/haml/html.rb +22 -9
  20. data/lib/haml/html/erb.rb +1 -1
  21. data/lib/haml/parser.rb +22 -15
  22. data/lib/haml/railtie.rb +2 -13
  23. data/lib/haml/template.rb +18 -85
  24. data/lib/haml/template/options.rb +1 -1
  25. data/lib/haml/template/plugin.rb +15 -101
  26. data/lib/haml/util.rb +120 -603
  27. data/lib/haml/version.rb +1 -107
  28. data/test/{haml/engine_test.rb → engine_test.rb} +137 -143
  29. data/test/{haml/erb → erb}/_av_partial_1.erb +1 -1
  30. data/test/{haml/erb → erb}/_av_partial_2.erb +1 -1
  31. data/test/{haml/erb → erb}/action_view.erb +1 -1
  32. data/test/{haml/erb → erb}/standard.erb +0 -0
  33. data/test/filters_test.rb +141 -0
  34. data/test/gemfiles/Gemfile.rails-3.0.x +4 -6
  35. data/test/gemfiles/Gemfile.rails-3.1.x +5 -6
  36. data/test/gemfiles/Gemfile.rails-3.2.x +6 -0
  37. data/test/haml-spec/LICENSE +14 -0
  38. data/test/{haml/spec → haml-spec}/README.md +26 -17
  39. data/test/haml-spec/lua_haml_spec.lua +38 -0
  40. data/test/haml-spec/perl_haml_test.pl +81 -0
  41. data/test/haml-spec/ruby_haml_test.rb +23 -0
  42. data/test/{haml/spec → haml-spec}/tests.json +132 -54
  43. data/test/{haml/helper_test.rb → helper_test.rb} +50 -36
  44. data/test/{haml/html2haml → html2haml}/erb_tests.rb +0 -0
  45. data/test/{haml/html2haml_test.rb → html2haml_test.rb} +11 -5
  46. data/test/{haml/markaby → markaby}/standard.mab +0 -0
  47. data/test/{haml/mocks → mocks}/article.rb +0 -0
  48. data/test/{haml/results → results}/content_for_layout.xhtml +0 -0
  49. data/test/{haml/results → results}/eval_suppressed.xhtml +0 -0
  50. data/test/{haml/results → results}/helpers.xhtml +0 -0
  51. data/test/{haml/results → results}/helpful.xhtml +0 -0
  52. data/test/{haml/results → results}/just_stuff.xhtml +0 -0
  53. data/test/{haml/results → results}/list.xhtml +0 -0
  54. data/test/{haml/results → results}/nuke_inner_whitespace.xhtml +0 -0
  55. data/test/{haml/results → results}/nuke_outer_whitespace.xhtml +0 -0
  56. data/test/{haml/results → results}/original_engine.xhtml +0 -0
  57. data/test/{haml/results → results}/partial_layout.xhtml +0 -0
  58. data/test/{haml/results → results}/partials.xhtml +0 -0
  59. data/test/{haml/results → results}/render_layout.xhtml +0 -0
  60. data/test/{haml/results → results}/silent_script.xhtml +1 -1
  61. data/test/{haml/results → results}/standard.xhtml +0 -0
  62. data/test/{haml/results → results}/tag_parsing.xhtml +0 -0
  63. data/test/{haml/results → results}/very_basic.xhtml +0 -0
  64. data/test/{haml/results → results}/whitespace_handling.xhtml +46 -50
  65. data/test/{haml/template_test.rb → template_test.rb} +20 -81
  66. data/test/{haml/templates → templates}/_av_partial_1.haml +1 -1
  67. data/test/{haml/templates → templates}/_av_partial_1_ugly.haml +1 -1
  68. data/test/{haml/templates → templates}/_av_partial_2.haml +1 -1
  69. data/test/{haml/templates → templates}/_av_partial_2_ugly.haml +1 -1
  70. data/test/{haml/templates → templates}/_layout.erb +0 -0
  71. data/test/{haml/templates → templates}/_layout_for_partial.haml +0 -0
  72. data/test/{haml/templates → templates}/_partial.haml +0 -0
  73. data/test/{haml/templates → templates}/_text_area.haml +0 -0
  74. data/test/{haml/templates → templates}/action_view.haml +1 -1
  75. data/test/{haml/templates → templates}/action_view_ugly.haml +1 -1
  76. data/test/{haml/templates → templates}/breakage.haml +0 -0
  77. data/test/{haml/templates → templates}/content_for_layout.haml +0 -0
  78. data/test/{haml/templates → templates}/eval_suppressed.haml +0 -0
  79. data/test/{haml/templates → templates}/helpers.haml +0 -0
  80. data/test/{haml/templates → templates}/helpful.haml +0 -0
  81. data/test/{haml/templates → templates}/just_stuff.haml +0 -0
  82. data/test/{haml/templates → templates}/list.haml +0 -0
  83. data/test/{haml/templates → templates}/nuke_inner_whitespace.haml +0 -0
  84. data/test/{haml/templates → templates}/nuke_outer_whitespace.haml +0 -0
  85. data/test/{haml/templates → templates}/original_engine.haml +0 -0
  86. data/test/templates/partial_layout.haml +3 -0
  87. data/test/{haml/templates → templates}/partialize.haml +0 -0
  88. data/test/{haml/templates → templates}/partials.haml +0 -0
  89. data/test/{haml/templates → templates}/render_layout.haml +0 -0
  90. data/test/{haml/templates → templates}/silent_script.haml +2 -2
  91. data/test/{haml/templates → templates}/standard.haml +0 -0
  92. data/test/{haml/templates → templates}/standard_ugly.haml +0 -0
  93. data/test/{haml/templates → templates}/tag_parsing.haml +0 -0
  94. data/test/{haml/templates → templates}/very_basic.haml +0 -0
  95. data/test/{haml/templates → templates}/whitespace_handling.haml +0 -0
  96. data/test/test_helper.rb +42 -34
  97. data/test/util_test.rb +80 -0
  98. metadata +259 -427
  99. data/CONTRIBUTING +0 -3
  100. data/REVISION +0 -1
  101. data/VERSION +0 -1
  102. data/VERSION_NAME +0 -1
  103. data/extra/update_watch.rb +0 -13
  104. data/lib/haml/root.rb +0 -7
  105. data/lib/haml/shared.rb +0 -78
  106. data/lib/haml/template/patch.rb +0 -58
  107. data/lib/sass.rb +0 -8
  108. data/lib/sass/plugin.rb +0 -10
  109. data/lib/sass/rails2_shim.rb +0 -9
  110. data/lib/sass/rails3_shim.rb +0 -16
  111. data/test/benchmark.rb +0 -91
  112. data/test/gemfiles/Gemfile.rails-2.0.x +0 -8
  113. data/test/gemfiles/Gemfile.rails-2.0.x.lock +0 -38
  114. data/test/gemfiles/Gemfile.rails-2.1.x +0 -8
  115. data/test/gemfiles/Gemfile.rails-2.1.x.lock +0 -38
  116. data/test/gemfiles/Gemfile.rails-2.2.x +0 -8
  117. data/test/gemfiles/Gemfile.rails-2.2.x.lock +0 -38
  118. data/test/gemfiles/Gemfile.rails-2.3.x +0 -8
  119. data/test/gemfiles/Gemfile.rails-2.3.x.lock +0 -40
  120. data/test/gemfiles/Gemfile.rails-3.0.x.lock +0 -85
  121. data/test/gemfiles/Gemfile.rails-3.1.x.lock +0 -98
  122. data/test/gemfiles/Gemfile.rails-xss-2.3.x +0 -9
  123. data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +0 -42
  124. data/test/haml/results/filters.xhtml +0 -62
  125. data/test/haml/spec/lua_haml_spec.lua +0 -30
  126. data/test/haml/spec/ruby_haml_test.rb +0 -19
  127. data/test/haml/spec_test.rb +0 -44
  128. data/test/haml/templates/filters.haml +0 -66
  129. data/test/haml/templates/partial_layout.haml +0 -10
  130. data/test/haml/util_test.rb +0 -300
  131. data/test/linked_rails.rb +0 -42
  132. data/vendor/sass/CONTRIBUTING +0 -3
  133. data/vendor/sass/MIT-LICENSE +0 -20
  134. data/vendor/sass/README.md +0 -201
  135. data/vendor/sass/Rakefile +0 -339
  136. data/vendor/sass/TODO +0 -39
  137. data/vendor/sass/VERSION +0 -1
  138. data/vendor/sass/VERSION_NAME +0 -1
  139. data/vendor/sass/bin/sass +0 -8
  140. data/vendor/sass/bin/sass-convert +0 -7
  141. data/vendor/sass/bin/scss +0 -8
  142. data/vendor/sass/doc-src/FAQ.md +0 -35
  143. data/vendor/sass/doc-src/INDENTED_SYNTAX.md +0 -210
  144. data/vendor/sass/doc-src/SASS_CHANGELOG.md +0 -2327
  145. data/vendor/sass/doc-src/SASS_REFERENCE.md +0 -1965
  146. data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +0 -155
  147. data/vendor/sass/ext/extconf.rb +0 -10
  148. data/vendor/sass/extra/update_watch.rb +0 -13
  149. data/vendor/sass/init.rb +0 -18
  150. data/vendor/sass/lib/sass.rb +0 -73
  151. data/vendor/sass/lib/sass/cache_stores.rb +0 -15
  152. data/vendor/sass/lib/sass/cache_stores/base.rb +0 -86
  153. data/vendor/sass/lib/sass/cache_stores/chain.rb +0 -33
  154. data/vendor/sass/lib/sass/cache_stores/filesystem.rb +0 -60
  155. data/vendor/sass/lib/sass/cache_stores/memory.rb +0 -47
  156. data/vendor/sass/lib/sass/cache_stores/null.rb +0 -25
  157. data/vendor/sass/lib/sass/callbacks.rb +0 -66
  158. data/vendor/sass/lib/sass/css.rb +0 -295
  159. data/vendor/sass/lib/sass/engine.rb +0 -878
  160. data/vendor/sass/lib/sass/environment.rb +0 -166
  161. data/vendor/sass/lib/sass/error.rb +0 -201
  162. data/vendor/sass/lib/sass/exec.rb +0 -672
  163. data/vendor/sass/lib/sass/importers.rb +0 -22
  164. data/vendor/sass/lib/sass/importers/base.rb +0 -139
  165. data/vendor/sass/lib/sass/importers/filesystem.rb +0 -149
  166. data/vendor/sass/lib/sass/less.rb +0 -382
  167. data/vendor/sass/lib/sass/logger.rb +0 -15
  168. data/vendor/sass/lib/sass/logger/base.rb +0 -32
  169. data/vendor/sass/lib/sass/logger/log_level.rb +0 -49
  170. data/vendor/sass/lib/sass/plugin.rb +0 -132
  171. data/vendor/sass/lib/sass/plugin/compiler.rb +0 -383
  172. data/vendor/sass/lib/sass/plugin/configuration.rb +0 -123
  173. data/vendor/sass/lib/sass/plugin/generic.rb +0 -15
  174. data/vendor/sass/lib/sass/plugin/merb.rb +0 -48
  175. data/vendor/sass/lib/sass/plugin/rack.rb +0 -60
  176. data/vendor/sass/lib/sass/plugin/rails.rb +0 -47
  177. data/vendor/sass/lib/sass/plugin/staleness_checker.rb +0 -173
  178. data/vendor/sass/lib/sass/railtie.rb +0 -9
  179. data/vendor/sass/lib/sass/repl.rb +0 -58
  180. data/vendor/sass/lib/sass/root.rb +0 -7
  181. data/vendor/sass/lib/sass/script.rb +0 -40
  182. data/vendor/sass/lib/sass/script/bool.rb +0 -18
  183. data/vendor/sass/lib/sass/script/color.rb +0 -480
  184. data/vendor/sass/lib/sass/script/css_lexer.rb +0 -29
  185. data/vendor/sass/lib/sass/script/css_parser.rb +0 -31
  186. data/vendor/sass/lib/sass/script/funcall.rb +0 -175
  187. data/vendor/sass/lib/sass/script/functions.rb +0 -1386
  188. data/vendor/sass/lib/sass/script/interpolation.rb +0 -79
  189. data/vendor/sass/lib/sass/script/lexer.rb +0 -339
  190. data/vendor/sass/lib/sass/script/list.rb +0 -83
  191. data/vendor/sass/lib/sass/script/literal.rb +0 -250
  192. data/vendor/sass/lib/sass/script/node.rb +0 -99
  193. data/vendor/sass/lib/sass/script/number.rb +0 -452
  194. data/vendor/sass/lib/sass/script/operation.rb +0 -99
  195. data/vendor/sass/lib/sass/script/parser.rb +0 -474
  196. data/vendor/sass/lib/sass/script/string.rb +0 -51
  197. data/vendor/sass/lib/sass/script/string_interpolation.rb +0 -103
  198. data/vendor/sass/lib/sass/script/unary_operation.rb +0 -64
  199. data/vendor/sass/lib/sass/script/variable.rb +0 -59
  200. data/vendor/sass/lib/sass/scss.rb +0 -17
  201. data/vendor/sass/lib/sass/scss/css_parser.rb +0 -46
  202. data/vendor/sass/lib/sass/scss/parser.rb +0 -960
  203. data/vendor/sass/lib/sass/scss/rx.rb +0 -128
  204. data/vendor/sass/lib/sass/scss/sass_parser.rb +0 -11
  205. data/vendor/sass/lib/sass/scss/script_lexer.rb +0 -15
  206. data/vendor/sass/lib/sass/scss/script_parser.rb +0 -25
  207. data/vendor/sass/lib/sass/scss/static_parser.rb +0 -40
  208. data/vendor/sass/lib/sass/selector.rb +0 -361
  209. data/vendor/sass/lib/sass/selector/abstract_sequence.rb +0 -62
  210. data/vendor/sass/lib/sass/selector/comma_sequence.rb +0 -81
  211. data/vendor/sass/lib/sass/selector/sequence.rb +0 -233
  212. data/vendor/sass/lib/sass/selector/simple.rb +0 -113
  213. data/vendor/sass/lib/sass/selector/simple_sequence.rb +0 -134
  214. data/vendor/sass/lib/sass/shared.rb +0 -78
  215. data/vendor/sass/lib/sass/tree/charset_node.rb +0 -22
  216. data/vendor/sass/lib/sass/tree/comment_node.rb +0 -90
  217. data/vendor/sass/lib/sass/tree/debug_node.rb +0 -18
  218. data/vendor/sass/lib/sass/tree/directive_node.rb +0 -23
  219. data/vendor/sass/lib/sass/tree/each_node.rb +0 -24
  220. data/vendor/sass/lib/sass/tree/extend_node.rb +0 -29
  221. data/vendor/sass/lib/sass/tree/for_node.rb +0 -36
  222. data/vendor/sass/lib/sass/tree/function_node.rb +0 -27
  223. data/vendor/sass/lib/sass/tree/if_node.rb +0 -52
  224. data/vendor/sass/lib/sass/tree/import_node.rb +0 -68
  225. data/vendor/sass/lib/sass/tree/media_node.rb +0 -32
  226. data/vendor/sass/lib/sass/tree/mixin_def_node.rb +0 -27
  227. data/vendor/sass/lib/sass/tree/mixin_node.rb +0 -32
  228. data/vendor/sass/lib/sass/tree/node.rb +0 -201
  229. data/vendor/sass/lib/sass/tree/prop_node.rb +0 -148
  230. data/vendor/sass/lib/sass/tree/return_node.rb +0 -18
  231. data/vendor/sass/lib/sass/tree/root_node.rb +0 -28
  232. data/vendor/sass/lib/sass/tree/rule_node.rb +0 -136
  233. data/vendor/sass/lib/sass/tree/variable_node.rb +0 -30
  234. data/vendor/sass/lib/sass/tree/visitors/base.rb +0 -75
  235. data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +0 -133
  236. data/vendor/sass/lib/sass/tree/visitors/convert.rb +0 -260
  237. data/vendor/sass/lib/sass/tree/visitors/cssize.rb +0 -175
  238. data/vendor/sass/lib/sass/tree/visitors/deep_copy.rb +0 -87
  239. data/vendor/sass/lib/sass/tree/visitors/perform.rb +0 -332
  240. data/vendor/sass/lib/sass/tree/visitors/set_options.rb +0 -97
  241. data/vendor/sass/lib/sass/tree/visitors/to_css.rb +0 -210
  242. data/vendor/sass/lib/sass/tree/warn_node.rb +0 -18
  243. data/vendor/sass/lib/sass/tree/while_node.rb +0 -18
  244. data/vendor/sass/lib/sass/util.rb +0 -721
  245. data/vendor/sass/lib/sass/util/subset_map.rb +0 -101
  246. data/vendor/sass/lib/sass/version.rb +0 -112
  247. data/vendor/sass/rails/init.rb +0 -1
  248. data/vendor/sass/sass.gemspec +0 -33
  249. data/vendor/sass/test/Gemfile +0 -4
  250. data/vendor/sass/test/Gemfile.lock +0 -19
  251. data/vendor/sass/test/sass/cache_test.rb +0 -89
  252. data/vendor/sass/test/sass/callbacks_test.rb +0 -61
  253. data/vendor/sass/test/sass/conversion_test.rb +0 -1199
  254. data/vendor/sass/test/sass/css2sass_test.rb +0 -373
  255. data/vendor/sass/test/sass/data/hsl-rgb.txt +0 -319
  256. data/vendor/sass/test/sass/engine_test.rb +0 -2567
  257. data/vendor/sass/test/sass/extend_test.rb +0 -1348
  258. data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
  259. data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
  260. data/vendor/sass/test/sass/functions_test.rb +0 -1038
  261. data/vendor/sass/test/sass/importer_test.rb +0 -192
  262. data/vendor/sass/test/sass/less_conversion_test.rb +0 -653
  263. data/vendor/sass/test/sass/logger_test.rb +0 -58
  264. data/vendor/sass/test/sass/mock_importer.rb +0 -49
  265. data/vendor/sass/test/sass/more_results/more1.css +0 -9
  266. data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +0 -26
  267. data/vendor/sass/test/sass/more_results/more_import.css +0 -29
  268. data/vendor/sass/test/sass/more_templates/_more_partial.sass +0 -2
  269. data/vendor/sass/test/sass/more_templates/more1.sass +0 -23
  270. data/vendor/sass/test/sass/more_templates/more_import.sass +0 -11
  271. data/vendor/sass/test/sass/plugin_test.rb +0 -472
  272. data/vendor/sass/test/sass/results/alt.css +0 -4
  273. data/vendor/sass/test/sass/results/basic.css +0 -9
  274. data/vendor/sass/test/sass/results/compact.css +0 -5
  275. data/vendor/sass/test/sass/results/complex.css +0 -86
  276. data/vendor/sass/test/sass/results/compressed.css +0 -1
  277. data/vendor/sass/test/sass/results/expanded.css +0 -19
  278. data/vendor/sass/test/sass/results/if.css +0 -3
  279. data/vendor/sass/test/sass/results/import.css +0 -31
  280. data/vendor/sass/test/sass/results/import_charset.css +0 -4
  281. data/vendor/sass/test/sass/results/import_charset_1_8.css +0 -4
  282. data/vendor/sass/test/sass/results/import_charset_ibm866.css +0 -4
  283. data/vendor/sass/test/sass/results/line_numbers.css +0 -49
  284. data/vendor/sass/test/sass/results/mixins.css +0 -95
  285. data/vendor/sass/test/sass/results/multiline.css +0 -24
  286. data/vendor/sass/test/sass/results/nested.css +0 -22
  287. data/vendor/sass/test/sass/results/options.css +0 -1
  288. data/vendor/sass/test/sass/results/parent_ref.css +0 -13
  289. data/vendor/sass/test/sass/results/script.css +0 -16
  290. data/vendor/sass/test/sass/results/scss_import.css +0 -31
  291. data/vendor/sass/test/sass/results/scss_importee.css +0 -2
  292. data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
  293. data/vendor/sass/test/sass/results/subdir/subdir.css +0 -3
  294. data/vendor/sass/test/sass/results/units.css +0 -11
  295. data/vendor/sass/test/sass/results/warn.css +0 -0
  296. data/vendor/sass/test/sass/results/warn_imported.css +0 -0
  297. data/vendor/sass/test/sass/script_conversion_test.rb +0 -285
  298. data/vendor/sass/test/sass/script_test.rb +0 -514
  299. data/vendor/sass/test/sass/scss/css_test.rb +0 -922
  300. data/vendor/sass/test/sass/scss/rx_test.rb +0 -156
  301. data/vendor/sass/test/sass/scss/scss_test.rb +0 -1273
  302. data/vendor/sass/test/sass/scss/test_helper.rb +0 -37
  303. data/vendor/sass/test/sass/templates/_imported_charset_ibm866.sass +0 -4
  304. data/vendor/sass/test/sass/templates/_imported_charset_utf8.sass +0 -4
  305. data/vendor/sass/test/sass/templates/_partial.sass +0 -2
  306. data/vendor/sass/test/sass/templates/alt.sass +0 -16
  307. data/vendor/sass/test/sass/templates/basic.sass +0 -23
  308. data/vendor/sass/test/sass/templates/bork1.sass +0 -2
  309. data/vendor/sass/test/sass/templates/bork2.sass +0 -2
  310. data/vendor/sass/test/sass/templates/bork3.sass +0 -2
  311. data/vendor/sass/test/sass/templates/bork4.sass +0 -2
  312. data/vendor/sass/test/sass/templates/bork5.sass +0 -3
  313. data/vendor/sass/test/sass/templates/compact.sass +0 -17
  314. data/vendor/sass/test/sass/templates/complex.sass +0 -305
  315. data/vendor/sass/test/sass/templates/compressed.sass +0 -15
  316. data/vendor/sass/test/sass/templates/expanded.sass +0 -17
  317. data/vendor/sass/test/sass/templates/if.sass +0 -11
  318. data/vendor/sass/test/sass/templates/import.sass +0 -12
  319. data/vendor/sass/test/sass/templates/import_charset.sass +0 -7
  320. data/vendor/sass/test/sass/templates/import_charset_1_8.sass +0 -4
  321. data/vendor/sass/test/sass/templates/import_charset_ibm866.sass +0 -9
  322. data/vendor/sass/test/sass/templates/importee.less +0 -2
  323. data/vendor/sass/test/sass/templates/importee.sass +0 -19
  324. data/vendor/sass/test/sass/templates/line_numbers.sass +0 -13
  325. data/vendor/sass/test/sass/templates/mixin_bork.sass +0 -5
  326. data/vendor/sass/test/sass/templates/mixins.sass +0 -76
  327. data/vendor/sass/test/sass/templates/multiline.sass +0 -20
  328. data/vendor/sass/test/sass/templates/nested.sass +0 -25
  329. data/vendor/sass/test/sass/templates/nested_bork1.sass +0 -2
  330. data/vendor/sass/test/sass/templates/nested_bork2.sass +0 -2
  331. data/vendor/sass/test/sass/templates/nested_bork3.sass +0 -2
  332. data/vendor/sass/test/sass/templates/nested_bork4.sass +0 -2
  333. data/vendor/sass/test/sass/templates/nested_bork5.sass +0 -2
  334. data/vendor/sass/test/sass/templates/nested_import.sass +0 -2
  335. data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +0 -6
  336. data/vendor/sass/test/sass/templates/options.sass +0 -2
  337. data/vendor/sass/test/sass/templates/parent_ref.sass +0 -25
  338. data/vendor/sass/test/sass/templates/script.sass +0 -101
  339. data/vendor/sass/test/sass/templates/scss_import.scss +0 -11
  340. data/vendor/sass/test/sass/templates/scss_importee.scss +0 -1
  341. data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
  342. data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
  343. data/vendor/sass/test/sass/templates/subdir/subdir.sass +0 -6
  344. data/vendor/sass/test/sass/templates/units.sass +0 -11
  345. data/vendor/sass/test/sass/templates/warn.sass +0 -3
  346. data/vendor/sass/test/sass/templates/warn_imported.sass +0 -4
  347. data/vendor/sass/test/sass/test_helper.rb +0 -8
  348. data/vendor/sass/test/sass/util/subset_map_test.rb +0 -91
  349. data/vendor/sass/test/sass/util_test.rb +0 -266
  350. data/vendor/sass/test/test_helper.rb +0 -69
  351. data/vendor/sass/vendor/fssm/Gemfile +0 -3
  352. data/vendor/sass/vendor/fssm/LICENSE +0 -20
  353. data/vendor/sass/vendor/fssm/README.markdown +0 -83
  354. data/vendor/sass/vendor/fssm/Rakefile +0 -11
  355. data/vendor/sass/vendor/fssm/example.rb +0 -12
  356. data/vendor/sass/vendor/fssm/fssm.gemspec +0 -24
  357. data/vendor/sass/vendor/fssm/lib/fssm.rb +0 -37
  358. data/vendor/sass/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
  359. data/vendor/sass/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
  360. data/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
  361. data/vendor/sass/vendor/fssm/lib/fssm/backends/rbfsevent.rb +0 -42
  362. data/vendor/sass/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
  363. data/vendor/sass/vendor/fssm/lib/fssm/monitor.rb +0 -36
  364. data/vendor/sass/vendor/fssm/lib/fssm/path.rb +0 -94
  365. data/vendor/sass/vendor/fssm/lib/fssm/pathname.rb +0 -36
  366. data/vendor/sass/vendor/fssm/lib/fssm/state/directory.rb +0 -75
  367. data/vendor/sass/vendor/fssm/lib/fssm/state/file.rb +0 -24
  368. data/vendor/sass/vendor/fssm/lib/fssm/support.rb +0 -92
  369. data/vendor/sass/vendor/fssm/lib/fssm/tree.rb +0 -176
  370. data/vendor/sass/vendor/fssm/lib/fssm/version.rb +0 -3
  371. data/vendor/sass/vendor/fssm/profile/prof-cache.rb +0 -40
  372. data/vendor/sass/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
  373. data/vendor/sass/vendor/fssm/profile/prof-pathname-rubinius.rb +0 -35
  374. data/vendor/sass/vendor/fssm/profile/prof-pathname.rb +0 -68
  375. data/vendor/sass/vendor/fssm/profile/prof-plain-pathname.html +0 -988
  376. data/vendor/sass/vendor/fssm/profile/prof.html +0 -2379
  377. data/vendor/sass/vendor/fssm/spec/count_down_latch.rb +0 -151
  378. data/vendor/sass/vendor/fssm/spec/monitor_spec.rb +0 -202
  379. data/vendor/sass/vendor/fssm/spec/path_spec.rb +0 -96
  380. data/vendor/sass/vendor/fssm/spec/root/duck/quack.txt +0 -0
  381. data/vendor/sass/vendor/fssm/spec/root/file.css +0 -0
  382. data/vendor/sass/vendor/fssm/spec/root/file.rb +0 -0
  383. data/vendor/sass/vendor/fssm/spec/root/file.yml +0 -0
  384. data/vendor/sass/vendor/fssm/spec/root/moo/cow.txt +0 -0
  385. data/vendor/sass/vendor/fssm/spec/spec_helper.rb +0 -14
  386. data/vendor/sass/yard/callbacks.rb +0 -29
  387. data/vendor/sass/yard/default/fulldoc/html/css/common.sass +0 -26
  388. data/vendor/sass/yard/default/layout/html/footer.erb +0 -12
  389. data/vendor/sass/yard/inherited_hash.rb +0 -41
@@ -1,109 +1,3 @@
1
- require 'haml/util'
2
-
3
1
  module Haml
4
- # Handles Haml version-reporting.
5
- # Haml not only reports the standard three version numbers,
6
- # but its Git revision hash as well,
7
- # if it was installed from Git.
8
- module Version
9
- include Haml::Util
10
-
11
- # Returns a hash representing the version of Haml.
12
- # The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Fixnums.
13
- # The `:name` key has the name of the version.
14
- # The `:string` key contains a human-readable string representation of the version.
15
- # The `:number` key is the major, minor, and teeny keys separated by periods.
16
- # If Haml is checked out from Git, the `:rev` key will have the revision hash.
17
- # For example:
18
- #
19
- # {
20
- # :string => "2.1.0.9616393",
21
- # :rev => "9616393b8924ef36639c7e82aa88a51a24d16949",
22
- # :number => "2.1.0",
23
- # :major => 2, :minor => 1, :teeny => 0
24
- # }
25
- #
26
- # If a prerelease version of Haml is being used,
27
- # the `:string` and `:number` fields will reflect the full version
28
- # (e.g. `"2.2.beta.1"`), and the `:teeny` field will be `-1`.
29
- # A `:prerelease` key will contain the name of the prerelease (e.g. `"beta"`),
30
- # and a `:prerelease_number` key will contain the rerelease number.
31
- # For example:
32
- #
33
- # {
34
- # :string => "3.0.beta.1",
35
- # :number => "3.0.beta.1",
36
- # :major => 3, :minor => 0, :teeny => -1,
37
- # :prerelease => "beta",
38
- # :prerelease_number => 1
39
- # }
40
- #
41
- # @return [{Symbol => String/Fixnum}] The version hash
42
- def version
43
- return @@version if defined?(@@version)
44
-
45
- numbers = File.read(scope('VERSION')).strip.split('.').
46
- map {|n| n =~ /^[0-9]+$/ ? n.to_i : n}
47
- name = File.read(scope('VERSION_NAME')).strip
48
- @@version = {
49
- :major => numbers[0],
50
- :minor => numbers[1],
51
- :teeny => numbers[2],
52
- :name => name
53
- }
54
-
55
- if numbers[3].is_a?(String)
56
- @@version[:teeny] = -1
57
- @@version[:prerelease] = numbers[3]
58
- @@version[:prerelease_number] = numbers[4]
59
- end
60
-
61
- @@version[:number] = numbers.join('.')
62
- @@version[:string] = @@version[:number].dup
63
-
64
- if rev = revision_number
65
- @@version[:rev] = rev
66
- unless rev[0] == ?(
67
- @@version[:string] << "." << rev[0...7]
68
- end
69
- end
70
-
71
- @@version[:string] << " (#{name})"
72
- @@version
73
- end
74
-
75
- private
76
-
77
- def revision_number
78
- if File.exists?(scope('REVISION'))
79
- rev = File.read(scope('REVISION')).strip
80
- return rev unless rev =~ /^([a-f0-9]+|\(.*\))$/ || rev == '(unknown)'
81
- end
82
-
83
- return unless File.exists?(scope('.git/HEAD'))
84
- rev = File.read(scope('.git/HEAD')).strip
85
- return rev unless rev =~ /^ref: (.*)$/
86
-
87
- ref_name = $1
88
- ref_file = scope(".git/#{ref_name}")
89
- info_file = scope(".git/info/refs")
90
- return File.read(ref_file).strip if File.exists?(ref_file)
91
- return unless File.exists?(info_file)
92
- File.open(info_file) do |f|
93
- f.each do |l|
94
- sha, ref = l.strip.split("\t", 2)
95
- next unless ref == ref_name
96
- return sha
97
- end
98
- end
99
- return nil
100
- end
101
- end
102
-
103
- extend Haml::Version
104
-
105
- # A string representing the version of Haml.
106
- # A more fine-grained representation is available from Haml.version.
107
- # @api public
108
- VERSION = version[:string] unless defined?(Haml::VERSION)
2
+ VERSION = "3.2.0.alpha.13"
109
3
  end
@@ -1,8 +1,7 @@
1
- #!/usr/bin/env ruby
2
1
  # -*- coding: utf-8 -*-
3
- require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'test_helper'
4
3
 
5
- class EngineTest < Test::Unit::TestCase
4
+ class EngineTest < MiniTest::Unit::TestCase
6
5
  # A map of erroneous Haml documents to the error messages they should produce.
7
6
  # The error messages may be arrays;
8
7
  # if so, the second element should be the line number that should be reported for the error.
@@ -61,11 +60,11 @@ MESSAGE
61
60
  "%p(foo 'bar')" => "Invalid attribute list: \"(foo 'bar')\".",
62
61
  "%p(foo 'bar'\nbaz='bang')" => ["Invalid attribute list: \"(foo 'bar'\".", 1],
63
62
  "%p(foo='bar'\nbaz 'bang'\nbip='bop')" => ["Invalid attribute list: \"(foo='bar' baz 'bang'\".", 2],
64
- "%p{:foo => 'bar' :bar => 'baz'}" => :compile,
63
+ "%p{'foo' => 'bar' 'bar' => 'baz'}" => :compile,
65
64
  "%p{:foo => }" => :compile,
66
65
  "%p{=> 'bar'}" => :compile,
67
- "%p{:foo => 'bar}" => :compile,
68
66
  "%p{'foo => 'bar'}" => :compile,
67
+ "%p{:foo => 'bar}" => :compile,
69
68
  "%p{:foo => 'bar\"}" => :compile,
70
69
 
71
70
  # Regression tests
@@ -106,7 +105,7 @@ MESSAGE
106
105
  locals = options.delete(:locals) || {}
107
106
  engine(text, options).to_html(scope, locals, &block)
108
107
  end
109
-
108
+
110
109
  def engine(text, options = {})
111
110
  unless options[:filename]
112
111
  # use caller method name as fake filename. useful for debugging
@@ -118,14 +117,14 @@ MESSAGE
118
117
  end
119
118
 
120
119
  def setup
121
- return if Haml::Util.ruby1_8?
120
+ return if RUBY_VERSION < "1.9"
122
121
  @old_default_internal = Encoding.default_internal
123
- Encoding.default_internal = nil
122
+ silence_warnings{Encoding.default_internal = nil}
124
123
  end
125
124
 
126
125
  def teardown
127
- return if Haml::Util.ruby1_8?
128
- Encoding.default_internal = @old_default_internal
126
+ return if RUBY_VERSION < "1.9"
127
+ silence_warnings{Encoding.default_internal = @old_default_internal}
129
128
  end
130
129
 
131
130
  def test_empty_render
@@ -155,7 +154,6 @@ MESSAGE
155
154
  end
156
155
 
157
156
  def test_ruby_code_should_work_inside_attributes
158
- author = 'hcatlin'
159
157
  assert_equal("<p class='3'>foo</p>", render("%p{:class => 1+2} foo").chomp)
160
158
  end
161
159
 
@@ -193,11 +191,11 @@ MESSAGE
193
191
  def test_dynamic_attributes_with_no_content
194
192
  assert_equal(<<HTML, render(<<HAML))
195
193
  <p>
196
- <a href='http://haml-lang.com'></a>
194
+ <a href='http://haml.info'></a>
197
195
  </p>
198
196
  HTML
199
197
  %p
200
- %a{:href => "http://" + "haml-lang.com"}
198
+ %a{:href => "http://" + "haml.info"}
201
199
  HAML
202
200
  end
203
201
 
@@ -373,6 +371,16 @@ HAML
373
371
  render("%p{:foo => 'bar', :bar => false, :baz => 'false'}", :format => :xhtml))
374
372
  end
375
373
 
374
+ def test_nuke_inner_whitespace_in_loops
375
+ assert_equal(<<HTML, render(<<HAML))
376
+ <ul>foobarbaz</ul>
377
+ HTML
378
+ %ul<
379
+ - for str in %w[foo bar baz]
380
+ = str
381
+ HAML
382
+ end
383
+
376
384
  def test_both_whitespace_nukes_work_together
377
385
  assert_equal(<<RESULT, render(<<SOURCE))
378
386
  <p><q>Foo
@@ -403,7 +411,7 @@ HAML
403
411
 
404
412
  # Regression tests
405
413
 
406
- unless Haml::Util.ruby1_8?
414
+ unless RUBY_VERSION < "1.9"
407
415
  def test_indentation_after_dynamic_attr_hash
408
416
  assert_equal(<<HTML, render(<<HAML))
409
417
  <html>
@@ -714,62 +722,12 @@ HAML
714
722
  assert_equal("<a href='#'></a>\n", render('%a(href="#")'))
715
723
  end
716
724
 
717
- def test_javascript_filter_with_dynamic_interp_and_escape_html
718
- assert_equal(<<HTML, render(<<HAML, :escape_html => true))
719
- <script type='text/javascript'>
720
- //<![CDATA[
721
- & < > &
722
- //]]>
723
- </script>
724
- HTML
725
- :javascript
726
- & < > \#{"&"}
727
- HAML
728
- end
729
-
730
- def test_html5_javascript_filter
731
- assert_equal(<<HTML, render(<<HAML, :format => :html5))
732
- <script>
733
- //<![CDATA[
734
- foo bar
735
- //]]>
736
- </script>
737
- HTML
738
- :javascript
739
- foo bar
740
- HAML
741
- end
742
-
743
- def test_html5_css_filter
744
- assert_equal(<<HTML, render(<<HAML, :format => :html5))
745
- <style>
746
- /*<![CDATA[*/
747
- foo bar
748
- /*]]>*/
749
- </style>
750
- HTML
751
- :css
752
- foo bar
753
- HAML
754
- end
755
-
756
- def test_erb_filter_with_multiline_expr
757
- assert_equal(<<HTML, render(<<HAML))
758
- foobarbaz
759
- HTML
760
- :erb
761
- <%= "foo" +
762
- "bar" +
763
- "baz" %>
764
- HAML
765
- end
766
-
767
725
  def test_silent_script_with_hyphen_case
768
- assert_equal("", render("- 'foo-case-bar-case'"))
726
+ assert_equal("", render("- a = 'foo-case-bar-case'"))
769
727
  end
770
728
 
771
729
  def test_silent_script_with_hyphen_end
772
- assert_equal("", render("- 'foo-end-bar-end'"))
730
+ assert_equal("", render("- a = 'foo-end-bar-end'"))
773
731
  end
774
732
 
775
733
  def test_silent_script_with_hyphen_end_and_block
@@ -811,15 +769,6 @@ HAML
811
769
  assert_equal("<a href='#\"'></a>\n", render('%a(href="#\\"")'))
812
770
  end
813
771
 
814
- def test_filter_with_newline_and_interp
815
- assert_equal(<<HTML, render(<<HAML))
816
- \\n
817
- HTML
818
- :plain
819
- \\n\#{""}
820
- HAML
821
- end
822
-
823
772
  def test_case_assigned_to_var
824
773
  assert_equal(<<HTML, render(<<HAML))
825
774
  bar
@@ -892,9 +841,9 @@ HAML
892
841
  foo
893
842
  HTML
894
843
  - var = if false
895
- - elsif 12
844
+ - elsif 12 == 12
896
845
  - "foo"
897
- - elsif 14; "bar"
846
+ - elsif 14 == 14; "bar"
898
847
  - else
899
848
  - "baz"
900
849
  = var
@@ -964,7 +913,7 @@ HAML
964
913
  def test_bang_equals_inline_should_not_escape
965
914
  assert_equal("<p>foo & bar</p>\n", render("%p!= 'foo & bar'", :escape_html => true))
966
915
  end
967
-
916
+
968
917
  def test_static_attributes_should_be_escaped
969
918
  assert_equal("<img class='atlantis' style='ugly&amp;stupid' />\n",
970
919
  render("%img.atlantis{:style => 'ugly&stupid'}"))
@@ -1075,7 +1024,9 @@ HAML
1075
1024
  render("\n\n= 123\n\n= nil[]", :filename => 'test', :line => 2)
1076
1025
  rescue Exception => e
1077
1026
  assert_kind_of NoMethodError, e
1078
- assert_match(/test:6/, e.backtrace.first)
1027
+ backtrace = e.backtrace
1028
+ backtrace.shift if rubinius?
1029
+ assert_match(/test:6/, backtrace.first)
1079
1030
  end
1080
1031
  end
1081
1032
 
@@ -1118,7 +1069,7 @@ HAML
1118
1069
  assert_equal("<p strange=*attrs*></p>\n", render("%p{ :strange => 'attrs'}", :attr_wrapper => '*'))
1119
1070
  assert_equal("<p escaped='quo\"te'></p>\n", render("%p{ :escaped => 'quo\"te'}", :attr_wrapper => '"'))
1120
1071
  assert_equal("<p escaped=\"quo'te\"></p>\n", render("%p{ :escaped => 'quo\\'te'}", :attr_wrapper => '"'))
1121
- assert_equal("<p escaped=\"q'uo&quot;te\"></p>\n", render("%p{ :escaped => 'q\\'uo\"te'}", :attr_wrapper => '"'))
1072
+ assert_equal("<p escaped=\"q'uo&#x0022;te\"></p>\n", render("%p{ :escaped => 'q\\'uo\"te'}", :attr_wrapper => '"'))
1122
1073
  assert_equal("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n", render("!!! XML", :attr_wrapper => '"'))
1123
1074
  end
1124
1075
 
@@ -1147,7 +1098,7 @@ HAML
1147
1098
  assert_equal("<p class='foo'>deep {nested { things }}</p>\n", render("%p{:class => 'foo'} deep {nested { things }}"))
1148
1099
  assert_equal("<p class='bar foo'>{a { d</p>\n", render("%p{{:class => 'foo'}, :class => 'bar'} {a { d"))
1149
1100
  assert_equal("<p foo='bar'>a}</p>\n", render("%p{:foo => 'bar'} a}"))
1150
-
1101
+
1151
1102
  foo = []
1152
1103
  foo[0] = Struct.new('Foo', :id).new
1153
1104
  assert_equal("<p class='struct_foo' id='struct_foo_new'>New User]</p>\n",
@@ -1161,12 +1112,12 @@ HAML
1161
1112
  assert_equal("<p class='prefix_struct_foo' id='prefix_struct_foo_1'>New User]</p>\n",
1162
1113
  render("%p[foo[0], :prefix] New User]", :locals => {:foo => foo}))
1163
1114
  end
1164
-
1115
+
1165
1116
  def test_empty_attrs
1166
1117
  assert_equal("<p attr=''>empty</p>\n", render("%p{ :attr => '' } empty"))
1167
1118
  assert_equal("<p attr=''>empty</p>\n", render("%p{ :attr => x } empty", :locals => {:x => ''}))
1168
1119
  end
1169
-
1120
+
1170
1121
  def test_nil_attrs
1171
1122
  assert_equal("<p>nil</p>\n", render("%p{ :attr => nil } nil"))
1172
1123
  assert_equal("<p>nil</p>\n", render("%p{ :attr => x } nil", :locals => {:x => nil}))
@@ -1201,33 +1152,19 @@ HAML
1201
1152
  EXCEPTION_MAP.each do |key, value|
1202
1153
  define_method("test_exception (#{key.inspect})") do
1203
1154
  begin
1204
- render(key, :filename => __FILE__)
1155
+ render(key, :filename => "(test_exception (#{key.inspect}))")
1205
1156
  rescue Exception => err
1206
1157
  value = [value] unless value.is_a?(Array)
1207
1158
  expected_message, line_no = value
1208
1159
  line_no ||= key.split("\n").length
1209
1160
 
1161
+
1210
1162
  if expected_message == :compile
1211
- if Haml::Util.ruby1_8?
1212
- assert_match(/^compile error\n/, err.message, "Line: #{key}")
1213
- else
1214
- assert_match(/^#{Regexp.quote __FILE__}:#{line_no}: syntax error,/, err.message, "Line: #{key}")
1215
- end
1163
+ assert_match(/(compile error|syntax error|unterminated string|expecting)/, err.message, "Line: #{key}")
1216
1164
  else
1217
1165
  assert_equal(expected_message, err.message, "Line: #{key}")
1218
1166
  end
1219
1167
 
1220
- if Haml::Util.ruby1_8?
1221
- # Sometimes, the first backtrace entry is *only* in the message.
1222
- # No idea why.
1223
- bt =
1224
- if expected_message == :compile && err.message.include?("\n")
1225
- err.message.split("\n", 2)[1]
1226
- else
1227
- err.backtrace[0]
1228
- end
1229
- assert_match(/^#{Regexp.escape(__FILE__)}:#{line_no}/, bt, "Line: #{key}")
1230
- end
1231
1168
  else
1232
1169
  assert(false, "Exception not raised for\n#{key}")
1233
1170
  end
@@ -1245,7 +1182,9 @@ HAML
1245
1182
  def test_exception
1246
1183
  render("%p\n hi\n %a= undefined\n= 12")
1247
1184
  rescue Exception => e
1248
- assert_match("(test_exception):3", e.backtrace[0])
1185
+ backtrace = e.backtrace
1186
+ backtrace.shift if rubinius?
1187
+ assert_match("(test_exception):3", backtrace[0])
1249
1188
  else
1250
1189
  # Test failed... should have raised an exception
1251
1190
  assert(false)
@@ -1254,7 +1193,7 @@ HAML
1254
1193
  def test_compile_error
1255
1194
  render("a\nb\n- fee)\nc")
1256
1195
  rescue Exception => e
1257
- assert_match(/\(test_compile_error\):3: syntax error/i, e.message)
1196
+ assert_match(/\(test_compile_error\):3: (syntax error|expecting \$end)/i, e.message)
1258
1197
  else
1259
1198
  assert(false,
1260
1199
  '"a\nb\n- fee)\nc" doesn\'t produce an exception!')
@@ -1271,38 +1210,6 @@ HAML
1271
1210
  render("/[if !(IE 6)|(IE 7)] Bracket: ]"))
1272
1211
  end
1273
1212
 
1274
- def test_empty_filter
1275
- assert_equal(<<END, render(':javascript'))
1276
- <script type='text/javascript'>
1277
- //<![CDATA[
1278
-
1279
- //]]>
1280
- </script>
1281
- END
1282
- end
1283
-
1284
- def test_ugly_filter
1285
- assert_equal(<<END, render(":sass\n #foo\n bar: baz", :ugly => true))
1286
- #foo {
1287
- bar: baz; }
1288
- END
1289
- end
1290
-
1291
- def test_css_filter
1292
- assert_equal(<<HTML, render(<<HAML))
1293
- <style type='text/css'>
1294
- /*<![CDATA[*/
1295
- #foo {
1296
- bar: baz; }
1297
- /*]]>*/
1298
- </style>
1299
- HTML
1300
- :css
1301
- #foo {
1302
- bar: baz; }
1303
- HAML
1304
- end
1305
-
1306
1213
  def test_local_assigns_dont_modify_class
1307
1214
  assert_equal("bar\n", render("= foo", :locals => {:foo => 'bar'}))
1308
1215
  assert_equal(nil, defined?(foo))
@@ -1325,7 +1232,7 @@ HAML
1325
1232
  assert_equal("<p class='my_thing' id='my_thing_42' style='width: 100px;'>My Thing</p>\n",
1326
1233
  render("%p[custom]{:style => 'width: 100px;'} My Thing", :locals => {:custom => custom}))
1327
1234
  end
1328
-
1235
+
1329
1236
  def test_object_ref_with_multiple_ids
1330
1237
  cpk_record = CpkRecord.new([42,6,9])
1331
1238
  assert_equal("<p class='struct_cpk_record' id='struct_cpk_record_42_6_9' style='width: 100px;'>CPK Record</p>\n",
@@ -1343,6 +1250,9 @@ HAML
1343
1250
  string.instance_variable_set("@var", "Instance variable")
1344
1251
  b = string.instance_eval do
1345
1252
  var = "Local variable"
1253
+ # Silence unavoidable warning; Ruby doesn't know we're going to use this
1254
+ # later.
1255
+ nil if var
1346
1256
  binding
1347
1257
  end
1348
1258
 
@@ -1430,7 +1340,7 @@ HAML
1430
1340
  end
1431
1341
 
1432
1342
  def test_arbitrary_output_option
1433
- assert_raise_message(Haml::Error, "Invalid output format :html1") do
1343
+ assert_raises_message(Haml::Error, "Invalid output format :html1") do
1434
1344
  engine("%br", :format => :html1)
1435
1345
  end
1436
1346
  end
@@ -1480,7 +1390,7 @@ HAML
1480
1390
 
1481
1391
  # because anything before the doctype triggers quirks mode in IE
1482
1392
  def test_xml_prolog_and_doctype_dont_result_in_a_leading_whitespace_in_html
1483
- assert_no_match(/^\s+/, render("!!! xml\n!!!", :format => :html4))
1393
+ refute_match(/^\s+/, render("!!! xml\n!!!", :format => :html4))
1484
1394
  end
1485
1395
 
1486
1396
  # HTML5
@@ -1489,15 +1399,41 @@ HAML
1489
1399
  end
1490
1400
 
1491
1401
  # HTML5 custom data attributes
1492
- def test_html5_data_attributes
1402
+ def test_html5_data_attributes_without_hyphenation
1493
1403
  assert_equal("<div data-author_id='123' data-biz='baz' data-foo='bar'></div>\n",
1494
- render("%div{:data => {:author_id => 123, :foo => 'bar', :biz => 'baz'}}"))
1404
+ render("%div{:data => {:author_id => 123, :foo => 'bar', :biz => 'baz'}}",
1405
+ :hyphenate_data_attrs => false))
1495
1406
 
1496
1407
  assert_equal("<div data-one_plus_one='2'></div>\n",
1497
- render("%div{:data => {:one_plus_one => 1+1}}"))
1408
+ render("%div{:data => {:one_plus_one => 1+1}}",
1409
+ :hyphenate_data_attrs => false))
1410
+
1411
+ assert_equal("<div data-foo='Here&#x0027;s a \"quoteful\" string.'></div>\n",
1412
+ render(%{%div{:data => {:foo => %{Here's a "quoteful" string.}}}},
1413
+ :hyphenate_data_attrs => false)) #'
1414
+ end
1415
+
1416
+ def test_html5_data_attributes_with_hyphens
1417
+ assert_equal("<div data-foo-bar='blip'></div>\n",
1418
+ render("%div{:data => {:foo_bar => 'blip'}}"))
1419
+ assert_equal("<div data-baz='bang' data-foo-bar='blip'></div>\n",
1420
+ render("%div{:data => {:foo_bar => 'blip', :baz => 'bang'}}"))
1421
+ end
1422
+
1423
+ def test_html5_data_attributes_with_nested_hash
1424
+ assert_equal("<div data-a-b='c'></div>\n", render(<<-HAML))
1425
+ - hash = {:a => {:b => 'c'}}
1426
+ - hash[:d] = hash
1427
+ %div{:data => hash}
1428
+ HAML
1429
+ end
1498
1430
 
1499
- assert_equal("<div data-foo='Here&apos;s a \"quoteful\" string.'></div>\n",
1500
- render(%{%div{:data => {:foo => %{Here's a "quoteful" string.}}}})) #'
1431
+ def test_html5_data_attributes_with_nested_hash_and_without_hyphenation
1432
+ assert_equal("<div data-a_b='c'></div>\n", render(<<-HAML, :hyphenate_data_attrs => false))
1433
+ - hash = {:a => {:b => 'c'}}
1434
+ - hash[:d] = hash
1435
+ %div{:data => hash}
1436
+ HAML
1501
1437
  end
1502
1438
 
1503
1439
  def test_html5_data_attributes_with_multiple_defs
@@ -1529,6 +1465,36 @@ HAML
1529
1465
  render("%div{data_val, :data => {:foo => 'blip', :brat => 'wurst'}}"))
1530
1466
  end
1531
1467
 
1468
+ def test_xml_doc_using_html5_format_and_mime_type
1469
+ assert_equal(<<XML, render(<<HAML, { :format => :html5, :mime_type => 'text/xml' }))
1470
+ <?xml version='1.0' encoding='utf-8' ?>
1471
+ <root>
1472
+ <element />
1473
+ <hr />
1474
+ </root>
1475
+ XML
1476
+ !!! XML
1477
+ %root
1478
+ %element/
1479
+ %hr
1480
+ HAML
1481
+ end
1482
+
1483
+ def test_xml_doc_using_html4_format_and_mime_type
1484
+ assert_equal(<<XML, render(<<HAML, { :format => :html4, :mime_type => 'text/xml' }))
1485
+ <?xml version='1.0' encoding='utf-8' ?>
1486
+ <root>
1487
+ <element />
1488
+ <hr />
1489
+ </root>
1490
+ XML
1491
+ !!! XML
1492
+ %root
1493
+ %element/
1494
+ %hr
1495
+ HAML
1496
+ end
1497
+
1532
1498
  # New attributes
1533
1499
 
1534
1500
  def test_basic_new_attributes
@@ -1662,6 +1628,34 @@ HTML
1662
1628
  HAML
1663
1629
  end
1664
1630
 
1631
+ def test_ruby_multiline_with_punctuated_methods_is_continuation
1632
+ assert_equal(<<HTML, render(<<HAML))
1633
+ bar, , true, bang
1634
+ <p>foo</p>
1635
+ <p>bar</p>
1636
+ HTML
1637
+ = ["bar",
1638
+ " ".strip!,
1639
+ "".empty?,
1640
+ "bang"].join(", ")
1641
+ %p foo
1642
+ %p bar
1643
+ HAML
1644
+ end
1645
+
1646
+ def test_ruby_character_literals_are_not_continuation
1647
+ html = if RUBY_VERSION < "1.9"
1648
+ "44\n44\n<p>foo</p>\n"
1649
+ else
1650
+ ",\n,\n<p>foo</p>\n"
1651
+ end
1652
+ assert_equal(html, render(<<HAML))
1653
+ = ?,
1654
+ = ?\,
1655
+ %p foo
1656
+ HAML
1657
+ end
1658
+
1665
1659
  def test_escaped_loud_ruby_multiline
1666
1660
  assert_equal(<<HTML, render(<<HAML))
1667
1661
  bar&lt;, baz, bang
@@ -1828,7 +1822,7 @@ HTML
1828
1822
  HAML
1829
1823
  end
1830
1824
 
1831
- unless Haml::Util.ruby1_8?
1825
+ unless RUBY_VERSION < "1.9"
1832
1826
  def test_default_encoding
1833
1827
  assert_equal(Encoding.find("utf-8"), render(<<HAML.encode("us-ascii")).encoding)
1834
1828
  %p bar