brakeman 4.6.1 → 4.7.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of brakeman might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGES.md +11 -0
- data/bundle/load.rb +7 -7
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/CHANGELOG.md +122 -4
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/FAQ.md +4 -14
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/Gemfile +19 -0
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/MIT-LICENSE +2 -2
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/README.md +80 -42
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/REFERENCE.md +121 -64
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/TODO +24 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/haml.gemspec +44 -0
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml.rb +2 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/attribute_builder.rb +164 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/attribute_compiler.rb +224 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/attribute_parser.rb +150 -0
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/buffer.rb +25 -132
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/compiler.rb +330 -0
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/engine.rb +34 -41
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/error.rb +65 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/escapable.rb +50 -0
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/exec.rb +38 -20
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/filters.rb +22 -27
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/generator.rb +42 -0
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers.rb +129 -90
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers/action_view_extensions.rb +4 -2
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers/action_view_mods.rb +45 -60
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers/action_view_xss_mods.rb +2 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/helpers/safe_erubi_template.rb +20 -0
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers/safe_erubis_template.rb +5 -1
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/helpers/xss_mods.rb +19 -12
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/options.rb +63 -69
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/parser.rb +292 -228
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/plugin.rb +37 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/railtie.rb +48 -0
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/sass_rails_filter.rb +18 -4
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/template.rb +13 -6
- data/bundle/ruby/2.6.0/gems/{haml-4.0.7 → haml-5.1.2}/lib/haml/template/options.rb +13 -2
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/temple_engine.rb +123 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/temple_line_counter.rb +30 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/util.rb +258 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/lib/haml/version.rb +5 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/yard/default/fulldoc/html/css/common.sass +15 -0
- data/bundle/ruby/2.6.0/gems/haml-5.1.2/yard/default/layout/html/footer.erb +12 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/AUTHORS +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/COPYING +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/Changelog.md +3 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/Gemfile +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/LICENSE +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/README.md +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/TODO +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/appveyor.yml +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/highline.gemspec +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/builtin_styles.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/color_scheme.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/compatibility.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/custom_errors.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/import.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/io_console_compatible.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/list.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/list_renderer.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/menu.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/menu/item.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/paginator.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/question.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/question/answer_converter.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/question_asker.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/simulate.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/statement.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/string.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/string_extensions.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/style.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/template_renderer.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/terminal.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/terminal/io_console.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/terminal/ncurses.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/terminal/unix_stty.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/version.rb +1 -1
- data/bundle/ruby/2.6.0/gems/{highline-2.0.2 → highline-2.0.3}/lib/highline/wrapper.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{ruby2ruby-2.4.3 → ruby2ruby-2.4.4}/History.rdoc +6 -0
- data/bundle/ruby/2.6.0/gems/{ruby2ruby-2.4.3 → ruby2ruby-2.4.4}/Manifest.txt +0 -0
- data/bundle/ruby/2.6.0/gems/{ruby2ruby-2.4.3 → ruby2ruby-2.4.4}/README.rdoc +0 -0
- data/bundle/ruby/2.6.0/gems/{ruby2ruby-2.4.3 → ruby2ruby-2.4.4}/lib/ruby2ruby.rb +3 -3
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/History.rdoc +38 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/Manifest.txt +0 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/README.rdoc +3 -3
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/compare/normalize.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/debugging.md +0 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/rp_extensions.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/rp_stringscanner.rb +0 -0
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby20_parser.rb +7045 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1/lib/ruby_parser.yy → ruby_parser-3.14.0/lib/ruby20_parser.y} +390 -397
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby21_parser.rb +7116 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby21_parser.y +399 -254
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby22_parser.rb +7149 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby22_parser.y +400 -255
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby23_parser.rb +7166 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby23_parser.y +400 -255
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby24_parser.rb +7178 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby24_parser.y +404 -257
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby25_parser.rb +7178 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby25_parser.y +404 -257
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby26_parser.rb +7198 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby26_parser.y +410 -261
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby_lexer.rb +424 -432
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby_lexer.rex +0 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby_lexer.rex.rb +1 -1
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby_parser.rb +27 -27
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.14.0/lib/ruby_parser.yy +2732 -0
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/lib/ruby_parser_extras.rb +627 -406
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/tools/munge.rb +1 -1
- data/bundle/ruby/2.6.0/gems/{ruby_parser-3.13.1 → ruby_parser-3.14.0}/tools/ripper.rb +13 -2
- data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/History.rdoc +13 -0
- data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/Manifest.txt +1 -0
- data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/README.rdoc +0 -0
- data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/lib/composite_sexp_processor.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/lib/pt_testcase.rb +0 -0
- data/bundle/ruby/2.6.0/gems/sexp_processor-4.13.0/lib/sexp.rb +381 -0
- data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1/lib/sexp.rb → sexp_processor-4.13.0/lib/sexp_matcher.rb} +25 -385
- data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/lib/sexp_processor.rb +1 -1
- data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/lib/strict_sexp.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{sexp_processor-4.12.1 → sexp_processor-4.13.0}/lib/unique.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/CHANGES +5 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/EXPRESSIONS.md +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/Gemfile +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/LICENSE +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/README.md +1 -1
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/engine.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/erb/engine.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/erb/parser.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/erb/template.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/erb/trimming.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/exceptions.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filter.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/code_merger.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/control_flow.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/dynamic_inliner.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/encoding.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/eraser.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/escapable.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/multi_flattener.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/remove_bom.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/static_analyzer.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/static_merger.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/string_splitter.rb +1 -1
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/filters/validator.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generator.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generators/array.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generators/array_buffer.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generators/erb.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generators/rails_output_buffer.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/generators/string_buffer.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/grammar.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/attribute_merger.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/attribute_remover.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/attribute_sorter.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/dispatcher.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/fast.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/filter.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/pretty.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/html/safe.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/map.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/mixins/dispatcher.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/mixins/engine_dsl.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/mixins/grammar_dsl.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/mixins/options.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/mixins/template.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/parser.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/static_analyzer.rb +1 -1
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/templates.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/templates/rails.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/templates/tilt.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/lib/temple/utils.rb +0 -0
- data/bundle/ruby/2.6.0/gems/temple-0.8.2/lib/temple/version.rb +3 -0
- data/bundle/ruby/2.6.0/gems/{temple-0.8.1 → temple-0.8.2}/temple.gemspec +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/COPYING +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt.rb +1 -1
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/asciidoc.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/babel.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/bluecloth.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/builder.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/coffee.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/commonmarker.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/creole.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/csv.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/dummy.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/erb.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/erubi.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/erubis.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/etanni.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/haml.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/kramdown.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/less.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/liquid.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/livescript.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/mapping.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/markaby.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/maruku.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/nokogiri.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/pandoc.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/plain.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/prawn.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/radius.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/rdiscount.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/rdoc.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/redcarpet.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/redcloth.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/rst-pandoc.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/sass.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/sigil.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/string.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/template.rb +7 -12
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/typescript.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/wikicloth.rb +0 -0
- data/bundle/ruby/2.6.0/gems/{tilt-2.0.9 → tilt-2.0.10}/lib/tilt/yajl.rb +0 -0
- data/lib/brakeman/checks/base_check.rb +23 -1
- data/lib/brakeman/checks/check_cookie_serialization.rb +1 -1
- data/lib/brakeman/checks/check_cross_site_scripting.rb +1 -1
- data/lib/brakeman/checks/check_execute.rb +26 -1
- data/lib/brakeman/differ.rb +16 -28
- data/lib/brakeman/parsers/haml_embedded.rb +1 -1
- data/lib/brakeman/parsers/template_parser.rb +3 -1
- data/lib/brakeman/processors/alias_processor.rb +10 -0
- data/lib/brakeman/processors/base_processor.rb +2 -0
- data/lib/brakeman/processors/haml_template_processor.rb +86 -122
- data/lib/brakeman/processors/lib/rails2_config_processor.rb +1 -1
- data/lib/brakeman/processors/template_alias_processor.rb +28 -0
- data/lib/brakeman/tracker/config.rb +33 -92
- data/lib/brakeman/version.rb +1 -1
- metadata +215 -206
- data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/compiler.rb +0 -540
- data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/error.rb +0 -61
- data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/railtie.rb +0 -22
- data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/template/plugin.rb +0 -41
- data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/util.rb +0 -377
- data/bundle/ruby/2.6.0/gems/haml-4.0.7/lib/haml/version.rb +0 -3
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby20_parser.rb +0 -6869
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby20_parser.y +0 -2431
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby21_parser.rb +0 -6944
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby22_parser.rb +0 -6968
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby23_parser.rb +0 -6987
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby24_parser.rb +0 -6994
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby25_parser.rb +0 -6994
- data/bundle/ruby/2.6.0/gems/ruby_parser-3.13.1/lib/ruby26_parser.rb +0 -7012
- data/bundle/ruby/2.6.0/gems/temple-0.8.1/lib/temple/version.rb +0 -3
- data/bundle/ruby/2.6.0/gems/tilt-2.0.9/CHANGELOG.md +0 -132
- data/bundle/ruby/2.6.0/gems/tilt-2.0.9/Gemfile +0 -70
- data/bundle/ruby/2.6.0/gems/tilt-2.0.9/HACKING +0 -16
- data/bundle/ruby/2.6.0/gems/tilt-2.0.9/README.md +0 -233
- data/bundle/ruby/2.6.0/gems/tilt-2.0.9/tilt.gemspec +0 -130
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'strscan'
|
2
4
|
|
3
5
|
module Haml
|
@@ -59,7 +61,7 @@ module Haml
|
|
59
61
|
SILENT_SCRIPT,
|
60
62
|
ESCAPE,
|
61
63
|
FILTER
|
62
|
-
]
|
64
|
+
].freeze
|
63
65
|
|
64
66
|
# The value of the character that designates that a line is part
|
65
67
|
# of a multiline string.
|
@@ -71,26 +73,25 @@ module Haml
|
|
71
73
|
# foo.each do | bar |
|
72
74
|
# = bar
|
73
75
|
#
|
74
|
-
BLOCK_WITH_SPACES = /do
|
76
|
+
BLOCK_WITH_SPACES = /do\s*\|\s*[^\|]*\s+\|\z/
|
75
77
|
|
76
|
-
MID_BLOCK_KEYWORDS = %w[else elsif rescue ensure end when]
|
77
|
-
START_BLOCK_KEYWORDS = %w[if begin case unless]
|
78
|
+
MID_BLOCK_KEYWORDS = %w[else elsif rescue ensure end when].freeze
|
79
|
+
START_BLOCK_KEYWORDS = %w[if begin case unless].freeze
|
78
80
|
# Try to parse assignments to block starters as best as possible
|
79
81
|
START_BLOCK_KEYWORD_REGEX = /(?:\w+(?:,\s*\w+)*\s*=\s*)?(#{START_BLOCK_KEYWORDS.join('|')})/
|
80
82
|
BLOCK_KEYWORD_REGEX = /^-?\s*(?:(#{MID_BLOCK_KEYWORDS.join('|')})|#{START_BLOCK_KEYWORD_REGEX.source})\b/
|
81
83
|
|
82
84
|
# The Regex that matches a Doctype command.
|
83
|
-
DOCTYPE_REGEX = /(\d(?:\.\d)?)
|
85
|
+
DOCTYPE_REGEX = /(\d(?:\.\d)?)?\s*([a-z]*)\s*([^ ]+)?/i
|
84
86
|
|
85
87
|
# The Regex that matches a literal string or symbol value
|
86
88
|
LITERAL_VALUE_REGEX = /:(\w*)|(["'])((?!\\|\#\{|\#@|\#\$|\2).|\\.)*\2/
|
87
89
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
@
|
93
|
-
@index = 0
|
90
|
+
ID_KEY = 'id'.freeze
|
91
|
+
CLASS_KEY = 'class'.freeze
|
92
|
+
|
93
|
+
def initialize(options)
|
94
|
+
@options = Options.wrap(options)
|
94
95
|
# Record the indent levels of "if" statements to validate the subsequent
|
95
96
|
# elsif and else statements are indented at the appropriate level.
|
96
97
|
@script_level_stack = []
|
@@ -98,15 +99,27 @@ module Haml
|
|
98
99
|
@template_tabs = 0
|
99
100
|
end
|
100
101
|
|
101
|
-
def
|
102
|
+
def call(template)
|
103
|
+
match = template.rstrip.scan(/(([ \t]+)?(.*?))(?:\Z|\r\n|\r|\n)/m)
|
104
|
+
# discard the last match which is always blank
|
105
|
+
match.pop
|
106
|
+
@template = match.each_with_index.map do |(full, whitespace, text), index|
|
107
|
+
Line.new(whitespace, text.rstrip, full, index, self, false)
|
108
|
+
end
|
109
|
+
# Append special end-of-document marker
|
110
|
+
@template << Line.new(nil, '-#', '-#', @template.size, self, true)
|
111
|
+
|
102
112
|
@root = @parent = ParseNode.new(:root)
|
103
|
-
@
|
113
|
+
@flat = false
|
114
|
+
@filter_buffer = nil
|
104
115
|
@indentation = nil
|
105
116
|
@line = next_line
|
106
117
|
|
107
118
|
raise SyntaxError.new(Error.message(:indenting_at_start), @line.index) if @line.tabs != 0
|
108
119
|
|
109
|
-
|
120
|
+
loop do
|
121
|
+
next_line
|
122
|
+
|
110
123
|
process_indent(@line) unless @line.text.empty?
|
111
124
|
|
112
125
|
if flat?
|
@@ -118,75 +131,103 @@ module Haml
|
|
118
131
|
end
|
119
132
|
|
120
133
|
@tab_up = nil
|
121
|
-
process_line(@line
|
122
|
-
if
|
134
|
+
process_line(@line) unless @line.text.empty?
|
135
|
+
if block_opened? || @tab_up
|
123
136
|
@template_tabs += 1
|
124
137
|
@parent = @parent.children.last
|
125
138
|
end
|
126
139
|
|
127
|
-
if
|
140
|
+
if !flat? && @next_line.tabs - @line.tabs > 1
|
128
141
|
raise SyntaxError.new(Error.message(:deeper_indenting, @next_line.tabs - @line.tabs), @next_line.index)
|
129
142
|
end
|
130
143
|
|
131
144
|
@line = @next_line
|
132
145
|
end
|
133
|
-
|
134
146
|
# Close all the open tags
|
135
147
|
close until @parent.type == :root
|
136
148
|
@root
|
137
149
|
rescue Haml::Error => e
|
138
|
-
e.backtrace.unshift "#{@options
|
150
|
+
e.backtrace.unshift "#{@options.filename}:#{(e.line ? e.line + 1 : @line.index + 1) + @options.line - 1}"
|
139
151
|
raise
|
140
152
|
end
|
141
153
|
|
154
|
+
def compute_tabs(line)
|
155
|
+
return 0 if line.text.empty? || !line.whitespace
|
156
|
+
|
157
|
+
if @indentation.nil?
|
158
|
+
@indentation = line.whitespace
|
159
|
+
|
160
|
+
if @indentation.include?(?\s) && @indentation.include?(?\t)
|
161
|
+
raise SyntaxError.new(Error.message(:cant_use_tabs_and_spaces), line.index)
|
162
|
+
end
|
163
|
+
|
164
|
+
@flat_spaces = @indentation * (@template_tabs+1) if flat?
|
165
|
+
return 1
|
166
|
+
end
|
167
|
+
|
168
|
+
tabs = line.whitespace.length / @indentation.length
|
169
|
+
return tabs if line.whitespace == @indentation * tabs
|
170
|
+
return @template_tabs + 1 if flat? && line.whitespace =~ /^#{@flat_spaces}/
|
171
|
+
|
172
|
+
message = Error.message(:inconsistent_indentation,
|
173
|
+
human_indentation(line.whitespace),
|
174
|
+
human_indentation(@indentation)
|
175
|
+
)
|
176
|
+
raise SyntaxError.new(message, line.index)
|
177
|
+
end
|
142
178
|
|
143
179
|
private
|
144
180
|
|
145
181
|
# @private
|
146
|
-
|
182
|
+
Line = Struct.new(:whitespace, :text, :full, :index, :parser, :eod) do
|
147
183
|
alias_method :eod?, :eod
|
148
184
|
|
149
185
|
# @private
|
150
186
|
def tabs
|
151
|
-
|
152
|
-
|
153
|
-
break 0 if line.text.empty? || !(whitespace = line.full[/^\s+/])
|
154
|
-
|
155
|
-
if @indentation.nil?
|
156
|
-
@indentation = whitespace
|
157
|
-
|
158
|
-
if @indentation.include?(?\s) && @indentation.include?(?\t)
|
159
|
-
raise SyntaxError.new(Error.message(:cant_use_tabs_and_spaces), line.index)
|
160
|
-
end
|
161
|
-
|
162
|
-
@flat_spaces = @indentation * (@template_tabs+1) if flat?
|
163
|
-
break 1
|
164
|
-
end
|
165
|
-
|
166
|
-
tabs = whitespace.length / @indentation.length
|
167
|
-
break tabs if whitespace == @indentation * tabs
|
168
|
-
break @template_tabs + 1 if flat? && whitespace =~ /^#{@flat_spaces}/
|
187
|
+
@tabs ||= parser.compute_tabs(self)
|
188
|
+
end
|
169
189
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
raise SyntaxError.new(message, line.index)
|
175
|
-
end
|
190
|
+
def strip!(from)
|
191
|
+
self.text = text[from..-1]
|
192
|
+
self.text.lstrip!
|
193
|
+
self
|
176
194
|
end
|
177
195
|
end
|
178
196
|
|
179
197
|
# @private
|
180
|
-
|
198
|
+
ParseNode = Struct.new(:type, :line, :value, :parent, :children) do
|
181
199
|
def initialize(*args)
|
182
200
|
super
|
183
201
|
self.children ||= []
|
184
202
|
end
|
185
203
|
|
186
204
|
def inspect
|
187
|
-
|
188
|
-
|
189
|
-
|
205
|
+
%Q[(#{type} #{value.inspect}#{children.each_with_object(''.dup) {|c, s| s << "\n#{c.inspect.gsub!(/^/, ' ')}"}})].dup
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
# @param [String] new - Hash literal including dynamic values.
|
210
|
+
# @param [String] old - Hash literal including dynamic values or Ruby literal of multiple Hashes which MUST be interpreted as method's last arguments.
|
211
|
+
DynamicAttributes = Struct.new(:new, :old) do
|
212
|
+
undef :old=
|
213
|
+
def old=(value)
|
214
|
+
unless value =~ /\A{.*}\z/m
|
215
|
+
raise ArgumentError.new('Old attributes must start with "{" and end with "}"')
|
216
|
+
end
|
217
|
+
self[:old] = value
|
218
|
+
end
|
219
|
+
|
220
|
+
# This will be a literal for Haml::Buffer#attributes's last argument, `attributes_hashes`.
|
221
|
+
def to_literal
|
222
|
+
[new, stripped_old].compact.join(', ')
|
223
|
+
end
|
224
|
+
|
225
|
+
private
|
226
|
+
|
227
|
+
# For `%foo{ { foo: 1 }, bar: 2 }`, :old is "{ { foo: 1 }, bar: 2 }" and this method returns " { foo: 1 }, bar: 2 " for last argument.
|
228
|
+
def stripped_old
|
229
|
+
return nil if old.nil?
|
230
|
+
old.sub!(/\A{/, '').sub!(/}\z/m, '')
|
190
231
|
end
|
191
232
|
end
|
192
233
|
|
@@ -195,98 +236,104 @@ module Haml
|
|
195
236
|
return unless line.tabs <= @template_tabs && @template_tabs > 0
|
196
237
|
|
197
238
|
to_close = @template_tabs - line.tabs
|
198
|
-
to_close.times {|i| close unless to_close - 1 - i == 0 &&
|
239
|
+
to_close.times {|i| close unless to_close - 1 - i == 0 && continuation_script?(line.text)}
|
240
|
+
end
|
241
|
+
|
242
|
+
def continuation_script?(text)
|
243
|
+
text[0] == SILENT_SCRIPT && mid_block_keyword?(text)
|
244
|
+
end
|
245
|
+
|
246
|
+
def mid_block_keyword?(text)
|
247
|
+
MID_BLOCK_KEYWORDS.include?(block_keyword(text))
|
199
248
|
end
|
200
249
|
|
201
250
|
# Processes a single line of Haml.
|
202
251
|
#
|
203
252
|
# This method doesn't return anything; it simply processes the line and
|
204
253
|
# adds the appropriate code to `@precompiled`.
|
205
|
-
def process_line(
|
206
|
-
|
207
|
-
|
208
|
-
case text[0]
|
209
|
-
when DIV_CLASS; push div(text)
|
254
|
+
def process_line(line)
|
255
|
+
case line.text[0]
|
256
|
+
when DIV_CLASS; push div(line)
|
210
257
|
when DIV_ID
|
211
|
-
return push plain(
|
212
|
-
push div(
|
213
|
-
when ELEMENT; push tag(
|
214
|
-
when COMMENT; push comment(text[1..-1].
|
258
|
+
return push plain(line) if %w[{ @ $].include?(line.text[1])
|
259
|
+
push div(line)
|
260
|
+
when ELEMENT; push tag(line)
|
261
|
+
when COMMENT; push comment(line.text[1..-1].lstrip)
|
215
262
|
when SANITIZE
|
216
|
-
return push plain(
|
217
|
-
return push script(
|
218
|
-
return push flat_script(
|
219
|
-
return push plain(
|
220
|
-
push plain(
|
263
|
+
return push plain(line.strip!(3), :escape_html) if line.text[1, 2] == '=='
|
264
|
+
return push script(line.strip!(2), :escape_html) if line.text[1] == SCRIPT
|
265
|
+
return push flat_script(line.strip!(2), :escape_html) if line.text[1] == FLAT_SCRIPT
|
266
|
+
return push plain(line.strip!(1), :escape_html) if line.text[1] == ?\s || line.text[1..2] == '#{'
|
267
|
+
push plain(line)
|
221
268
|
when SCRIPT
|
222
|
-
return push plain(
|
223
|
-
|
224
|
-
|
225
|
-
when
|
226
|
-
when
|
269
|
+
return push plain(line.strip!(2)) if line.text[1] == SCRIPT
|
270
|
+
line.text = line.text[1..-1]
|
271
|
+
push script(line)
|
272
|
+
when FLAT_SCRIPT; push flat_script(line.strip!(1))
|
273
|
+
when SILENT_SCRIPT
|
274
|
+
return push haml_comment(line.text[2..-1]) if line.text[1] == SILENT_COMMENT
|
275
|
+
push silent_script(line)
|
276
|
+
when FILTER; push filter(line.text[1..-1].downcase)
|
227
277
|
when DOCTYPE
|
228
|
-
return push doctype(text) if text[0
|
229
|
-
return push plain(
|
230
|
-
return push script(
|
231
|
-
return push flat_script(
|
232
|
-
return push plain(
|
233
|
-
push plain(
|
234
|
-
when ESCAPE
|
235
|
-
|
278
|
+
return push doctype(line.text) if line.text[0, 3] == '!!!'
|
279
|
+
return push plain(line.strip!(3), false) if line.text[1, 2] == '=='
|
280
|
+
return push script(line.strip!(2), false) if line.text[1] == SCRIPT
|
281
|
+
return push flat_script(line.strip!(2), false) if line.text[1] == FLAT_SCRIPT
|
282
|
+
return push plain(line.strip!(1), false) if line.text[1] == ?\s || line.text[1..2] == '#{'
|
283
|
+
push plain(line)
|
284
|
+
when ESCAPE
|
285
|
+
line.text = line.text[1..-1]
|
286
|
+
push plain(line)
|
287
|
+
else; push plain(line)
|
236
288
|
end
|
237
289
|
end
|
238
290
|
|
239
291
|
def block_keyword(text)
|
240
|
-
return unless keyword = text.scan(BLOCK_KEYWORD_REGEX)[0]
|
292
|
+
return unless (keyword = text.scan(BLOCK_KEYWORD_REGEX)[0])
|
241
293
|
keyword[0] || keyword[1]
|
242
294
|
end
|
243
295
|
|
244
|
-
def mid_block_keyword?(text)
|
245
|
-
MID_BLOCK_KEYWORDS.include?(block_keyword(text))
|
246
|
-
end
|
247
|
-
|
248
296
|
def push(node)
|
249
297
|
@parent.children << node
|
250
298
|
node.parent = @parent
|
251
299
|
end
|
252
300
|
|
253
|
-
def plain(
|
301
|
+
def plain(line, escape_html = nil)
|
254
302
|
if block_opened?
|
255
303
|
raise SyntaxError.new(Error.message(:illegal_nesting_plain), @next_line.index)
|
256
304
|
end
|
257
305
|
|
258
|
-
unless contains_interpolation?(text)
|
259
|
-
return ParseNode.new(:plain,
|
306
|
+
unless contains_interpolation?(line.text)
|
307
|
+
return ParseNode.new(:plain, line.index + 1, :text => line.text)
|
260
308
|
end
|
261
309
|
|
262
|
-
escape_html = @options
|
263
|
-
|
310
|
+
escape_html = @options.escape_html if escape_html.nil?
|
311
|
+
line.text = unescape_interpolation(line.text, escape_html)
|
312
|
+
script(line, false)
|
264
313
|
end
|
265
314
|
|
266
|
-
def script(
|
267
|
-
raise SyntaxError.new(Error.message(:no_ruby_code, '=')) if text.empty?
|
268
|
-
|
269
|
-
escape_html = @options
|
315
|
+
def script(line, escape_html = nil, preserve = false)
|
316
|
+
raise SyntaxError.new(Error.message(:no_ruby_code, '=')) if line.text.empty?
|
317
|
+
line = handle_ruby_multiline(line)
|
318
|
+
escape_html = @options.escape_html if escape_html.nil?
|
270
319
|
|
271
|
-
keyword = block_keyword(text)
|
320
|
+
keyword = block_keyword(line.text)
|
272
321
|
check_push_script_stack(keyword)
|
273
322
|
|
274
|
-
ParseNode.new(:script,
|
323
|
+
ParseNode.new(:script, line.index + 1, :text => line.text, :escape_html => escape_html,
|
275
324
|
:preserve => preserve, :keyword => keyword)
|
276
325
|
end
|
277
326
|
|
278
|
-
def flat_script(
|
279
|
-
raise SyntaxError.new(Error.message(:no_ruby_code, '~')) if text.empty?
|
280
|
-
script(
|
327
|
+
def flat_script(line, escape_html = nil)
|
328
|
+
raise SyntaxError.new(Error.message(:no_ruby_code, '~')) if line.text.empty?
|
329
|
+
script(line, escape_html, :preserve)
|
281
330
|
end
|
282
331
|
|
283
|
-
def silent_script(
|
284
|
-
|
285
|
-
|
286
|
-
raise SyntaxError.new(Error.message(:no_end), @index - 1) if text[1..-1].strip == "end"
|
332
|
+
def silent_script(line)
|
333
|
+
raise SyntaxError.new(Error.message(:no_end), line.index) if line.text[1..-1].strip == 'end'
|
287
334
|
|
288
|
-
|
289
|
-
keyword = block_keyword(text)
|
335
|
+
line = handle_ruby_multiline(line)
|
336
|
+
keyword = block_keyword(line.text)
|
290
337
|
|
291
338
|
check_push_script_stack(keyword)
|
292
339
|
|
@@ -308,8 +355,8 @@ module Haml
|
|
308
355
|
end
|
309
356
|
end
|
310
357
|
|
311
|
-
ParseNode.new(:silent_script, @index,
|
312
|
-
:text => text[1..-1], :keyword => keyword)
|
358
|
+
ParseNode.new(:silent_script, @line.index + 1,
|
359
|
+
:text => line.text[1..-1], :keyword => keyword)
|
313
360
|
end
|
314
361
|
|
315
362
|
def check_push_script_stack(keyword)
|
@@ -323,18 +370,25 @@ module Haml
|
|
323
370
|
end
|
324
371
|
|
325
372
|
def haml_comment(text)
|
326
|
-
|
327
|
-
|
373
|
+
if filter_opened?
|
374
|
+
@flat = true
|
375
|
+
@filter_buffer = String.new
|
376
|
+
@filter_buffer << "#{text}\n" unless text.empty?
|
377
|
+
text = @filter_buffer
|
378
|
+
# If we don't know the indentation by now, it'll be set in Line#tabs
|
379
|
+
@flat_spaces = @indentation * (@template_tabs+1) if @indentation
|
380
|
+
end
|
381
|
+
|
382
|
+
ParseNode.new(:haml_comment, @line.index + 1, :text => text)
|
328
383
|
end
|
329
384
|
|
330
385
|
def tag(line)
|
331
386
|
tag_name, attributes, attributes_hashes, object_ref, nuke_outer_whitespace,
|
332
|
-
nuke_inner_whitespace, action, value, last_line = parse_tag(line)
|
387
|
+
nuke_inner_whitespace, action, value, last_line = parse_tag(line.text)
|
333
388
|
|
334
|
-
preserve_tag = @options
|
389
|
+
preserve_tag = @options.preserve.include?(tag_name)
|
335
390
|
nuke_inner_whitespace ||= preserve_tag
|
336
|
-
|
337
|
-
escape_html = (action == '&' || (action != '!' && @options[:escape_html]))
|
391
|
+
escape_html = (action == '&' || (action != '!' && @options.escape_html))
|
338
392
|
|
339
393
|
case action
|
340
394
|
when '/'; self_closing = true
|
@@ -369,22 +423,20 @@ module Haml
|
|
369
423
|
end
|
370
424
|
|
371
425
|
attributes = Parser.parse_class_and_id(attributes)
|
372
|
-
|
426
|
+
dynamic_attributes = DynamicAttributes.new
|
373
427
|
|
374
428
|
if attributes_hashes[:new]
|
375
429
|
static_attributes, attributes_hash = attributes_hashes[:new]
|
376
|
-
|
377
|
-
|
430
|
+
AttributeBuilder.merge_attributes!(attributes, static_attributes) if static_attributes
|
431
|
+
dynamic_attributes.new = attributes_hash
|
378
432
|
end
|
379
433
|
|
380
434
|
if attributes_hashes[:old]
|
381
435
|
static_attributes = parse_static_hash(attributes_hashes[:old])
|
382
|
-
|
383
|
-
|
436
|
+
AttributeBuilder.merge_attributes!(attributes, static_attributes) if static_attributes
|
437
|
+
dynamic_attributes.old = attributes_hashes[:old] unless static_attributes || @options.suppress_eval
|
384
438
|
end
|
385
439
|
|
386
|
-
attributes_list.compact!
|
387
|
-
|
388
440
|
raise SyntaxError.new(Error.message(:illegal_nesting_self_closing), @next_line.index) if block_opened? && self_closing
|
389
441
|
raise SyntaxError.new(Error.message(:no_ruby_code, action), last_line - 1) if parse && value.empty?
|
390
442
|
raise SyntaxError.new(Error.message(:self_closing_content), last_line - 1) if self_closing && !value.empty?
|
@@ -393,56 +445,70 @@ module Haml
|
|
393
445
|
raise SyntaxError.new(Error.message(:illegal_nesting_line, tag_name), @next_line.index)
|
394
446
|
end
|
395
447
|
|
396
|
-
self_closing ||= !!(!block_opened? && value.empty? && @options
|
448
|
+
self_closing ||= !!(!block_opened? && value.empty? && @options.autoclose.any? {|t| t === tag_name})
|
397
449
|
value = nil if value.empty? && (block_opened? || self_closing)
|
398
|
-
|
450
|
+
line.text = value
|
451
|
+
line = handle_ruby_multiline(line) if parse
|
399
452
|
|
400
|
-
ParseNode.new(:tag,
|
401
|
-
:
|
453
|
+
ParseNode.new(:tag, line.index + 1, :name => tag_name, :attributes => attributes,
|
454
|
+
:dynamic_attributes => dynamic_attributes, :self_closing => self_closing,
|
402
455
|
:nuke_inner_whitespace => nuke_inner_whitespace,
|
403
456
|
:nuke_outer_whitespace => nuke_outer_whitespace, :object_ref => object_ref,
|
404
457
|
:escape_html => escape_html, :preserve_tag => preserve_tag,
|
405
|
-
:preserve_script => preserve_script, :parse => parse, :value =>
|
458
|
+
:preserve_script => preserve_script, :parse => parse, :value => line.text)
|
406
459
|
end
|
407
460
|
|
408
461
|
# Renders a line that creates an XHTML tag and has an implicit div because of
|
409
462
|
# `.` or `#`.
|
410
463
|
def div(line)
|
411
|
-
|
464
|
+
line.text = "%div#{line.text}"
|
465
|
+
tag(line)
|
412
466
|
end
|
413
467
|
|
414
468
|
# Renders an XHTML comment.
|
415
|
-
def comment(
|
416
|
-
|
417
|
-
|
418
|
-
|
469
|
+
def comment(text)
|
470
|
+
if text[0..1] == '!['
|
471
|
+
revealed = true
|
472
|
+
text = text[1..-1]
|
473
|
+
else
|
474
|
+
revealed = false
|
475
|
+
end
|
419
476
|
|
420
|
-
|
477
|
+
conditional, text = balance(text, ?[, ?]) if text[0] == ?[
|
478
|
+
text.strip!
|
479
|
+
|
480
|
+
if contains_interpolation?(text)
|
481
|
+
parse = true
|
482
|
+
text = unescape_interpolation(text)
|
483
|
+
else
|
484
|
+
parse = false
|
485
|
+
end
|
486
|
+
|
487
|
+
if block_opened? && !text.empty?
|
421
488
|
raise SyntaxError.new(Haml::Error.message(:illegal_nesting_content), @next_line.index)
|
422
489
|
end
|
423
490
|
|
424
|
-
ParseNode.new(:comment, @index, :conditional => conditional, :text =>
|
491
|
+
ParseNode.new(:comment, @line.index + 1, :conditional => conditional, :text => text, :revealed => revealed, :parse => parse)
|
425
492
|
end
|
426
493
|
|
427
494
|
# Renders an XHTML doctype or XML shebang.
|
428
|
-
def doctype(
|
495
|
+
def doctype(text)
|
429
496
|
raise SyntaxError.new(Error.message(:illegal_nesting_header), @next_line.index) if block_opened?
|
430
|
-
version, type, encoding =
|
431
|
-
ParseNode.new(:doctype, @index, :version => version, :type => type, :encoding => encoding)
|
497
|
+
version, type, encoding = text[3..-1].strip.downcase.scan(DOCTYPE_REGEX)[0]
|
498
|
+
ParseNode.new(:doctype, @line.index + 1, :version => version, :type => type, :encoding => encoding)
|
432
499
|
end
|
433
500
|
|
434
501
|
def filter(name)
|
435
502
|
raise Error.new(Error.message(:invalid_filter_name, name)) unless name =~ /^\w+$/
|
436
503
|
|
437
|
-
@filter_buffer = String.new
|
438
|
-
|
439
504
|
if filter_opened?
|
440
505
|
@flat = true
|
506
|
+
@filter_buffer = String.new
|
441
507
|
# If we don't know the indentation by now, it'll be set in Line#tabs
|
442
508
|
@flat_spaces = @indentation * (@template_tabs+1) if @indentation
|
443
509
|
end
|
444
510
|
|
445
|
-
ParseNode.new(:filter, @index, :name => name, :text => @filter_buffer)
|
511
|
+
ParseNode.new(:filter, @line.index + 1, :name => name, :text => @filter_buffer)
|
446
512
|
end
|
447
513
|
|
448
514
|
def close
|
@@ -452,13 +518,17 @@ module Haml
|
|
452
518
|
end
|
453
519
|
|
454
520
|
def close_filter(_)
|
455
|
-
|
456
|
-
@flat_spaces = nil
|
457
|
-
@filter_buffer = nil
|
521
|
+
close_flat_section
|
458
522
|
end
|
459
523
|
|
460
524
|
def close_haml_comment(_)
|
461
|
-
|
525
|
+
close_flat_section
|
526
|
+
end
|
527
|
+
|
528
|
+
def close_flat_section
|
529
|
+
@flat = false
|
530
|
+
@flat_spaces = nil
|
531
|
+
@filter_buffer = nil
|
462
532
|
end
|
463
533
|
|
464
534
|
def close_silent_script(node)
|
@@ -466,7 +536,7 @@ module Haml
|
|
466
536
|
|
467
537
|
# Post-process case statements to normalize the nesting of "when" clauses
|
468
538
|
return unless node.value[:keyword] == "case"
|
469
|
-
return unless first = node.children.first
|
539
|
+
return unless (first = node.children.first)
|
470
540
|
return unless first.type == :silent_script && first.value[:keyword] == "when"
|
471
541
|
return if first.children.empty?
|
472
542
|
# If the case node has a "when" child with children, it's the
|
@@ -485,29 +555,39 @@ module Haml
|
|
485
555
|
# that can then be merged with another attributes hash.
|
486
556
|
def self.parse_class_and_id(list)
|
487
557
|
attributes = {}
|
488
|
-
|
558
|
+
return attributes if list.empty?
|
559
|
+
|
560
|
+
list.scan(/([#.])([-:_a-zA-Z0-9\@]+)/) do |type, property|
|
489
561
|
case type
|
490
562
|
when '.'
|
491
|
-
if attributes[
|
492
|
-
attributes[
|
563
|
+
if attributes[CLASS_KEY]
|
564
|
+
attributes[CLASS_KEY] += " "
|
493
565
|
else
|
494
|
-
attributes[
|
566
|
+
attributes[CLASS_KEY] = ""
|
495
567
|
end
|
496
|
-
attributes[
|
497
|
-
when '#'; attributes[
|
568
|
+
attributes[CLASS_KEY] += property
|
569
|
+
when '#'; attributes[ID_KEY] = property
|
498
570
|
end
|
499
571
|
end
|
500
572
|
attributes
|
501
573
|
end
|
502
574
|
|
575
|
+
# This method doesn't use Haml::AttributeParser because currently it depends on Ripper and Rubinius doesn't provide it.
|
576
|
+
# Ideally this logic should be placed in Haml::AttributeParser instead of here and this method should use it.
|
577
|
+
#
|
578
|
+
# @param [String] text - Hash literal or text inside old attributes
|
579
|
+
# @return [Hash,nil] - Return nil if text is not static Hash literal
|
503
580
|
def parse_static_hash(text)
|
504
581
|
attributes = {}
|
582
|
+
return attributes if text.empty?
|
583
|
+
|
584
|
+
text = text[1...-1] # strip brackets
|
505
585
|
scanner = StringScanner.new(text)
|
506
586
|
scanner.scan(/\s+/)
|
507
587
|
until scanner.eos?
|
508
|
-
return unless key = scanner.scan(LITERAL_VALUE_REGEX)
|
588
|
+
return unless (key = scanner.scan(LITERAL_VALUE_REGEX))
|
509
589
|
return unless scanner.scan(/\s*=>\s*/)
|
510
|
-
return unless value = scanner.scan(LITERAL_VALUE_REGEX)
|
590
|
+
return unless (value = scanner.scan(LITERAL_VALUE_REGEX))
|
511
591
|
return unless scanner.scan(/\s*(?:,|$)\s*/)
|
512
592
|
attributes[eval(key).to_s] = eval(value).to_s
|
513
593
|
end
|
@@ -515,20 +595,20 @@ module Haml
|
|
515
595
|
end
|
516
596
|
|
517
597
|
# Parses a line into tag_name, attributes, attributes_hash, object_ref, action, value
|
518
|
-
def parse_tag(
|
519
|
-
match =
|
520
|
-
raise SyntaxError.new(Error.message(:invalid_tag,
|
598
|
+
def parse_tag(text)
|
599
|
+
match = text.scan(/%([-:\w]+)([-:\w.#\@]*)(.+)?/)[0]
|
600
|
+
raise SyntaxError.new(Error.message(:invalid_tag, text)) unless match
|
521
601
|
|
522
602
|
tag_name, attributes, rest = match
|
523
603
|
|
524
|
-
if attributes =~ /[
|
604
|
+
if !attributes.empty? && (attributes =~ /[.#](\.|#|\z)/)
|
525
605
|
raise SyntaxError.new(Error.message(:illegal_element))
|
526
606
|
end
|
527
607
|
|
528
608
|
new_attributes_hash = old_attributes_hash = last_line = nil
|
529
|
-
object_ref =
|
609
|
+
object_ref = :nil
|
530
610
|
attributes_hashes = {}
|
531
|
-
while rest
|
611
|
+
while rest && !rest.empty?
|
532
612
|
case rest[0]
|
533
613
|
when ?{
|
534
614
|
break if old_attributes_hash
|
@@ -539,38 +619,46 @@ module Haml
|
|
539
619
|
new_attributes_hash, rest, last_line = parse_new_attributes(rest)
|
540
620
|
attributes_hashes[:new] = new_attributes_hash
|
541
621
|
when ?[
|
542
|
-
break unless object_ref ==
|
622
|
+
break unless object_ref == :nil
|
543
623
|
object_ref, rest = balance(rest, ?[, ?])
|
544
624
|
else; break
|
545
625
|
end
|
546
626
|
end
|
547
627
|
|
548
|
-
if rest
|
628
|
+
if rest && !rest.empty?
|
549
629
|
nuke_whitespace, action, value = rest.scan(/(<>|><|[><])?([=\/\~&!])?(.*)?/)[0]
|
550
|
-
nuke_whitespace
|
551
|
-
|
552
|
-
|
630
|
+
if nuke_whitespace
|
631
|
+
nuke_outer_whitespace = nuke_whitespace.include? '>'
|
632
|
+
nuke_inner_whitespace = nuke_whitespace.include? '<'
|
633
|
+
end
|
553
634
|
end
|
554
635
|
|
555
|
-
if @options
|
636
|
+
if @options.remove_whitespace
|
556
637
|
nuke_outer_whitespace = true
|
557
638
|
nuke_inner_whitespace = true
|
558
639
|
end
|
559
640
|
|
560
|
-
|
641
|
+
if value.nil?
|
642
|
+
value = ''
|
643
|
+
else
|
644
|
+
value.strip!
|
645
|
+
end
|
561
646
|
[tag_name, attributes, attributes_hashes, object_ref, nuke_outer_whitespace,
|
562
|
-
nuke_inner_whitespace, action, value, last_line || @index]
|
647
|
+
nuke_inner_whitespace, action, value, last_line || @line.index + 1]
|
563
648
|
end
|
564
649
|
|
565
|
-
|
566
|
-
|
567
|
-
|
650
|
+
# @return [String] attributes_hash - Hash literal starting with `{` and ending with `}`
|
651
|
+
# @return [String] rest
|
652
|
+
# @return [Integer] last_line
|
653
|
+
def parse_old_attributes(text)
|
654
|
+
text = text.dup
|
655
|
+
last_line = @line.index + 1
|
568
656
|
|
569
657
|
begin
|
570
|
-
attributes_hash, rest = balance(
|
658
|
+
attributes_hash, rest = balance(text, ?{, ?})
|
571
659
|
rescue SyntaxError => e
|
572
|
-
if
|
573
|
-
|
660
|
+
if text.strip[-1] == ?, && e.message == Error.message(:unbalanced_brackets)
|
661
|
+
text << "\n#{@next_line.text}"
|
574
662
|
last_line += 1
|
575
663
|
next_line
|
576
664
|
retry
|
@@ -579,14 +667,15 @@ module Haml
|
|
579
667
|
raise e
|
580
668
|
end
|
581
669
|
|
582
|
-
attributes_hash = attributes_hash[1...-1] if attributes_hash
|
583
670
|
return attributes_hash, rest, last_line
|
584
671
|
end
|
585
672
|
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
673
|
+
# @return [Array<Hash,String,nil>] - [static_attributes (Hash), dynamic_attributes (nil or String starting with `{` and ending with `}`)]
|
674
|
+
# @return [String] rest
|
675
|
+
# @return [Integer] last_line
|
676
|
+
def parse_new_attributes(text)
|
677
|
+
scanner = StringScanner.new(text)
|
678
|
+
last_line = @line.index + 1
|
590
679
|
attributes = {}
|
591
680
|
|
592
681
|
scanner.scan(/\(\s*/)
|
@@ -595,14 +684,15 @@ module Haml
|
|
595
684
|
break if name.nil?
|
596
685
|
|
597
686
|
if name == false
|
598
|
-
|
687
|
+
scanned = Haml::Util.balance(text, ?(, ?))
|
688
|
+
text = scanned ? scanned.first : text
|
599
689
|
raise Haml::SyntaxError.new(Error.message(:invalid_attribute_list, text.inspect), last_line - 1)
|
600
690
|
end
|
601
691
|
attributes[name] = value
|
602
692
|
scanner.scan(/\s*/)
|
603
693
|
|
604
694
|
if scanner.eos?
|
605
|
-
|
695
|
+
text << " #{@next_line.text}"
|
606
696
|
last_line += 1
|
607
697
|
next_line
|
608
698
|
scanner.scan(/\s*/)
|
@@ -610,12 +700,12 @@ module Haml
|
|
610
700
|
end
|
611
701
|
|
612
702
|
static_attributes = {}
|
613
|
-
dynamic_attributes = "{"
|
703
|
+
dynamic_attributes = "{".dup
|
614
704
|
attributes.each do |name, (type, val)|
|
615
705
|
if type == :static
|
616
706
|
static_attributes[name] = val
|
617
707
|
else
|
618
|
-
dynamic_attributes << inspect_obj(name)
|
708
|
+
dynamic_attributes << "#{inspect_obj(name)} => #{val},"
|
619
709
|
end
|
620
710
|
end
|
621
711
|
dynamic_attributes << "}"
|
@@ -625,7 +715,7 @@ module Haml
|
|
625
715
|
end
|
626
716
|
|
627
717
|
def parse_new_attribute(scanner)
|
628
|
-
unless name = scanner.scan(/[-:\w]+/)
|
718
|
+
unless (name = scanner.scan(/[-:\w]+/))
|
629
719
|
return if scanner.scan(/\)/)
|
630
720
|
return false
|
631
721
|
end
|
@@ -634,8 +724,8 @@ module Haml
|
|
634
724
|
return name, [:static, true] unless scanner.scan(/=/) #/end
|
635
725
|
|
636
726
|
scanner.scan(/\s*/)
|
637
|
-
unless quote = scanner.scan(/["']/)
|
638
|
-
return false unless var = scanner.scan(/(@@?|\$)?\w+/)
|
727
|
+
unless (quote = scanner.scan(/["']/))
|
728
|
+
return false unless (var = scanner.scan(/(@@?|\$)?\w+/))
|
639
729
|
return name, [:dynamic, var]
|
640
730
|
end
|
641
731
|
|
@@ -650,35 +740,16 @@ module Haml
|
|
650
740
|
|
651
741
|
return name, [:static, content.first[1]] if content.size == 1
|
652
742
|
return name, [:dynamic,
|
653
|
-
|
654
|
-
end
|
655
|
-
|
656
|
-
def raw_next_line
|
657
|
-
text = @template.shift
|
658
|
-
return unless text
|
659
|
-
|
660
|
-
index = @template_index
|
661
|
-
@template_index += 1
|
662
|
-
|
663
|
-
return text, index
|
743
|
+
%!"#{content.each_with_object(''.dup) {|(t, v), s| s << (t == :str ? inspect_obj(v)[1...-1] : "\#{#{v}}")}}"!]
|
664
744
|
end
|
665
745
|
|
666
746
|
def next_line
|
667
|
-
|
668
|
-
return unless text
|
669
|
-
|
670
|
-
# :eod is a special end-of-document marker
|
671
|
-
line =
|
672
|
-
if text == :eod
|
673
|
-
Line.new '-#', '-#', '-#', index, self, true
|
674
|
-
else
|
675
|
-
Line.new text.strip, text.lstrip.chomp, text, index, self, false
|
676
|
-
end
|
747
|
+
line = @template.shift || raise(StopIteration)
|
677
748
|
|
678
749
|
# `flat?' here is a little outdated,
|
679
750
|
# so we have to manually check if either the previous or current line
|
680
751
|
# closes the flat block, as well as whether a new block is opened.
|
681
|
-
line_defined = instance_variable_defined?(
|
752
|
+
line_defined = instance_variable_defined?(:@line)
|
682
753
|
@line.tabs if line_defined
|
683
754
|
unless (flat? && !closes_flat?(line) && !closes_flat?(@line)) ||
|
684
755
|
(line_defined && @line.text[0] == ?: && line.full =~ %r[^#{@line.full[/^\s+/]}\s])
|
@@ -694,21 +765,17 @@ module Haml
|
|
694
765
|
line && !line.text.empty? && line.full !~ /^#{@flat_spaces}/
|
695
766
|
end
|
696
767
|
|
697
|
-
def un_next_line(line)
|
698
|
-
@template.unshift line
|
699
|
-
@template_index -= 1
|
700
|
-
end
|
701
|
-
|
702
768
|
def handle_multiline(line)
|
703
769
|
return unless is_multiline?(line.text)
|
704
770
|
line.text.slice!(-1)
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
771
|
+
loop do
|
772
|
+
new_line = @template.first
|
773
|
+
break if new_line.eod?
|
774
|
+
next @template.shift if new_line.text.strip.empty?
|
775
|
+
break unless is_multiline?(new_line.text.strip)
|
776
|
+
line.text << new_line.text.strip[0...-1]
|
777
|
+
@template.shift
|
710
778
|
end
|
711
|
-
un_next_line new_line
|
712
779
|
end
|
713
780
|
|
714
781
|
# Checks whether or not `line` is in a multiline sequence.
|
@@ -716,18 +783,18 @@ module Haml
|
|
716
783
|
text && text.length > 1 && text[-1] == MULTILINE_CHAR_VALUE && text[-2] == ?\s && text !~ BLOCK_WITH_SPACES
|
717
784
|
end
|
718
785
|
|
719
|
-
def handle_ruby_multiline(
|
720
|
-
text
|
721
|
-
return
|
722
|
-
un_next_line @next_line.full
|
786
|
+
def handle_ruby_multiline(line)
|
787
|
+
line.text.rstrip!
|
788
|
+
return line unless is_ruby_multiline?(line.text)
|
723
789
|
begin
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
790
|
+
# Use already fetched @next_line in the first loop. Otherwise, fetch next
|
791
|
+
new_line = new_line.nil? ? @next_line : @template.shift
|
792
|
+
break if new_line.eod?
|
793
|
+
next if new_line.text.empty?
|
794
|
+
line.text << " #{new_line.text.rstrip}"
|
795
|
+
end while is_ruby_multiline?(new_line.text)
|
729
796
|
next_line
|
730
|
-
|
797
|
+
line
|
731
798
|
end
|
732
799
|
|
733
800
|
# `text' is a Ruby multiline block if it:
|
@@ -735,16 +802,13 @@ module Haml
|
|
735
802
|
# - but not "?," which is a character literal
|
736
803
|
# (however, "x?," is a method call and not a literal)
|
737
804
|
# - and not "?\," which is a character literal
|
738
|
-
#
|
739
805
|
def is_ruby_multiline?(text)
|
740
806
|
text && text.length > 1 && text[-1] == ?, &&
|
741
|
-
!((text[-3
|
807
|
+
!((text[-3, 2] =~ /\W\?/) || text[-3, 2] == "?\\")
|
742
808
|
end
|
743
809
|
|
744
810
|
def balance(*args)
|
745
|
-
|
746
|
-
return res if res
|
747
|
-
raise SyntaxError.new(Error.message(:unbalanced_brackets))
|
811
|
+
Haml::Util.balance(*args) or raise(SyntaxError.new(Error.message(:unbalanced_brackets)))
|
748
812
|
end
|
749
813
|
|
750
814
|
def block_opened?
|
@@ -754,7 +818,7 @@ module Haml
|
|
754
818
|
# Same semantics as block_opened?, except that block_opened? uses Line#tabs,
|
755
819
|
# which doesn't interact well with filter lines
|
756
820
|
def filter_opened?
|
757
|
-
@next_line.full =~ (@indentation ? /^#{@indentation * @template_tabs}/ : /^\s/)
|
821
|
+
@next_line.full =~ (@indentation ? /^#{@indentation * (@template_tabs + 1)}/ : /^\s/)
|
758
822
|
end
|
759
823
|
|
760
824
|
def flat?
|