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
@@ -1,18 +0,0 @@
|
|
1
|
-
module Sass
|
2
|
-
module Tree
|
3
|
-
# A dynamic node representing returning from a function.
|
4
|
-
#
|
5
|
-
# @see Sass::Tree
|
6
|
-
class ReturnNode < Node
|
7
|
-
# The expression to return.
|
8
|
-
# @type [Script::Node]
|
9
|
-
attr_accessor :expr
|
10
|
-
|
11
|
-
# @param expr [Script::Node] The expression to return
|
12
|
-
def initialize(expr)
|
13
|
-
@expr = expr
|
14
|
-
super()
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Sass
|
2
|
-
module Tree
|
3
|
-
# A static node that is the root node of the Sass document.
|
4
|
-
class RootNode < Node
|
5
|
-
# The Sass template from which this node was created
|
6
|
-
#
|
7
|
-
# @param template [String]
|
8
|
-
attr_reader :template
|
9
|
-
|
10
|
-
# @param template [String] The Sass template from which this node was created
|
11
|
-
def initialize(template)
|
12
|
-
super()
|
13
|
-
@template = template
|
14
|
-
end
|
15
|
-
|
16
|
-
# Runs the dynamic Sass code *and* computes the CSS for the tree.
|
17
|
-
# @see #to_s
|
18
|
-
def render
|
19
|
-
Visitors::CheckNesting.visit(self)
|
20
|
-
result = Visitors::Perform.visit(self)
|
21
|
-
Visitors::CheckNesting.visit(result) # Check again to validate mixins
|
22
|
-
result, extends = Visitors::Cssize.visit(result)
|
23
|
-
result = result.do_extend(extends) unless extends.empty?
|
24
|
-
result.to_s
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,136 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require 'uri'
|
3
|
-
|
4
|
-
module Sass::Tree
|
5
|
-
# A static node reprenting a CSS rule.
|
6
|
-
#
|
7
|
-
# @see Sass::Tree
|
8
|
-
class RuleNode < Node
|
9
|
-
# The character used to include the parent selector
|
10
|
-
PARENT = '&'
|
11
|
-
|
12
|
-
# The CSS selector for this rule,
|
13
|
-
# interspersed with {Sass::Script::Node}s
|
14
|
-
# representing `#{}`-interpolation.
|
15
|
-
# Any adjacent strings will be merged together.
|
16
|
-
#
|
17
|
-
# @return [Array<String, Sass::Script::Node>]
|
18
|
-
attr_accessor :rule
|
19
|
-
|
20
|
-
# The CSS selector for this rule,
|
21
|
-
# without any unresolved interpolation
|
22
|
-
# but with parent references still intact.
|
23
|
-
# It's only set once {Tree::Node#perform} has been called.
|
24
|
-
#
|
25
|
-
# @return [Selector::CommaSequence]
|
26
|
-
attr_accessor :parsed_rules
|
27
|
-
|
28
|
-
# The CSS selector for this rule,
|
29
|
-
# without any unresolved interpolation or parent references.
|
30
|
-
# It's only set once {Tree::Visitors::Cssize} has been run.
|
31
|
-
#
|
32
|
-
# @return [Selector::CommaSequence]
|
33
|
-
attr_accessor :resolved_rules
|
34
|
-
|
35
|
-
# How deep this rule is indented
|
36
|
-
# relative to a base-level rule.
|
37
|
-
# This is only greater than 0 in the case that:
|
38
|
-
#
|
39
|
-
# * This node is in a CSS tree
|
40
|
-
# * The style is :nested
|
41
|
-
# * This is a child rule of another rule
|
42
|
-
# * The parent rule has properties, and thus will be rendered
|
43
|
-
#
|
44
|
-
# @return [Fixnum]
|
45
|
-
attr_accessor :tabs
|
46
|
-
|
47
|
-
# Whether or not this rule is the last rule in a nested group.
|
48
|
-
# This is only set in a CSS tree.
|
49
|
-
#
|
50
|
-
# @return [Boolean]
|
51
|
-
attr_accessor :group_end
|
52
|
-
|
53
|
-
# The stack trace.
|
54
|
-
# This is only readable in a CSS tree as it is written during the perform step
|
55
|
-
# and only when the :trace_selectors option is set.
|
56
|
-
#
|
57
|
-
# @return [Array<String>]
|
58
|
-
attr_accessor :stack_trace
|
59
|
-
|
60
|
-
# @param rule [Array<String, Sass::Script::Node>]
|
61
|
-
# The CSS rule. See \{#rule}
|
62
|
-
def initialize(rule)
|
63
|
-
merged = Sass::Util.merge_adjacent_strings(rule)
|
64
|
-
@rule = Sass::Util.strip_string_array(merged)
|
65
|
-
@tabs = 0
|
66
|
-
try_to_parse_non_interpolated_rules
|
67
|
-
super()
|
68
|
-
end
|
69
|
-
|
70
|
-
# If we've precached the parsed selector, set the line on it, too.
|
71
|
-
def line=(line)
|
72
|
-
@parsed_rules.line = line if @parsed_rules
|
73
|
-
super
|
74
|
-
end
|
75
|
-
|
76
|
-
# If we've precached the parsed selector, set the filename on it, too.
|
77
|
-
def filename=(filename)
|
78
|
-
@parsed_rules.filename = filename if @parsed_rules
|
79
|
-
super
|
80
|
-
end
|
81
|
-
|
82
|
-
# Compares the contents of two rules.
|
83
|
-
#
|
84
|
-
# @param other [Object] The object to compare with
|
85
|
-
# @return [Boolean] Whether or not this node and the other object
|
86
|
-
# are the same
|
87
|
-
def ==(other)
|
88
|
-
self.class == other.class && rule == other.rule && super
|
89
|
-
end
|
90
|
-
|
91
|
-
# Adds another {RuleNode}'s rules to this one's.
|
92
|
-
#
|
93
|
-
# @param node [RuleNode] The other node
|
94
|
-
def add_rules(node)
|
95
|
-
@rule = Sass::Util.strip_string_array(
|
96
|
-
Sass::Util.merge_adjacent_strings(@rule + ["\n"] + node.rule))
|
97
|
-
try_to_parse_non_interpolated_rules
|
98
|
-
end
|
99
|
-
|
100
|
-
# @return [Boolean] Whether or not this rule is continued on the next line
|
101
|
-
def continued?
|
102
|
-
last = @rule.last
|
103
|
-
last.is_a?(String) && last[-1] == ?,
|
104
|
-
end
|
105
|
-
|
106
|
-
# Extends this Rule's selector with the given `extends`.
|
107
|
-
#
|
108
|
-
# @see Node#do_extend
|
109
|
-
def do_extend(extends)
|
110
|
-
node = dup
|
111
|
-
node.resolved_rules = resolved_rules.do_extend(extends)
|
112
|
-
node
|
113
|
-
end
|
114
|
-
|
115
|
-
# A hash that will be associated with this rule in the CSS document
|
116
|
-
# if the {file:SASS_REFERENCE.md#debug_info-option `:debug_info` option} is enabled.
|
117
|
-
# This data is used by e.g. [the FireSass Firebug extension](https://addons.mozilla.org/en-US/firefox/addon/103988).
|
118
|
-
#
|
119
|
-
# @return [{#to_s => #to_s}]
|
120
|
-
def debug_info
|
121
|
-
{:filename => filename && ("file://" + URI.escape(File.expand_path(filename))),
|
122
|
-
:line => self.line}
|
123
|
-
end
|
124
|
-
|
125
|
-
private
|
126
|
-
|
127
|
-
def try_to_parse_non_interpolated_rules
|
128
|
-
if @rule.all? {|t| t.kind_of?(String)}
|
129
|
-
# We don't use real filename/line info because we don't have it yet.
|
130
|
-
# When we get it, we'll set it on the parsed rules if possible.
|
131
|
-
parser = Sass::SCSS::StaticParser.new(@rule.join.strip, '', 1)
|
132
|
-
@parsed_rules = parser.parse_selector rescue nil
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Sass
|
2
|
-
module Tree
|
3
|
-
# A dynamic node representing a variable definition.
|
4
|
-
#
|
5
|
-
# @see Sass::Tree
|
6
|
-
class VariableNode < Node
|
7
|
-
# The name of the variable.
|
8
|
-
# @return [String]
|
9
|
-
attr_reader :name
|
10
|
-
|
11
|
-
# The parse tree for the variable value.
|
12
|
-
# @return [Script::Node]
|
13
|
-
attr_accessor :expr
|
14
|
-
|
15
|
-
# Whether this is a guarded variable assignment (`!default`).
|
16
|
-
# @return [Boolean]
|
17
|
-
attr_reader :guarded
|
18
|
-
|
19
|
-
# @param name [String] The name of the variable
|
20
|
-
# @param expr [Script::Node] See \{#expr}
|
21
|
-
# @param guarded [Boolean] See \{#guarded}
|
22
|
-
def initialize(name, expr, guarded)
|
23
|
-
@name = name
|
24
|
-
@expr = expr
|
25
|
-
@guarded = guarded
|
26
|
-
super()
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# Visitors are used to traverse the Sass parse tree.
|
2
|
-
# Visitors should extend {Visitors::Base},
|
3
|
-
# which provides a small amount of scaffolding for traversal.
|
4
|
-
module Sass::Tree::Visitors
|
5
|
-
# The abstract base class for Sass visitors.
|
6
|
-
# Visitors should extend this class,
|
7
|
-
# then implement `visit_*` methods for each node they care about
|
8
|
-
# (e.g. `visit_rule` for {RuleNode} or `visit_for` for {ForNode}).
|
9
|
-
# These methods take the node in question as argument.
|
10
|
-
# They may `yield` to visit the child nodes of the current node.
|
11
|
-
#
|
12
|
-
# *Note*: due to the unusual nature of {Sass::Tree::IfNode},
|
13
|
-
# special care must be taken to ensure that it is properly handled.
|
14
|
-
# In particular, there is no built-in scaffolding
|
15
|
-
# for dealing with the return value of `@else` nodes.
|
16
|
-
#
|
17
|
-
# @abstract
|
18
|
-
class Base
|
19
|
-
# Runs the visitor on a tree.
|
20
|
-
#
|
21
|
-
# @param root [Tree::Node] The root node of the Sass tree.
|
22
|
-
# @return [Object] The return value of \{#visit} for the root node.
|
23
|
-
def self.visit(root)
|
24
|
-
new.send(:visit, root)
|
25
|
-
end
|
26
|
-
|
27
|
-
protected
|
28
|
-
|
29
|
-
# Runs the visitor on the given node.
|
30
|
-
# This can be overridden by subclasses that need to do something for each node.
|
31
|
-
#
|
32
|
-
# @param node [Tree::Node] The node to visit.
|
33
|
-
# @return [Object] The return value of the `visit_*` method for this node.
|
34
|
-
def visit(node)
|
35
|
-
method = "visit_#{node_name node}"
|
36
|
-
if self.respond_to?(method)
|
37
|
-
self.send(method, node) {visit_children(node)}
|
38
|
-
else
|
39
|
-
visit_children(node)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Visit the child nodes for a given node.
|
44
|
-
# This can be overridden by subclasses that need to do something
|
45
|
-
# with the child nodes' return values.
|
46
|
-
#
|
47
|
-
# This method is run when `visit_*` methods `yield`,
|
48
|
-
# and its return value is returned from the `yield`.
|
49
|
-
#
|
50
|
-
# @param parent [Tree::Node] The parent node of the children to visit.
|
51
|
-
# @return [Array<Object>] The return values of the `visit_*` methods for the children.
|
52
|
-
def visit_children(parent)
|
53
|
-
parent.children.map {|c| visit(c)}
|
54
|
-
end
|
55
|
-
|
56
|
-
NODE_NAME_RE = /.*::(.*?)Node$/
|
57
|
-
|
58
|
-
# Returns the name of a node as used in the `visit_*` method.
|
59
|
-
#
|
60
|
-
# @param [Tree::Node] node The node.
|
61
|
-
# @return [String] The name.
|
62
|
-
def node_name(node)
|
63
|
-
@@node_names ||= {}
|
64
|
-
@@node_names[node.class.name] ||= node.class.name.gsub(NODE_NAME_RE, '\\1').downcase
|
65
|
-
end
|
66
|
-
|
67
|
-
# `yield`s, then runs the visitor on the `@else` clause if the node has one.
|
68
|
-
# This exists to ensure that the contents of the `@else` clause get visited.
|
69
|
-
def visit_if(node)
|
70
|
-
yield
|
71
|
-
visit(node.else) if node.else
|
72
|
-
node
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,133 +0,0 @@
|
|
1
|
-
# A visitor for checking that all nodes are properly nested.
|
2
|
-
class Sass::Tree::Visitors::CheckNesting < Sass::Tree::Visitors::Base
|
3
|
-
protected
|
4
|
-
|
5
|
-
def visit(node)
|
6
|
-
if error = (@parent && (
|
7
|
-
try_send("invalid_#{node_name @parent}_child?", @parent, node) ||
|
8
|
-
try_send("invalid_#{node_name node}_parent?", @parent, node))) ||
|
9
|
-
(@real_parent && (
|
10
|
-
try_send("invalid_#{node_name @real_parent}_real_child?", @real_parent, node) ||
|
11
|
-
try_send("invalid_#{node_name node}_real_parent?", @real_parent, node)))
|
12
|
-
raise Sass::SyntaxError.new(error)
|
13
|
-
end
|
14
|
-
super
|
15
|
-
rescue Sass::SyntaxError => e
|
16
|
-
e.modify_backtrace(:filename => node.filename, :line => node.line)
|
17
|
-
raise e
|
18
|
-
end
|
19
|
-
|
20
|
-
CONTROL_NODES = [Sass::Tree::EachNode, Sass::Tree::ForNode, Sass::Tree::IfNode, Sass::Tree::WhileNode]
|
21
|
-
SCRIPT_NODES = [Sass::Tree::ImportNode, Sass::Tree::MixinNode] + CONTROL_NODES
|
22
|
-
def visit_children(parent)
|
23
|
-
old_parent = @parent
|
24
|
-
@parent = parent unless is_any_of?(parent, SCRIPT_NODES)
|
25
|
-
old_real_parent, @real_parent = @real_parent, parent
|
26
|
-
super
|
27
|
-
ensure
|
28
|
-
@parent = old_parent
|
29
|
-
@real_parent = old_real_parent
|
30
|
-
end
|
31
|
-
|
32
|
-
def visit_root(node)
|
33
|
-
yield
|
34
|
-
rescue Sass::SyntaxError => e
|
35
|
-
e.sass_template ||= node.template
|
36
|
-
raise e
|
37
|
-
end
|
38
|
-
|
39
|
-
def visit_import(node)
|
40
|
-
yield
|
41
|
-
rescue Sass::SyntaxError => e
|
42
|
-
e.modify_backtrace(:filename => node.children.first.filename)
|
43
|
-
e.add_backtrace(:filename => node.filename, :line => node.line)
|
44
|
-
raise e
|
45
|
-
end
|
46
|
-
|
47
|
-
def invalid_charset_parent?(parent, child)
|
48
|
-
"@charset may only be used at the root of a document." unless parent.is_a?(Sass::Tree::RootNode)
|
49
|
-
end
|
50
|
-
|
51
|
-
VALID_EXTEND_PARENTS = [Sass::Tree::RuleNode, Sass::Tree::MixinDefNode]
|
52
|
-
def invalid_extend_parent?(parent, child)
|
53
|
-
unless is_any_of?(parent, VALID_EXTEND_PARENTS)
|
54
|
-
"Extend directives may only be used within rules."
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def invalid_function_parent?(parent, child)
|
59
|
-
"Functions may only be defined at the root of a document." unless parent.is_a?(Sass::Tree::RootNode)
|
60
|
-
end
|
61
|
-
|
62
|
-
VALID_FUNCTION_CHILDREN = [
|
63
|
-
Sass::Tree::CommentNode, Sass::Tree::DebugNode, Sass::Tree::ReturnNode,
|
64
|
-
Sass::Tree::VariableNode, Sass::Tree::WarnNode
|
65
|
-
] + CONTROL_NODES
|
66
|
-
def invalid_function_child?(parent, child)
|
67
|
-
unless is_any_of?(child, VALID_FUNCTION_CHILDREN)
|
68
|
-
"Functions can only contain variable declarations and control directives."
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
VALID_IMPORT_PARENTS = [
|
73
|
-
Sass::Tree::IfNode, Sass::Tree::ForNode, Sass::Tree::WhileNode,
|
74
|
-
Sass::Tree::EachNode, Sass::Tree::MixinDefNode
|
75
|
-
]
|
76
|
-
def invalid_import_parent?(parent, child)
|
77
|
-
if is_any_of?(@real_parent, VALID_IMPORT_PARENTS)
|
78
|
-
return "Import directives may not be used within control directives or mixins."
|
79
|
-
end
|
80
|
-
return if parent.is_a?(Sass::Tree::RootNode)
|
81
|
-
return "CSS import directives may only be used at the root of a document." if child.css_import?
|
82
|
-
# If this is a nested @import, we need to make sure it doesn't have anything
|
83
|
-
# that's legal at top-level but not in the current context (e.g. mixin defs).
|
84
|
-
child.imported_file.to_tree.children.each {|c| visit(c)}
|
85
|
-
nil
|
86
|
-
rescue Sass::SyntaxError => e
|
87
|
-
e.modify_backtrace(:filename => child.imported_file.options[:filename])
|
88
|
-
e.add_backtrace(:filename => child.filename, :line => child.line)
|
89
|
-
raise e
|
90
|
-
end
|
91
|
-
|
92
|
-
def invalid_import_real_parent?(parent, child)
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
def invalid_mixindef_parent?(parent, child)
|
97
|
-
"Mixins may only be defined at the root of a document." unless parent.is_a?(Sass::Tree::RootNode)
|
98
|
-
end
|
99
|
-
|
100
|
-
VALID_PROP_CHILDREN = [Sass::Tree::CommentNode, Sass::Tree::PropNode, Sass::Tree::MixinNode] + CONTROL_NODES
|
101
|
-
def invalid_prop_child?(parent, child)
|
102
|
-
unless is_any_of?(child, VALID_PROP_CHILDREN)
|
103
|
-
"Illegal nesting: Only properties may be nested beneath properties."
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
VALID_PROP_PARENTS = [Sass::Tree::RuleNode, Sass::Tree::PropNode,
|
108
|
-
Sass::Tree::MixinDefNode, Sass::Tree::DirectiveNode]
|
109
|
-
def invalid_prop_parent?(parent, child)
|
110
|
-
unless is_any_of?(parent, VALID_PROP_PARENTS)
|
111
|
-
"Properties are only allowed within rules, directives, or other properties." + child.pseudo_class_selector_message
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def invalid_return_parent?(parent, child)
|
116
|
-
"@return may only be used within a function." unless parent.is_a?(Sass::Tree::FunctionNode)
|
117
|
-
end
|
118
|
-
|
119
|
-
private
|
120
|
-
|
121
|
-
def is_any_of?(val, classes)
|
122
|
-
for c in classes
|
123
|
-
return true if val.is_a?(c)
|
124
|
-
end
|
125
|
-
return false
|
126
|
-
end
|
127
|
-
|
128
|
-
def try_send(method, *args, &block)
|
129
|
-
return unless respond_to?(method)
|
130
|
-
send(method, *args, &block)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
@@ -1,260 +0,0 @@
|
|
1
|
-
# A visitor for converting a Sass tree into a source string.
|
2
|
-
class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
|
3
|
-
# Runs the visitor on a tree.
|
4
|
-
#
|
5
|
-
# @param root [Tree::Node] The root node of the Sass tree.
|
6
|
-
# @param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}).
|
7
|
-
# @param format [Symbol] `:sass` or `:scss`.
|
8
|
-
# @return [String] The Sass or SCSS source for the tree.
|
9
|
-
def self.visit(root, options, format)
|
10
|
-
new(options, format).send(:visit, root)
|
11
|
-
end
|
12
|
-
|
13
|
-
protected
|
14
|
-
|
15
|
-
def initialize(options, format)
|
16
|
-
@options = options
|
17
|
-
@format = format
|
18
|
-
@tabs = 0
|
19
|
-
end
|
20
|
-
|
21
|
-
def visit_children(parent)
|
22
|
-
@tabs += 1
|
23
|
-
return @format == :sass ? "\n" : " {}\n" if parent.children.empty?
|
24
|
-
(@format == :sass ? "\n" : " {\n") + super.join.rstrip + (@format == :sass ? "\n" : " }\n")
|
25
|
-
ensure
|
26
|
-
@tabs -= 1
|
27
|
-
end
|
28
|
-
|
29
|
-
# Ensures proper spacing between top-level nodes.
|
30
|
-
def visit_root(node)
|
31
|
-
Sass::Util.enum_cons(node.children + [nil], 2).map do |child, nxt|
|
32
|
-
visit(child) +
|
33
|
-
if nxt &&
|
34
|
-
(child.is_a?(Sass::Tree::CommentNode) &&
|
35
|
-
child.line + child.lines + 1 == nxt.line) ||
|
36
|
-
(child.is_a?(Sass::Tree::ImportNode) && nxt.is_a?(Sass::Tree::ImportNode) &&
|
37
|
-
child.line + 1 == nxt.line) ||
|
38
|
-
(child.is_a?(Sass::Tree::VariableNode) && nxt.is_a?(Sass::Tree::VariableNode) &&
|
39
|
-
child.line + 1 == nxt.line)
|
40
|
-
""
|
41
|
-
else
|
42
|
-
"\n"
|
43
|
-
end
|
44
|
-
end.join.rstrip + "\n"
|
45
|
-
end
|
46
|
-
|
47
|
-
def visit_charset(node)
|
48
|
-
"#{tab_str}@charset \"#{node.name}\"#{semi}\n"
|
49
|
-
end
|
50
|
-
|
51
|
-
def visit_comment(node)
|
52
|
-
value = node.value.map do |r|
|
53
|
-
next r if r.is_a?(String)
|
54
|
-
"\#{#{r.to_sass(@options)}}"
|
55
|
-
end.join
|
56
|
-
|
57
|
-
content = if @format == :sass
|
58
|
-
content = value.gsub(/\*\/$/, '').rstrip
|
59
|
-
if content =~ /\A[ \t]/
|
60
|
-
# Re-indent SCSS comments like this:
|
61
|
-
# /* foo
|
62
|
-
# bar
|
63
|
-
# baz */
|
64
|
-
content.gsub!(/^/, ' ')
|
65
|
-
content.sub!(/\A([ \t]*)\/\*/, '/*\1')
|
66
|
-
end
|
67
|
-
|
68
|
-
content =
|
69
|
-
unless content.include?("\n")
|
70
|
-
content
|
71
|
-
else
|
72
|
-
content.gsub!(/\n( \*|\/\/)/, "\n ")
|
73
|
-
spaces = content.scan(/\n( *)/).map {|s| s.first.size}.min
|
74
|
-
sep = node.silent ? "\n//" : "\n *"
|
75
|
-
if spaces >= 2
|
76
|
-
content.gsub(/\n /, sep)
|
77
|
-
else
|
78
|
-
content.gsub(/\n#{' ' * spaces}/, sep)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
content.gsub!(/\A\/\*/, '//') if node.silent
|
83
|
-
content.gsub!(/^/, tab_str)
|
84
|
-
content.rstrip + "\n"
|
85
|
-
else
|
86
|
-
spaces = (' ' * [@tabs - value[/^ */].size, 0].max)
|
87
|
-
content = if node.silent
|
88
|
-
value.gsub(/^[\/ ]\*/, '//').gsub(/ *\*\/$/, '')
|
89
|
-
else
|
90
|
-
value
|
91
|
-
end.gsub(/^/, spaces) + "\n"
|
92
|
-
content
|
93
|
-
end
|
94
|
-
if node.loud
|
95
|
-
if node.silent
|
96
|
-
content.gsub!(%r{^\s*(//!?)}, '//!')
|
97
|
-
else
|
98
|
-
content.sub!(%r{^\s*(/\*)}, '/*!')
|
99
|
-
end
|
100
|
-
end
|
101
|
-
content
|
102
|
-
end
|
103
|
-
|
104
|
-
def visit_debug(node)
|
105
|
-
"#{tab_str}@debug #{node.expr.to_sass(@options)}#{semi}\n"
|
106
|
-
end
|
107
|
-
|
108
|
-
def visit_directive(node)
|
109
|
-
res = "#{tab_str}#{node.value}"
|
110
|
-
return res + "#{semi}\n" unless node.has_children
|
111
|
-
res + yield + "\n"
|
112
|
-
end
|
113
|
-
|
114
|
-
def visit_each(node)
|
115
|
-
"#{tab_str}@each $#{dasherize(node.var)} in #{node.list.to_sass(@options)}#{yield}"
|
116
|
-
end
|
117
|
-
|
118
|
-
def visit_extend(node)
|
119
|
-
"#{tab_str}@extend #{selector_to_src(node.selector).lstrip}#{semi}\n"
|
120
|
-
end
|
121
|
-
|
122
|
-
def visit_for(node)
|
123
|
-
"#{tab_str}@for $#{dasherize(node.var)} from #{node.from.to_sass(@options)} " +
|
124
|
-
"#{node.exclusive ? "to" : "through"} #{node.to.to_sass(@options)}#{yield}"
|
125
|
-
end
|
126
|
-
|
127
|
-
def visit_function(node)
|
128
|
-
args = node.args.map do |v, d|
|
129
|
-
d ? "#{v.to_sass(@options)}: #{d.to_sass(@options)}" : v.to_sass(@options)
|
130
|
-
end.join(", ")
|
131
|
-
|
132
|
-
"#{tab_str}@function #{dasherize(node.name)}(#{args})#{yield}"
|
133
|
-
end
|
134
|
-
|
135
|
-
def visit_if(node)
|
136
|
-
name =
|
137
|
-
if !@is_else; "if"
|
138
|
-
elsif node.expr; "else if"
|
139
|
-
else; "else"
|
140
|
-
end
|
141
|
-
str = "#{tab_str}@#{name}"
|
142
|
-
str << " #{node.expr.to_sass(@options)}" if node.expr
|
143
|
-
str << yield
|
144
|
-
@is_else = true
|
145
|
-
str << visit(node.else) if node.else
|
146
|
-
str
|
147
|
-
ensure
|
148
|
-
@is_else = false
|
149
|
-
end
|
150
|
-
|
151
|
-
def visit_import(node)
|
152
|
-
quote = @format == :scss ? '"' : ''
|
153
|
-
"#{tab_str}@import #{quote}#{node.imported_filename}#{quote}#{semi}\n"
|
154
|
-
end
|
155
|
-
|
156
|
-
def visit_media(node)
|
157
|
-
"#{tab_str}@media #{node.query}#{yield}"
|
158
|
-
end
|
159
|
-
|
160
|
-
def visit_mixindef(node)
|
161
|
-
args =
|
162
|
-
if node.args.empty?
|
163
|
-
""
|
164
|
-
else
|
165
|
-
'(' + node.args.map do |v, d|
|
166
|
-
if d
|
167
|
-
"#{v.to_sass(@options)}: #{d.to_sass(@options)}"
|
168
|
-
else
|
169
|
-
v.to_sass(@options)
|
170
|
-
end
|
171
|
-
end.join(", ") + ')'
|
172
|
-
end
|
173
|
-
|
174
|
-
"#{tab_str}#{@format == :sass ? '=' : '@mixin '}#{dasherize(node.name)}#{args}#{yield}"
|
175
|
-
end
|
176
|
-
|
177
|
-
def visit_mixin(node)
|
178
|
-
unless node.args.empty? && node.keywords.empty?
|
179
|
-
args = node.args.map {|a| a.to_sass(@options)}.join(", ")
|
180
|
-
keywords = node.keywords.map {|k, v| "$#{dasherize(k)}: #{v.to_sass(@options)}"}.join(', ')
|
181
|
-
arglist = "(#{args}#{', ' unless args.empty? || keywords.empty?}#{keywords})"
|
182
|
-
end
|
183
|
-
"#{tab_str}#{@format == :sass ? '+' : '@include '}#{dasherize(node.name)}#{arglist}#{semi}\n"
|
184
|
-
end
|
185
|
-
|
186
|
-
def visit_prop(node)
|
187
|
-
res = tab_str + node.declaration(@options, @format)
|
188
|
-
return res + semi + "\n" if node.children.empty?
|
189
|
-
res + yield.rstrip + semi + "\n"
|
190
|
-
end
|
191
|
-
|
192
|
-
def visit_return(node)
|
193
|
-
"#{tab_str}@return #{node.expr.to_sass(@options)}#{semi}\n"
|
194
|
-
end
|
195
|
-
|
196
|
-
def visit_rule(node)
|
197
|
-
if @format == :sass
|
198
|
-
name = selector_to_sass(node.rule)
|
199
|
-
name = "\\" + name if name[0] == ?:
|
200
|
-
name.gsub(/^/, tab_str) + yield
|
201
|
-
elsif @format == :scss
|
202
|
-
name = selector_to_scss(node.rule)
|
203
|
-
res = name + yield
|
204
|
-
if node.children.last.is_a?(Sass::Tree::CommentNode) && node.children.last.silent
|
205
|
-
res.slice!(-3..-1)
|
206
|
-
res << "\n" << tab_str << "}\n"
|
207
|
-
end
|
208
|
-
res
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
def visit_variable(node)
|
213
|
-
"#{tab_str}$#{dasherize(node.name)}: #{node.expr.to_sass(@options)}#{' !default' if node.guarded}#{semi}\n"
|
214
|
-
end
|
215
|
-
|
216
|
-
def visit_warn(node)
|
217
|
-
"#{tab_str}@warn #{node.expr.to_sass(@options)}#{semi}\n"
|
218
|
-
end
|
219
|
-
|
220
|
-
def visit_while(node)
|
221
|
-
"#{tab_str}@while #{node.expr.to_sass(@options)}#{yield}"
|
222
|
-
end
|
223
|
-
|
224
|
-
private
|
225
|
-
|
226
|
-
def selector_to_src(sel)
|
227
|
-
@format == :sass ? selector_to_sass(sel) : selector_to_scss(sel)
|
228
|
-
end
|
229
|
-
|
230
|
-
def selector_to_sass(sel)
|
231
|
-
sel.map do |r|
|
232
|
-
if r.is_a?(String)
|
233
|
-
r.gsub(/(,[ \t]*)?\n\s*/) {$1 ? $1 + "\n" : " "}
|
234
|
-
else
|
235
|
-
"\#{#{r.to_sass(@options)}}"
|
236
|
-
end
|
237
|
-
end.join
|
238
|
-
end
|
239
|
-
|
240
|
-
def selector_to_scss(sel)
|
241
|
-
sel.map {|r| r.is_a?(String) ? r : "\#{#{r.to_sass(@options)}}"}.
|
242
|
-
join.gsub(/^[ \t]*/, tab_str)
|
243
|
-
end
|
244
|
-
|
245
|
-
def semi
|
246
|
-
@format == :sass ? "" : ";"
|
247
|
-
end
|
248
|
-
|
249
|
-
def tab_str
|
250
|
-
' ' * @tabs
|
251
|
-
end
|
252
|
-
|
253
|
-
def dasherize(s)
|
254
|
-
if @options[:dasherize]
|
255
|
-
s.gsub('_', '-')
|
256
|
-
else
|
257
|
-
s
|
258
|
-
end
|
259
|
-
end
|
260
|
-
end
|