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.
- data/.yardopts +19 -7
- data/CHANGELOG.md +1224 -0
- data/FAQ.md +157 -0
- data/README.md +99 -62
- data/REFERENCE.md +1404 -0
- data/Rakefile +52 -341
- data/init.rb +1 -18
- data/lib/haml.rb +6 -30
- data/lib/haml/buffer.rb +37 -16
- data/lib/haml/compiler.rb +52 -13
- data/lib/haml/engine.rb +61 -44
- data/lib/haml/exec.rb +21 -4
- data/lib/haml/filters.rb +136 -166
- data/lib/haml/helpers.rb +37 -10
- data/lib/haml/helpers/action_view_extensions.rb +2 -1
- data/lib/haml/helpers/action_view_mods.rb +67 -181
- data/lib/haml/helpers/rails_323_textarea_fix.rb +39 -0
- data/lib/haml/helpers/xss_mods.rb +9 -11
- data/lib/haml/html.rb +22 -9
- data/lib/haml/html/erb.rb +1 -1
- data/lib/haml/parser.rb +22 -15
- data/lib/haml/railtie.rb +2 -13
- data/lib/haml/template.rb +18 -85
- data/lib/haml/template/options.rb +1 -1
- data/lib/haml/template/plugin.rb +15 -101
- data/lib/haml/util.rb +120 -603
- data/lib/haml/version.rb +1 -107
- data/test/{haml/engine_test.rb → engine_test.rb} +137 -143
- data/test/{haml/erb → erb}/_av_partial_1.erb +1 -1
- data/test/{haml/erb → erb}/_av_partial_2.erb +1 -1
- data/test/{haml/erb → erb}/action_view.erb +1 -1
- data/test/{haml/erb → erb}/standard.erb +0 -0
- data/test/filters_test.rb +141 -0
- data/test/gemfiles/Gemfile.rails-3.0.x +4 -6
- data/test/gemfiles/Gemfile.rails-3.1.x +5 -6
- data/test/gemfiles/Gemfile.rails-3.2.x +6 -0
- data/test/haml-spec/LICENSE +14 -0
- data/test/{haml/spec → haml-spec}/README.md +26 -17
- data/test/haml-spec/lua_haml_spec.lua +38 -0
- data/test/haml-spec/perl_haml_test.pl +81 -0
- data/test/haml-spec/ruby_haml_test.rb +23 -0
- data/test/{haml/spec → haml-spec}/tests.json +132 -54
- data/test/{haml/helper_test.rb → helper_test.rb} +50 -36
- data/test/{haml/html2haml → html2haml}/erb_tests.rb +0 -0
- data/test/{haml/html2haml_test.rb → html2haml_test.rb} +11 -5
- data/test/{haml/markaby → markaby}/standard.mab +0 -0
- data/test/{haml/mocks → mocks}/article.rb +0 -0
- data/test/{haml/results → results}/content_for_layout.xhtml +0 -0
- data/test/{haml/results → results}/eval_suppressed.xhtml +0 -0
- data/test/{haml/results → results}/helpers.xhtml +0 -0
- data/test/{haml/results → results}/helpful.xhtml +0 -0
- data/test/{haml/results → results}/just_stuff.xhtml +0 -0
- data/test/{haml/results → results}/list.xhtml +0 -0
- data/test/{haml/results → results}/nuke_inner_whitespace.xhtml +0 -0
- data/test/{haml/results → results}/nuke_outer_whitespace.xhtml +0 -0
- data/test/{haml/results → results}/original_engine.xhtml +0 -0
- data/test/{haml/results → results}/partial_layout.xhtml +0 -0
- data/test/{haml/results → results}/partials.xhtml +0 -0
- data/test/{haml/results → results}/render_layout.xhtml +0 -0
- data/test/{haml/results → results}/silent_script.xhtml +1 -1
- data/test/{haml/results → results}/standard.xhtml +0 -0
- data/test/{haml/results → results}/tag_parsing.xhtml +0 -0
- data/test/{haml/results → results}/very_basic.xhtml +0 -0
- data/test/{haml/results → results}/whitespace_handling.xhtml +46 -50
- data/test/{haml/template_test.rb → template_test.rb} +20 -81
- data/test/{haml/templates → templates}/_av_partial_1.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_1_ugly.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_2.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_2_ugly.haml +1 -1
- data/test/{haml/templates → templates}/_layout.erb +0 -0
- data/test/{haml/templates → templates}/_layout_for_partial.haml +0 -0
- data/test/{haml/templates → templates}/_partial.haml +0 -0
- data/test/{haml/templates → templates}/_text_area.haml +0 -0
- data/test/{haml/templates → templates}/action_view.haml +1 -1
- data/test/{haml/templates → templates}/action_view_ugly.haml +1 -1
- data/test/{haml/templates → templates}/breakage.haml +0 -0
- data/test/{haml/templates → templates}/content_for_layout.haml +0 -0
- data/test/{haml/templates → templates}/eval_suppressed.haml +0 -0
- data/test/{haml/templates → templates}/helpers.haml +0 -0
- data/test/{haml/templates → templates}/helpful.haml +0 -0
- data/test/{haml/templates → templates}/just_stuff.haml +0 -0
- data/test/{haml/templates → templates}/list.haml +0 -0
- data/test/{haml/templates → templates}/nuke_inner_whitespace.haml +0 -0
- data/test/{haml/templates → templates}/nuke_outer_whitespace.haml +0 -0
- data/test/{haml/templates → templates}/original_engine.haml +0 -0
- data/test/templates/partial_layout.haml +3 -0
- data/test/{haml/templates → templates}/partialize.haml +0 -0
- data/test/{haml/templates → templates}/partials.haml +0 -0
- data/test/{haml/templates → templates}/render_layout.haml +0 -0
- data/test/{haml/templates → templates}/silent_script.haml +2 -2
- data/test/{haml/templates → templates}/standard.haml +0 -0
- data/test/{haml/templates → templates}/standard_ugly.haml +0 -0
- data/test/{haml/templates → templates}/tag_parsing.haml +0 -0
- data/test/{haml/templates → templates}/very_basic.haml +0 -0
- data/test/{haml/templates → templates}/whitespace_handling.haml +0 -0
- data/test/test_helper.rb +42 -34
- data/test/util_test.rb +80 -0
- metadata +259 -427
- data/CONTRIBUTING +0 -3
- data/REVISION +0 -1
- data/VERSION +0 -1
- data/VERSION_NAME +0 -1
- data/extra/update_watch.rb +0 -13
- data/lib/haml/root.rb +0 -7
- data/lib/haml/shared.rb +0 -78
- data/lib/haml/template/patch.rb +0 -58
- data/lib/sass.rb +0 -8
- data/lib/sass/plugin.rb +0 -10
- data/lib/sass/rails2_shim.rb +0 -9
- data/lib/sass/rails3_shim.rb +0 -16
- data/test/benchmark.rb +0 -91
- data/test/gemfiles/Gemfile.rails-2.0.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.0.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.1.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.1.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.2.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.2.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.3.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.3.x.lock +0 -40
- data/test/gemfiles/Gemfile.rails-3.0.x.lock +0 -85
- data/test/gemfiles/Gemfile.rails-3.1.x.lock +0 -98
- data/test/gemfiles/Gemfile.rails-xss-2.3.x +0 -9
- data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +0 -42
- data/test/haml/results/filters.xhtml +0 -62
- data/test/haml/spec/lua_haml_spec.lua +0 -30
- data/test/haml/spec/ruby_haml_test.rb +0 -19
- data/test/haml/spec_test.rb +0 -44
- data/test/haml/templates/filters.haml +0 -66
- data/test/haml/templates/partial_layout.haml +0 -10
- data/test/haml/util_test.rb +0 -300
- data/test/linked_rails.rb +0 -42
- data/vendor/sass/CONTRIBUTING +0 -3
- data/vendor/sass/MIT-LICENSE +0 -20
- data/vendor/sass/README.md +0 -201
- data/vendor/sass/Rakefile +0 -339
- data/vendor/sass/TODO +0 -39
- data/vendor/sass/VERSION +0 -1
- data/vendor/sass/VERSION_NAME +0 -1
- data/vendor/sass/bin/sass +0 -8
- data/vendor/sass/bin/sass-convert +0 -7
- data/vendor/sass/bin/scss +0 -8
- data/vendor/sass/doc-src/FAQ.md +0 -35
- data/vendor/sass/doc-src/INDENTED_SYNTAX.md +0 -210
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +0 -2327
- data/vendor/sass/doc-src/SASS_REFERENCE.md +0 -1965
- data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +0 -155
- data/vendor/sass/ext/extconf.rb +0 -10
- data/vendor/sass/extra/update_watch.rb +0 -13
- data/vendor/sass/init.rb +0 -18
- data/vendor/sass/lib/sass.rb +0 -73
- data/vendor/sass/lib/sass/cache_stores.rb +0 -15
- data/vendor/sass/lib/sass/cache_stores/base.rb +0 -86
- data/vendor/sass/lib/sass/cache_stores/chain.rb +0 -33
- data/vendor/sass/lib/sass/cache_stores/filesystem.rb +0 -60
- data/vendor/sass/lib/sass/cache_stores/memory.rb +0 -47
- data/vendor/sass/lib/sass/cache_stores/null.rb +0 -25
- data/vendor/sass/lib/sass/callbacks.rb +0 -66
- data/vendor/sass/lib/sass/css.rb +0 -295
- data/vendor/sass/lib/sass/engine.rb +0 -878
- data/vendor/sass/lib/sass/environment.rb +0 -166
- data/vendor/sass/lib/sass/error.rb +0 -201
- data/vendor/sass/lib/sass/exec.rb +0 -672
- data/vendor/sass/lib/sass/importers.rb +0 -22
- data/vendor/sass/lib/sass/importers/base.rb +0 -139
- data/vendor/sass/lib/sass/importers/filesystem.rb +0 -149
- data/vendor/sass/lib/sass/less.rb +0 -382
- data/vendor/sass/lib/sass/logger.rb +0 -15
- data/vendor/sass/lib/sass/logger/base.rb +0 -32
- data/vendor/sass/lib/sass/logger/log_level.rb +0 -49
- data/vendor/sass/lib/sass/plugin.rb +0 -132
- data/vendor/sass/lib/sass/plugin/compiler.rb +0 -383
- data/vendor/sass/lib/sass/plugin/configuration.rb +0 -123
- data/vendor/sass/lib/sass/plugin/generic.rb +0 -15
- data/vendor/sass/lib/sass/plugin/merb.rb +0 -48
- data/vendor/sass/lib/sass/plugin/rack.rb +0 -60
- data/vendor/sass/lib/sass/plugin/rails.rb +0 -47
- data/vendor/sass/lib/sass/plugin/staleness_checker.rb +0 -173
- data/vendor/sass/lib/sass/railtie.rb +0 -9
- data/vendor/sass/lib/sass/repl.rb +0 -58
- data/vendor/sass/lib/sass/root.rb +0 -7
- data/vendor/sass/lib/sass/script.rb +0 -40
- data/vendor/sass/lib/sass/script/bool.rb +0 -18
- data/vendor/sass/lib/sass/script/color.rb +0 -480
- data/vendor/sass/lib/sass/script/css_lexer.rb +0 -29
- data/vendor/sass/lib/sass/script/css_parser.rb +0 -31
- data/vendor/sass/lib/sass/script/funcall.rb +0 -175
- data/vendor/sass/lib/sass/script/functions.rb +0 -1386
- data/vendor/sass/lib/sass/script/interpolation.rb +0 -79
- data/vendor/sass/lib/sass/script/lexer.rb +0 -339
- data/vendor/sass/lib/sass/script/list.rb +0 -83
- data/vendor/sass/lib/sass/script/literal.rb +0 -250
- data/vendor/sass/lib/sass/script/node.rb +0 -99
- data/vendor/sass/lib/sass/script/number.rb +0 -452
- data/vendor/sass/lib/sass/script/operation.rb +0 -99
- data/vendor/sass/lib/sass/script/parser.rb +0 -474
- data/vendor/sass/lib/sass/script/string.rb +0 -51
- data/vendor/sass/lib/sass/script/string_interpolation.rb +0 -103
- data/vendor/sass/lib/sass/script/unary_operation.rb +0 -64
- data/vendor/sass/lib/sass/script/variable.rb +0 -59
- data/vendor/sass/lib/sass/scss.rb +0 -17
- data/vendor/sass/lib/sass/scss/css_parser.rb +0 -46
- data/vendor/sass/lib/sass/scss/parser.rb +0 -960
- data/vendor/sass/lib/sass/scss/rx.rb +0 -128
- data/vendor/sass/lib/sass/scss/sass_parser.rb +0 -11
- data/vendor/sass/lib/sass/scss/script_lexer.rb +0 -15
- data/vendor/sass/lib/sass/scss/script_parser.rb +0 -25
- data/vendor/sass/lib/sass/scss/static_parser.rb +0 -40
- data/vendor/sass/lib/sass/selector.rb +0 -361
- data/vendor/sass/lib/sass/selector/abstract_sequence.rb +0 -62
- data/vendor/sass/lib/sass/selector/comma_sequence.rb +0 -81
- data/vendor/sass/lib/sass/selector/sequence.rb +0 -233
- data/vendor/sass/lib/sass/selector/simple.rb +0 -113
- data/vendor/sass/lib/sass/selector/simple_sequence.rb +0 -134
- data/vendor/sass/lib/sass/shared.rb +0 -78
- data/vendor/sass/lib/sass/tree/charset_node.rb +0 -22
- data/vendor/sass/lib/sass/tree/comment_node.rb +0 -90
- data/vendor/sass/lib/sass/tree/debug_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/directive_node.rb +0 -23
- data/vendor/sass/lib/sass/tree/each_node.rb +0 -24
- data/vendor/sass/lib/sass/tree/extend_node.rb +0 -29
- data/vendor/sass/lib/sass/tree/for_node.rb +0 -36
- data/vendor/sass/lib/sass/tree/function_node.rb +0 -27
- data/vendor/sass/lib/sass/tree/if_node.rb +0 -52
- data/vendor/sass/lib/sass/tree/import_node.rb +0 -68
- data/vendor/sass/lib/sass/tree/media_node.rb +0 -32
- data/vendor/sass/lib/sass/tree/mixin_def_node.rb +0 -27
- data/vendor/sass/lib/sass/tree/mixin_node.rb +0 -32
- data/vendor/sass/lib/sass/tree/node.rb +0 -201
- data/vendor/sass/lib/sass/tree/prop_node.rb +0 -148
- data/vendor/sass/lib/sass/tree/return_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/root_node.rb +0 -28
- data/vendor/sass/lib/sass/tree/rule_node.rb +0 -136
- data/vendor/sass/lib/sass/tree/variable_node.rb +0 -30
- data/vendor/sass/lib/sass/tree/visitors/base.rb +0 -75
- data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +0 -133
- data/vendor/sass/lib/sass/tree/visitors/convert.rb +0 -260
- data/vendor/sass/lib/sass/tree/visitors/cssize.rb +0 -175
- data/vendor/sass/lib/sass/tree/visitors/deep_copy.rb +0 -87
- data/vendor/sass/lib/sass/tree/visitors/perform.rb +0 -332
- data/vendor/sass/lib/sass/tree/visitors/set_options.rb +0 -97
- data/vendor/sass/lib/sass/tree/visitors/to_css.rb +0 -210
- data/vendor/sass/lib/sass/tree/warn_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/while_node.rb +0 -18
- data/vendor/sass/lib/sass/util.rb +0 -721
- data/vendor/sass/lib/sass/util/subset_map.rb +0 -101
- data/vendor/sass/lib/sass/version.rb +0 -112
- data/vendor/sass/rails/init.rb +0 -1
- data/vendor/sass/sass.gemspec +0 -33
- data/vendor/sass/test/Gemfile +0 -4
- data/vendor/sass/test/Gemfile.lock +0 -19
- data/vendor/sass/test/sass/cache_test.rb +0 -89
- data/vendor/sass/test/sass/callbacks_test.rb +0 -61
- data/vendor/sass/test/sass/conversion_test.rb +0 -1199
- data/vendor/sass/test/sass/css2sass_test.rb +0 -373
- data/vendor/sass/test/sass/data/hsl-rgb.txt +0 -319
- data/vendor/sass/test/sass/engine_test.rb +0 -2567
- data/vendor/sass/test/sass/extend_test.rb +0 -1348
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
- data/vendor/sass/test/sass/functions_test.rb +0 -1038
- data/vendor/sass/test/sass/importer_test.rb +0 -192
- data/vendor/sass/test/sass/less_conversion_test.rb +0 -653
- data/vendor/sass/test/sass/logger_test.rb +0 -58
- data/vendor/sass/test/sass/mock_importer.rb +0 -49
- data/vendor/sass/test/sass/more_results/more1.css +0 -9
- data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +0 -26
- data/vendor/sass/test/sass/more_results/more_import.css +0 -29
- data/vendor/sass/test/sass/more_templates/_more_partial.sass +0 -2
- data/vendor/sass/test/sass/more_templates/more1.sass +0 -23
- data/vendor/sass/test/sass/more_templates/more_import.sass +0 -11
- data/vendor/sass/test/sass/plugin_test.rb +0 -472
- data/vendor/sass/test/sass/results/alt.css +0 -4
- data/vendor/sass/test/sass/results/basic.css +0 -9
- data/vendor/sass/test/sass/results/compact.css +0 -5
- data/vendor/sass/test/sass/results/complex.css +0 -86
- data/vendor/sass/test/sass/results/compressed.css +0 -1
- data/vendor/sass/test/sass/results/expanded.css +0 -19
- data/vendor/sass/test/sass/results/if.css +0 -3
- data/vendor/sass/test/sass/results/import.css +0 -31
- data/vendor/sass/test/sass/results/import_charset.css +0 -4
- data/vendor/sass/test/sass/results/import_charset_1_8.css +0 -4
- data/vendor/sass/test/sass/results/import_charset_ibm866.css +0 -4
- data/vendor/sass/test/sass/results/line_numbers.css +0 -49
- data/vendor/sass/test/sass/results/mixins.css +0 -95
- data/vendor/sass/test/sass/results/multiline.css +0 -24
- data/vendor/sass/test/sass/results/nested.css +0 -22
- data/vendor/sass/test/sass/results/options.css +0 -1
- data/vendor/sass/test/sass/results/parent_ref.css +0 -13
- data/vendor/sass/test/sass/results/script.css +0 -16
- data/vendor/sass/test/sass/results/scss_import.css +0 -31
- data/vendor/sass/test/sass/results/scss_importee.css +0 -2
- data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
- data/vendor/sass/test/sass/results/subdir/subdir.css +0 -3
- data/vendor/sass/test/sass/results/units.css +0 -11
- data/vendor/sass/test/sass/results/warn.css +0 -0
- data/vendor/sass/test/sass/results/warn_imported.css +0 -0
- data/vendor/sass/test/sass/script_conversion_test.rb +0 -285
- data/vendor/sass/test/sass/script_test.rb +0 -514
- data/vendor/sass/test/sass/scss/css_test.rb +0 -922
- data/vendor/sass/test/sass/scss/rx_test.rb +0 -156
- data/vendor/sass/test/sass/scss/scss_test.rb +0 -1273
- data/vendor/sass/test/sass/scss/test_helper.rb +0 -37
- data/vendor/sass/test/sass/templates/_imported_charset_ibm866.sass +0 -4
- data/vendor/sass/test/sass/templates/_imported_charset_utf8.sass +0 -4
- data/vendor/sass/test/sass/templates/_partial.sass +0 -2
- data/vendor/sass/test/sass/templates/alt.sass +0 -16
- data/vendor/sass/test/sass/templates/basic.sass +0 -23
- data/vendor/sass/test/sass/templates/bork1.sass +0 -2
- data/vendor/sass/test/sass/templates/bork2.sass +0 -2
- data/vendor/sass/test/sass/templates/bork3.sass +0 -2
- data/vendor/sass/test/sass/templates/bork4.sass +0 -2
- data/vendor/sass/test/sass/templates/bork5.sass +0 -3
- data/vendor/sass/test/sass/templates/compact.sass +0 -17
- data/vendor/sass/test/sass/templates/complex.sass +0 -305
- data/vendor/sass/test/sass/templates/compressed.sass +0 -15
- data/vendor/sass/test/sass/templates/expanded.sass +0 -17
- data/vendor/sass/test/sass/templates/if.sass +0 -11
- data/vendor/sass/test/sass/templates/import.sass +0 -12
- data/vendor/sass/test/sass/templates/import_charset.sass +0 -7
- data/vendor/sass/test/sass/templates/import_charset_1_8.sass +0 -4
- data/vendor/sass/test/sass/templates/import_charset_ibm866.sass +0 -9
- data/vendor/sass/test/sass/templates/importee.less +0 -2
- data/vendor/sass/test/sass/templates/importee.sass +0 -19
- data/vendor/sass/test/sass/templates/line_numbers.sass +0 -13
- data/vendor/sass/test/sass/templates/mixin_bork.sass +0 -5
- data/vendor/sass/test/sass/templates/mixins.sass +0 -76
- data/vendor/sass/test/sass/templates/multiline.sass +0 -20
- data/vendor/sass/test/sass/templates/nested.sass +0 -25
- data/vendor/sass/test/sass/templates/nested_bork1.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork2.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork3.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork4.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork5.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_import.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +0 -6
- data/vendor/sass/test/sass/templates/options.sass +0 -2
- data/vendor/sass/test/sass/templates/parent_ref.sass +0 -25
- data/vendor/sass/test/sass/templates/script.sass +0 -101
- data/vendor/sass/test/sass/templates/scss_import.scss +0 -11
- data/vendor/sass/test/sass/templates/scss_importee.scss +0 -1
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
- data/vendor/sass/test/sass/templates/subdir/subdir.sass +0 -6
- data/vendor/sass/test/sass/templates/units.sass +0 -11
- data/vendor/sass/test/sass/templates/warn.sass +0 -3
- data/vendor/sass/test/sass/templates/warn_imported.sass +0 -4
- data/vendor/sass/test/sass/test_helper.rb +0 -8
- data/vendor/sass/test/sass/util/subset_map_test.rb +0 -91
- data/vendor/sass/test/sass/util_test.rb +0 -266
- data/vendor/sass/test/test_helper.rb +0 -69
- data/vendor/sass/vendor/fssm/Gemfile +0 -3
- data/vendor/sass/vendor/fssm/LICENSE +0 -20
- data/vendor/sass/vendor/fssm/README.markdown +0 -83
- data/vendor/sass/vendor/fssm/Rakefile +0 -11
- data/vendor/sass/vendor/fssm/example.rb +0 -12
- data/vendor/sass/vendor/fssm/fssm.gemspec +0 -24
- data/vendor/sass/vendor/fssm/lib/fssm.rb +0 -37
- data/vendor/sass/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
- data/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rbfsevent.rb +0 -42
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
- data/vendor/sass/vendor/fssm/lib/fssm/monitor.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/path.rb +0 -94
- data/vendor/sass/vendor/fssm/lib/fssm/pathname.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/state/directory.rb +0 -75
- data/vendor/sass/vendor/fssm/lib/fssm/state/file.rb +0 -24
- data/vendor/sass/vendor/fssm/lib/fssm/support.rb +0 -92
- data/vendor/sass/vendor/fssm/lib/fssm/tree.rb +0 -176
- data/vendor/sass/vendor/fssm/lib/fssm/version.rb +0 -3
- data/vendor/sass/vendor/fssm/profile/prof-cache.rb +0 -40
- data/vendor/sass/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
- data/vendor/sass/vendor/fssm/profile/prof-pathname-rubinius.rb +0 -35
- data/vendor/sass/vendor/fssm/profile/prof-pathname.rb +0 -68
- data/vendor/sass/vendor/fssm/profile/prof-plain-pathname.html +0 -988
- data/vendor/sass/vendor/fssm/profile/prof.html +0 -2379
- data/vendor/sass/vendor/fssm/spec/count_down_latch.rb +0 -151
- data/vendor/sass/vendor/fssm/spec/monitor_spec.rb +0 -202
- data/vendor/sass/vendor/fssm/spec/path_spec.rb +0 -96
- data/vendor/sass/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/sass/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/sass/vendor/fssm/spec/spec_helper.rb +0 -14
- data/vendor/sass/yard/callbacks.rb +0 -29
- data/vendor/sass/yard/default/fulldoc/html/css/common.sass +0 -26
- data/vendor/sass/yard/default/layout/html/footer.erb +0 -12
- data/vendor/sass/yard/inherited_hash.rb +0 -41
data/lib/haml/version.rb
CHANGED
@@ -1,109 +1,3 @@
|
|
1
|
-
require 'haml/util'
|
2
|
-
|
3
1
|
module Haml
|
4
|
-
|
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
|
2
|
+
require 'test_helper'
|
4
3
|
|
5
|
-
class EngineTest <
|
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{
|
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
|
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
|
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
|
194
|
+
<a href='http://haml.info'></a>
|
197
195
|
</p>
|
198
196
|
HTML
|
199
197
|
%p
|
200
|
-
%a{:href => "http://" + "haml
|
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
|
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&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
|
-
|
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
|
1072
|
+
assert_equal("<p escaped=\"q'uo"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 =>
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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'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
|
-
|
1500
|
-
|
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<, baz, bang
|
@@ -1828,7 +1822,7 @@ HTML
|
|
1828
1822
|
HAML
|
1829
1823
|
end
|
1830
1824
|
|
1831
|
-
unless
|
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
|