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
@@ -0,0 +1,330 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'haml/attribute_builder'
|
4
|
+
require 'haml/attribute_compiler'
|
5
|
+
require 'haml/temple_line_counter'
|
6
|
+
|
7
|
+
module Haml
|
8
|
+
class Compiler
|
9
|
+
include Haml::Util
|
10
|
+
|
11
|
+
attr_accessor :options
|
12
|
+
|
13
|
+
def initialize(options)
|
14
|
+
@options = Options.wrap(options)
|
15
|
+
@to_merge = []
|
16
|
+
@temple = [:multi]
|
17
|
+
@node = nil
|
18
|
+
@filters = Filters.defined.merge(options[:filters])
|
19
|
+
@attribute_compiler = AttributeCompiler.new(@options)
|
20
|
+
end
|
21
|
+
|
22
|
+
def call(node)
|
23
|
+
compile(node)
|
24
|
+
@temple
|
25
|
+
end
|
26
|
+
|
27
|
+
def compile(node)
|
28
|
+
parent, @node = @node, node
|
29
|
+
if node.children.empty?
|
30
|
+
send(:"compile_#{node.type}")
|
31
|
+
else
|
32
|
+
send(:"compile_#{node.type}") {node.children.each {|c| compile c}}
|
33
|
+
end
|
34
|
+
ensure
|
35
|
+
@node = parent
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def compile_root
|
41
|
+
@output_line = 1
|
42
|
+
yield if block_given?
|
43
|
+
flush_merged_text
|
44
|
+
end
|
45
|
+
|
46
|
+
def compile_plain
|
47
|
+
push_text("#{@node.value[:text]}\n")
|
48
|
+
end
|
49
|
+
|
50
|
+
def nuke_inner_whitespace?(node)
|
51
|
+
if node.value && node.value[:nuke_inner_whitespace]
|
52
|
+
true
|
53
|
+
elsif node.parent
|
54
|
+
nuke_inner_whitespace?(node.parent)
|
55
|
+
else
|
56
|
+
false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def compile_script(&block)
|
61
|
+
push_script(@node.value[:text],
|
62
|
+
:preserve_script => @node.value[:preserve],
|
63
|
+
:escape_html => @node.value[:escape_html],
|
64
|
+
:nuke_inner_whitespace => nuke_inner_whitespace?(@node),
|
65
|
+
&block)
|
66
|
+
end
|
67
|
+
|
68
|
+
def compile_silent_script
|
69
|
+
return if @options.suppress_eval
|
70
|
+
push_silent(@node.value[:text])
|
71
|
+
keyword = @node.value[:keyword]
|
72
|
+
|
73
|
+
if block_given?
|
74
|
+
yield
|
75
|
+
push_silent("end", :can_suppress) unless @node.value[:dont_push_end]
|
76
|
+
elsif keyword == "end"
|
77
|
+
if @node.parent.children.last.equal?(@node)
|
78
|
+
# Since this "end" is ending the block,
|
79
|
+
# we don't need to generate an additional one
|
80
|
+
@node.parent.value[:dont_push_end] = true
|
81
|
+
end
|
82
|
+
# Don't restore dont_* for end because it isn't a conditional branch.
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def compile_haml_comment; end
|
87
|
+
|
88
|
+
def compile_tag
|
89
|
+
t = @node.value
|
90
|
+
|
91
|
+
# Get rid of whitespace outside of the tag if we need to
|
92
|
+
rstrip_buffer! if t[:nuke_outer_whitespace]
|
93
|
+
|
94
|
+
if @options.suppress_eval
|
95
|
+
object_ref = :nil
|
96
|
+
parse = false
|
97
|
+
value = t[:parse] ? nil : t[:value]
|
98
|
+
dynamic_attributes = Haml::Parser::DynamicAttributes.new
|
99
|
+
else
|
100
|
+
object_ref = t[:object_ref]
|
101
|
+
parse = t[:parse]
|
102
|
+
value = t[:value]
|
103
|
+
dynamic_attributes = t[:dynamic_attributes]
|
104
|
+
end
|
105
|
+
|
106
|
+
if @options[:trace]
|
107
|
+
t[:attributes].merge!({"data-trace" => @options.filename.split('/views').last << ":" << @node.line.to_s})
|
108
|
+
end
|
109
|
+
|
110
|
+
push_text("<#{t[:name]}")
|
111
|
+
push_temple(@attribute_compiler.compile(t[:attributes], object_ref, dynamic_attributes))
|
112
|
+
push_text(
|
113
|
+
if t[:self_closing] && @options.xhtml?
|
114
|
+
" />#{"\n" unless t[:nuke_outer_whitespace]}"
|
115
|
+
else
|
116
|
+
">#{"\n" unless (t[:self_closing] && @options.html?) ? t[:nuke_outer_whitespace] : (!block_given? || t[:preserve_tag] || t[:nuke_inner_whitespace])}"
|
117
|
+
end
|
118
|
+
)
|
119
|
+
|
120
|
+
if value && !parse
|
121
|
+
push_text("#{value}</#{t[:name]}>#{"\n" unless t[:nuke_outer_whitespace]}")
|
122
|
+
end
|
123
|
+
|
124
|
+
return if t[:self_closing]
|
125
|
+
|
126
|
+
if value.nil?
|
127
|
+
yield if block_given?
|
128
|
+
rstrip_buffer! if t[:nuke_inner_whitespace]
|
129
|
+
push_text("</#{t[:name]}>#{"\n" unless t[:nuke_outer_whitespace]}")
|
130
|
+
return
|
131
|
+
end
|
132
|
+
|
133
|
+
if parse
|
134
|
+
push_script(value, t.merge(:in_tag => true))
|
135
|
+
push_text("</#{t[:name]}>#{"\n" unless t[:nuke_outer_whitespace]}")
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def compile_comment
|
140
|
+
condition = "#{@node.value[:conditional]}>" if @node.value[:conditional]
|
141
|
+
revealed = @node.value[:revealed]
|
142
|
+
|
143
|
+
open = "<!--#{condition}#{'<!-->' if revealed}"
|
144
|
+
|
145
|
+
close = "#{'<!--' if revealed}#{'<![endif]' if condition}-->"
|
146
|
+
|
147
|
+
unless block_given?
|
148
|
+
push_text("#{open} ")
|
149
|
+
|
150
|
+
if @node.value[:parse]
|
151
|
+
push_script(@node.value[:text], :in_tag => true, :nuke_inner_whitespace => true)
|
152
|
+
else
|
153
|
+
push_text(@node.value[:text])
|
154
|
+
end
|
155
|
+
|
156
|
+
push_text(" #{close}\n")
|
157
|
+
return
|
158
|
+
end
|
159
|
+
|
160
|
+
push_text("#{open}\n")
|
161
|
+
yield if block_given?
|
162
|
+
push_text("#{close}\n")
|
163
|
+
end
|
164
|
+
|
165
|
+
def compile_doctype
|
166
|
+
doctype = text_for_doctype
|
167
|
+
push_text("#{doctype}\n") if doctype
|
168
|
+
end
|
169
|
+
|
170
|
+
def compile_filter
|
171
|
+
unless (filter = @filters[@node.value[:name]])
|
172
|
+
name = @node.value[:name]
|
173
|
+
if ["maruku", "textile"].include?(name)
|
174
|
+
raise Error.new(Error.message(:install_haml_contrib, name), @node.line - 1)
|
175
|
+
else
|
176
|
+
raise Error.new(Error.message(:filter_not_defined, name), @node.line - 1)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
filter.internal_compile(self, @node.value[:text])
|
180
|
+
end
|
181
|
+
|
182
|
+
def text_for_doctype
|
183
|
+
if @node.value[:type] == "xml"
|
184
|
+
return nil if @options.html?
|
185
|
+
wrapper = @options.attr_wrapper
|
186
|
+
return "<?xml version=#{wrapper}1.0#{wrapper} encoding=#{wrapper}#{@node.value[:encoding] || "utf-8"}#{wrapper} ?>"
|
187
|
+
end
|
188
|
+
|
189
|
+
if @options.html5?
|
190
|
+
'<!DOCTYPE html>'
|
191
|
+
elsif @options.xhtml?
|
192
|
+
if @node.value[:version] == "1.1"
|
193
|
+
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
|
194
|
+
elsif @node.value[:version] == "5"
|
195
|
+
'<!DOCTYPE html>'
|
196
|
+
else
|
197
|
+
case @node.value[:type]
|
198
|
+
when "strict"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
|
199
|
+
when "frameset"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
|
200
|
+
when "mobile"; '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
|
201
|
+
when "rdfa"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">'
|
202
|
+
when "basic"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">'
|
203
|
+
else '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
elsif @options.html4?
|
208
|
+
case @node.value[:type]
|
209
|
+
when "strict"; '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
|
210
|
+
when "frameset"; '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
|
211
|
+
else '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Evaluates `text` in the context of the scope object, but
|
217
|
+
# does not output the result.
|
218
|
+
def push_silent(text, can_suppress = false)
|
219
|
+
flush_merged_text
|
220
|
+
return if can_suppress && @options.suppress_eval?
|
221
|
+
newline = (text == "end") ? ";" : "\n"
|
222
|
+
@temple << [:code, "#{resolve_newlines}#{text}#{newline}"]
|
223
|
+
@output_line = @output_line + text.count("\n") + newline.count("\n")
|
224
|
+
end
|
225
|
+
|
226
|
+
# Adds `text` to `@buffer`.
|
227
|
+
def push_text(text)
|
228
|
+
@to_merge << [:text, text]
|
229
|
+
end
|
230
|
+
|
231
|
+
def push_temple(temple)
|
232
|
+
flush_merged_text
|
233
|
+
@temple.concat([[:newline]] * resolve_newlines.count("\n"))
|
234
|
+
@temple << temple
|
235
|
+
@output_line += TempleLineCounter.count_lines(temple)
|
236
|
+
end
|
237
|
+
|
238
|
+
def flush_merged_text
|
239
|
+
return if @to_merge.empty?
|
240
|
+
|
241
|
+
@to_merge.each do |type, val|
|
242
|
+
case type
|
243
|
+
when :text
|
244
|
+
@temple << [:static, val]
|
245
|
+
when :script
|
246
|
+
@temple << [:dynamic, val]
|
247
|
+
else
|
248
|
+
raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Compiler@to_merge.")
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
@to_merge = []
|
253
|
+
end
|
254
|
+
|
255
|
+
# Causes `text` to be evaluated in the context of
|
256
|
+
# the scope object and the result to be added to `@buffer`.
|
257
|
+
#
|
258
|
+
# If `opts[:preserve_script]` is true, Haml::Helpers#find_and_preserve is run on
|
259
|
+
# the result before it is added to `@buffer`
|
260
|
+
def push_script(text, opts = {})
|
261
|
+
return if @options.suppress_eval?
|
262
|
+
|
263
|
+
no_format = !(opts[:preserve_script] || opts[:preserve_tag] || opts[:escape_html])
|
264
|
+
|
265
|
+
unless block_given?
|
266
|
+
push_generated_script(no_format ? "(#{text}\n).to_s" : build_script_formatter("(#{text}\n)", opts))
|
267
|
+
push_text("\n") unless opts[:in_tag] || opts[:nuke_inner_whitespace]
|
268
|
+
return
|
269
|
+
end
|
270
|
+
|
271
|
+
flush_merged_text
|
272
|
+
push_silent "haml_temp = #{text}"
|
273
|
+
yield
|
274
|
+
push_silent('end', :can_suppress) unless @node.value[:dont_push_end]
|
275
|
+
@temple << [:dynamic, no_format ? 'haml_temp.to_s;' : build_script_formatter('haml_temp', opts)]
|
276
|
+
end
|
277
|
+
|
278
|
+
def build_script_formatter(text, opts)
|
279
|
+
text = "(#{text}).to_s"
|
280
|
+
if opts[:escape_html]
|
281
|
+
text = "::Haml::Helpers.html_escape(#{text})"
|
282
|
+
end
|
283
|
+
if opts[:nuke_inner_whitespace]
|
284
|
+
text = "(#{text}).strip"
|
285
|
+
end
|
286
|
+
if opts[:preserve_tag]
|
287
|
+
text = "_hamlout.fix_textareas!(::Haml::Helpers.preserve(#{text}))"
|
288
|
+
elsif opts[:preserve_script]
|
289
|
+
text = "_hamlout.fix_textareas!(::Haml::Helpers.find_and_preserve(#{text}, _hamlout.options[:preserve]))"
|
290
|
+
end
|
291
|
+
"#{text};"
|
292
|
+
end
|
293
|
+
|
294
|
+
def push_generated_script(text)
|
295
|
+
@to_merge << [:script, resolve_newlines + text]
|
296
|
+
@output_line += text.count("\n")
|
297
|
+
end
|
298
|
+
|
299
|
+
def resolve_newlines
|
300
|
+
diff = @node.line - @output_line
|
301
|
+
return "" if diff <= 0
|
302
|
+
@output_line = @node.line
|
303
|
+
"\n" * diff
|
304
|
+
end
|
305
|
+
|
306
|
+
# Get rid of and whitespace at the end of the buffer
|
307
|
+
# or the merged text
|
308
|
+
def rstrip_buffer!(index = -1)
|
309
|
+
last = @to_merge[index]
|
310
|
+
if last.nil?
|
311
|
+
push_silent("_hamlout.rstrip!", false)
|
312
|
+
return
|
313
|
+
end
|
314
|
+
|
315
|
+
case last.first
|
316
|
+
when :text
|
317
|
+
last[1] = last[1].rstrip
|
318
|
+
if last[1].empty?
|
319
|
+
@to_merge.slice! index
|
320
|
+
rstrip_buffer! index
|
321
|
+
end
|
322
|
+
when :script
|
323
|
+
last[1].gsub!(/\(haml_temp, (.*?)\);$/, '(haml_temp.rstrip, \1);')
|
324
|
+
rstrip_buffer! index - 1
|
325
|
+
else
|
326
|
+
raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Compiler@to_merge.")
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'forwardable'
|
2
4
|
|
3
5
|
require 'haml/parser'
|
@@ -7,6 +9,7 @@ require 'haml/helpers'
|
|
7
9
|
require 'haml/buffer'
|
8
10
|
require 'haml/filters'
|
9
11
|
require 'haml/error'
|
12
|
+
require 'haml/temple_engine'
|
10
13
|
|
11
14
|
module Haml
|
12
15
|
# This is the frontend for using Haml programmatically.
|
@@ -35,9 +38,6 @@ module Haml
|
|
35
38
|
# @return [String]
|
36
39
|
attr_accessor :indentation
|
37
40
|
|
38
|
-
attr_accessor :compiler
|
39
|
-
attr_accessor :parser
|
40
|
-
|
41
41
|
# Tilt currently depends on these moved methods, provide a stable API
|
42
42
|
def_delegators :compiler, :precompiled, :precompiled_method_return_value
|
43
43
|
|
@@ -52,25 +52,28 @@ module Haml
|
|
52
52
|
# see {file:REFERENCE.md#options the Haml options documentation}
|
53
53
|
# @raise [Haml::Error] if there's a Haml syntax error in the template
|
54
54
|
def initialize(template, options = {})
|
55
|
+
# Reflect changes of `Haml::Options.defaults` to `Haml::TempleEngine` options, but `#initialize_encoding`
|
56
|
+
# should be run against the arguemnt `options[:encoding]` for backward compatibility with old `Haml::Engine`.
|
57
|
+
options = Options.defaults.dup.tap { |o| o.delete(:encoding) }.merge!(options)
|
55
58
|
@options = Options.new(options)
|
56
59
|
|
57
60
|
@template = check_haml_encoding(template) do |msg, line|
|
58
61
|
raise Haml::Error.new(msg, line)
|
59
62
|
end
|
60
63
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
@compiler = @options.compiler_class.new(@options)
|
64
|
+
@temple_engine = TempleEngine.new(options)
|
65
|
+
@temple_engine.compile(@template)
|
66
|
+
end
|
65
67
|
|
66
|
-
|
68
|
+
# Deprecated API for backword compatibility
|
69
|
+
def compiler
|
70
|
+
@temple_engine
|
67
71
|
end
|
68
72
|
|
69
73
|
# Processes the template and returns the result as a string.
|
70
74
|
#
|
71
75
|
# `scope` is the context in which the template is evaluated.
|
72
|
-
# If it's a `Binding
|
73
|
-
# Haml uses it as the second argument to `Kernel#eval`;
|
76
|
+
# If it's a `Binding`, Haml uses it as the second argument to `Kernel#eval`;
|
74
77
|
# otherwise, Haml just uses its `#instance_eval` context.
|
75
78
|
#
|
76
79
|
# Note that Haml modifies the evaluation context
|
@@ -95,23 +98,23 @@ module Haml
|
|
95
98
|
# within the template.
|
96
99
|
#
|
97
100
|
# Due to some Ruby quirks,
|
98
|
-
# if `scope` is a `Binding`
|
101
|
+
# if `scope` is a `Binding` object and a block is given,
|
99
102
|
# the evaluation context may not be quite what the user expects.
|
100
103
|
# In particular, it's equivalent to passing `eval("self", scope)` as `scope`.
|
101
104
|
# This won't have an effect in most cases,
|
102
105
|
# but if you're relying on local variables defined in the context of `scope`,
|
103
106
|
# they won't work.
|
104
107
|
#
|
105
|
-
# @param scope [Binding,
|
108
|
+
# @param scope [Binding, Object] The context in which the template is evaluated
|
106
109
|
# @param locals [{Symbol => Object}] Local variables that will be made available
|
107
110
|
# to the template
|
108
111
|
# @param block [#to_proc] A block that can be yielded to within the template
|
109
112
|
# @return [String] The rendered template
|
110
113
|
def render(scope = Object.new, locals = {}, &block)
|
111
|
-
parent = scope.instance_variable_defined?(
|
114
|
+
parent = scope.instance_variable_defined?(:@haml_buffer) ? scope.instance_variable_get(:@haml_buffer) : nil
|
112
115
|
buffer = Haml::Buffer.new(parent, @options.for_buffer)
|
113
116
|
|
114
|
-
if scope.is_a?(Binding)
|
117
|
+
if scope.is_a?(Binding)
|
115
118
|
scope_object = eval("self", scope)
|
116
119
|
scope = scope_object.instance_eval{binding} if block_given?
|
117
120
|
else
|
@@ -121,20 +124,16 @@ module Haml
|
|
121
124
|
|
122
125
|
set_locals(locals.merge(:_hamlout => buffer, :_erbout => buffer.buffer), scope, scope_object)
|
123
126
|
|
124
|
-
scope_object.
|
125
|
-
|
126
|
-
@haml_buffer = buffer
|
127
|
-
end
|
127
|
+
scope_object.extend(Haml::Helpers)
|
128
|
+
scope_object.instance_variable_set(:@haml_buffer, buffer)
|
128
129
|
begin
|
129
|
-
eval(@
|
130
|
+
eval(@temple_engine.precompiled_with_return_value, scope, @options.filename, @options.line)
|
130
131
|
rescue ::SyntaxError => e
|
131
132
|
raise SyntaxError, e.message
|
132
133
|
end
|
133
134
|
ensure
|
134
135
|
# Get rid of the current buffer
|
135
|
-
scope_object.
|
136
|
-
@haml_buffer = buffer.upper if buffer
|
137
|
-
end
|
136
|
+
scope_object.instance_variable_set(:@haml_buffer, buffer.upper) if buffer
|
138
137
|
end
|
139
138
|
alias_method :to_html, :render
|
140
139
|
|
@@ -159,11 +158,11 @@ module Haml
|
|
159
158
|
#
|
160
159
|
# The proc doesn't take a block; any yields in the template will fail.
|
161
160
|
#
|
162
|
-
# @param scope [Binding,
|
161
|
+
# @param scope [Binding, Object] The context in which the template is evaluated
|
163
162
|
# @param local_names [Array<Symbol>] The names of the locals that can be passed to the proc
|
164
163
|
# @return [Proc] The proc that will run the template
|
165
164
|
def render_proc(scope = Object.new, *local_names)
|
166
|
-
if scope.is_a?(Binding)
|
165
|
+
if scope.is_a?(Binding)
|
167
166
|
scope_object = eval("self", scope)
|
168
167
|
else
|
169
168
|
scope_object = scope
|
@@ -171,8 +170,13 @@ module Haml
|
|
171
170
|
end
|
172
171
|
|
173
172
|
begin
|
174
|
-
|
175
|
-
|
173
|
+
str = @temple_engine.precompiled_with_ambles(local_names)
|
174
|
+
eval(
|
175
|
+
"Proc.new { |*_haml_locals| _haml_locals = _haml_locals[0] || {}; #{str}}\n",
|
176
|
+
scope,
|
177
|
+
@options.filename,
|
178
|
+
@options.line
|
179
|
+
)
|
176
180
|
rescue ::SyntaxError => e
|
177
181
|
raise SyntaxError, e.message
|
178
182
|
end
|
@@ -182,7 +186,7 @@ module Haml
|
|
182
186
|
# that renders the template and returns the result as a string.
|
183
187
|
#
|
184
188
|
# If `object` is a class or module,
|
185
|
-
# the method will instead
|
189
|
+
# the method will instead be defined as an instance method.
|
186
190
|
# For example:
|
187
191
|
#
|
188
192
|
# t = Time.now
|
@@ -219,25 +223,14 @@ module Haml
|
|
219
223
|
def def_method(object, name, *local_names)
|
220
224
|
method = object.is_a?(Module) ? :module_eval : :instance_eval
|
221
225
|
|
222
|
-
object.send(method, "def #{name}(_haml_locals = {}); #{
|
223
|
-
@options
|
226
|
+
object.send(method, "def #{name}(_haml_locals = {}); #{@temple_engine.precompiled_with_ambles(local_names)}; end",
|
227
|
+
@options.filename, @options.line)
|
224
228
|
end
|
225
229
|
|
226
230
|
private
|
227
231
|
|
228
|
-
if RUBY_VERSION < "1.9"
|
229
|
-
def initialize_encoding(given_value)
|
230
|
-
end
|
231
|
-
else
|
232
|
-
def initialize_encoding(given_value)
|
233
|
-
unless given_value
|
234
|
-
@options.encoding = Encoding.default_internal || @template.encoding
|
235
|
-
end
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
232
|
def set_locals(locals, scope, scope_object)
|
240
|
-
scope_object.
|
233
|
+
scope_object.instance_variable_set :@_haml_locals, locals
|
241
234
|
set_locals = locals.keys.map { |k| "#{k} = @_haml_locals[#{k.inspect}]" }.join("\n")
|
242
235
|
eval(set_locals, scope)
|
243
236
|
end
|