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,224 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'haml/attribute_parser'
|
4
|
+
|
5
|
+
module Haml
|
6
|
+
class AttributeCompiler
|
7
|
+
# @param type [Symbol] :static or :dynamic
|
8
|
+
# @param key [String]
|
9
|
+
# @param value [String] Actual string value for :static type, value's Ruby literal for :dynamic type.
|
10
|
+
AttributeValue = Struct.new(:type, :key, :value) do
|
11
|
+
# @return [String] A Ruby literal of value.
|
12
|
+
def to_literal
|
13
|
+
case type
|
14
|
+
when :static
|
15
|
+
Haml::Util.inspect_obj(value)
|
16
|
+
when :dynamic
|
17
|
+
value
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns a script to render attributes on runtime.
|
23
|
+
#
|
24
|
+
# @param attributes [Hash]
|
25
|
+
# @param object_ref [String,:nil]
|
26
|
+
# @param dynamic_attributes [DynamicAttributes]
|
27
|
+
# @return [String] Attributes rendering code
|
28
|
+
def self.runtime_build(attributes, object_ref, dynamic_attributes)
|
29
|
+
"_hamlout.attributes(#{Haml::Util.inspect_obj(attributes)}, #{object_ref},#{dynamic_attributes.to_literal})"
|
30
|
+
end
|
31
|
+
|
32
|
+
# @param options [Haml::Options]
|
33
|
+
def initialize(options)
|
34
|
+
@is_html = [:html4, :html5].include?(options[:format])
|
35
|
+
@attr_wrapper = options[:attr_wrapper]
|
36
|
+
@escape_attrs = options[:escape_attrs]
|
37
|
+
@hyphenate_data_attrs = options[:hyphenate_data_attrs]
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns Temple expression to render attributes.
|
41
|
+
#
|
42
|
+
# @param attributes [Hash]
|
43
|
+
# @param object_ref [String,:nil]
|
44
|
+
# @param dynamic_attributes [DynamicAttributes]
|
45
|
+
# @return [Array] Temple expression
|
46
|
+
def compile(attributes, object_ref, dynamic_attributes)
|
47
|
+
if object_ref != :nil || !AttributeParser.available?
|
48
|
+
return [:dynamic, AttributeCompiler.runtime_build(attributes, object_ref, dynamic_attributes)]
|
49
|
+
end
|
50
|
+
|
51
|
+
parsed_hashes = [dynamic_attributes.new, dynamic_attributes.old].compact.map do |attribute_hash|
|
52
|
+
unless (hash = AttributeParser.parse(attribute_hash))
|
53
|
+
return [:dynamic, AttributeCompiler.runtime_build(attributes, object_ref, dynamic_attributes)]
|
54
|
+
end
|
55
|
+
hash
|
56
|
+
end
|
57
|
+
attribute_values = build_attribute_values(attributes, parsed_hashes)
|
58
|
+
AttributeBuilder.verify_attribute_names!(attribute_values.map(&:key))
|
59
|
+
|
60
|
+
[:multi, *group_values_for_sort(attribute_values).map { |value_group|
|
61
|
+
compile_attribute_values(value_group)
|
62
|
+
}]
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
# Build array of grouped values whose sort order may go back and forth, which is also sorted with key name.
|
68
|
+
# This method needs to group values with the same start because it can be changed in `Haml::AttributeBuidler#build_data_keys`.
|
69
|
+
# @param values [Array<Haml::AttributeCompiler::AttributeValue>]
|
70
|
+
# @return [Array<Array<Haml::AttributeCompiler::AttributeValue>>]
|
71
|
+
def group_values_for_sort(values)
|
72
|
+
sorted_values = values.sort_by(&:key)
|
73
|
+
[].tap do |value_groups|
|
74
|
+
until sorted_values.empty?
|
75
|
+
key = sorted_values.first.key
|
76
|
+
value_group, sorted_values = sorted_values.partition { |v| v.key.start_with?(key) }
|
77
|
+
value_groups << value_group
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Returns array of AttributeValue instances from static attributes and dynamic_attributes. For each key,
|
83
|
+
# the values' order in returned value is preserved in the same order as Haml::Buffer#attributes's merge order.
|
84
|
+
#
|
85
|
+
# @param attributes [{ String => String }]
|
86
|
+
# @param parsed_hashes [{ String => String }]
|
87
|
+
# @return [Array<AttributeValue>]
|
88
|
+
def build_attribute_values(attributes, parsed_hashes)
|
89
|
+
[].tap do |attribute_values|
|
90
|
+
attributes.each do |key, static_value|
|
91
|
+
attribute_values << AttributeValue.new(:static, key, static_value)
|
92
|
+
end
|
93
|
+
parsed_hashes.each do |parsed_hash|
|
94
|
+
parsed_hash.each do |key, dynamic_value|
|
95
|
+
attribute_values << AttributeValue.new(:dynamic, key, dynamic_value)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Compiles attribute values with the similar key to Temple expression.
|
102
|
+
#
|
103
|
+
# @param values [Array<AttributeValue>] whose `key`s are partially or fully the same from left.
|
104
|
+
# @return [Array] Temple expression
|
105
|
+
def compile_attribute_values(values)
|
106
|
+
if values.map(&:key).uniq.size == 1
|
107
|
+
compile_attribute(values.first.key, values)
|
108
|
+
else
|
109
|
+
runtime_build(values)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# @param values [Array<AttributeValue>]
|
114
|
+
# @return [Array] Temple expression
|
115
|
+
def runtime_build(values)
|
116
|
+
hash_content = values.group_by(&:key).map do |key, values_for_key|
|
117
|
+
"#{frozen_string(key)} => #{merged_value(key, values_for_key)}"
|
118
|
+
end.join(', ')
|
119
|
+
[:dynamic, "_hamlout.attributes({ #{hash_content} }, nil)"]
|
120
|
+
end
|
121
|
+
|
122
|
+
# Renders attribute values statically.
|
123
|
+
#
|
124
|
+
# @param values [Array<AttributeValue>]
|
125
|
+
# @return [Array] Temple expression
|
126
|
+
def static_build(values)
|
127
|
+
hash_content = values.group_by(&:key).map do |key, values_for_key|
|
128
|
+
"#{frozen_string(key)} => #{merged_value(key, values_for_key)}"
|
129
|
+
end.join(', ')
|
130
|
+
|
131
|
+
arguments = [@is_html, @attr_wrapper, @escape_attrs, @hyphenate_data_attrs]
|
132
|
+
code = "::Haml::AttributeBuilder.build_attributes"\
|
133
|
+
"(#{arguments.map { |a| Haml::Util.inspect_obj(a) }.join(', ')}, { #{hash_content} })"
|
134
|
+
[:static, eval(code).to_s]
|
135
|
+
end
|
136
|
+
|
137
|
+
# @param key [String]
|
138
|
+
# @param values [Array<AttributeValue>]
|
139
|
+
# @return [String]
|
140
|
+
def merged_value(key, values)
|
141
|
+
if values.size == 1
|
142
|
+
values.first.to_literal
|
143
|
+
else
|
144
|
+
"::Haml::AttributeBuilder.merge_values(#{frozen_string(key)}, #{values.map(&:to_literal).join(', ')})"
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# @param str [String]
|
149
|
+
# @return [String]
|
150
|
+
def frozen_string(str)
|
151
|
+
"#{Haml::Util.inspect_obj(str)}.freeze"
|
152
|
+
end
|
153
|
+
|
154
|
+
# Compiles attribute values for one key to Temple expression that generates ` key='value'`.
|
155
|
+
#
|
156
|
+
# @param key [String]
|
157
|
+
# @param values [Array<AttributeValue>]
|
158
|
+
# @return [Array] Temple expression
|
159
|
+
def compile_attribute(key, values)
|
160
|
+
if values.all? { |v| Temple::StaticAnalyzer.static?(v.to_literal) }
|
161
|
+
return static_build(values)
|
162
|
+
end
|
163
|
+
|
164
|
+
case key
|
165
|
+
when 'id', 'class'
|
166
|
+
compile_id_or_class_attribute(key, values)
|
167
|
+
else
|
168
|
+
compile_common_attribute(key, values)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# @param id_or_class [String] "id" or "class"
|
173
|
+
# @param values [Array<AttributeValue>]
|
174
|
+
# @return [Array] Temple expression
|
175
|
+
def compile_id_or_class_attribute(id_or_class, values)
|
176
|
+
var = unique_name
|
177
|
+
[:multi,
|
178
|
+
[:code, "#{var} = (#{merged_value(id_or_class, values)})"],
|
179
|
+
[:case, var,
|
180
|
+
['Hash, Array', runtime_build([AttributeValue.new(:dynamic, id_or_class, var)])],
|
181
|
+
['false, nil', [:multi]],
|
182
|
+
[:else, [:multi,
|
183
|
+
[:static, " #{id_or_class}=#{@attr_wrapper}"],
|
184
|
+
[:escape, @escape_attrs, [:dynamic, var]],
|
185
|
+
[:static, @attr_wrapper]],
|
186
|
+
]
|
187
|
+
],
|
188
|
+
]
|
189
|
+
end
|
190
|
+
|
191
|
+
# @param key [String] Not "id" or "class"
|
192
|
+
# @param values [Array<AttributeValue>]
|
193
|
+
# @return [Array] Temple expression
|
194
|
+
def compile_common_attribute(key, values)
|
195
|
+
var = unique_name
|
196
|
+
[:multi,
|
197
|
+
[:code, "#{var} = (#{merged_value(key, values)})"],
|
198
|
+
[:case, var,
|
199
|
+
['Hash', runtime_build([AttributeValue.new(:dynamic, key, var)])],
|
200
|
+
['true', true_value(key)],
|
201
|
+
['false, nil', [:multi]],
|
202
|
+
[:else, [:multi,
|
203
|
+
[:static, " #{key}=#{@attr_wrapper}"],
|
204
|
+
[:escape, @escape_attrs, [:dynamic, var]],
|
205
|
+
[:static, @attr_wrapper]],
|
206
|
+
]
|
207
|
+
],
|
208
|
+
]
|
209
|
+
end
|
210
|
+
|
211
|
+
def true_value(key)
|
212
|
+
if @is_html
|
213
|
+
[:static, " #{key}"]
|
214
|
+
else
|
215
|
+
[:static, " #{key}=#{@attr_wrapper}#{key}#{@attr_wrapper}"]
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def unique_name
|
220
|
+
@unique_name ||= 0
|
221
|
+
"_haml_attribute_compiler#{@unique_name += 1}"
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'ripper'
|
5
|
+
rescue LoadError
|
6
|
+
end
|
7
|
+
require 'temple/static_analyzer'
|
8
|
+
|
9
|
+
module Haml
|
10
|
+
# Haml::AttriubuteParser parses Hash literal to { String (key name) => String (value literal) }.
|
11
|
+
module AttributeParser
|
12
|
+
class UnexpectedTokenError < StandardError; end
|
13
|
+
class UnexpectedKeyError < StandardError; end
|
14
|
+
|
15
|
+
# Indices in Ripper tokens
|
16
|
+
TYPE = 1
|
17
|
+
TEXT = 2
|
18
|
+
|
19
|
+
IGNORED_TYPES = %i[on_sp on_ignored_nl].freeze
|
20
|
+
|
21
|
+
class << self
|
22
|
+
# @return [Boolean] - return true if AttributeParser.parse can be used.
|
23
|
+
def available?
|
24
|
+
defined?(Ripper) && Temple::StaticAnalyzer.available?
|
25
|
+
end
|
26
|
+
|
27
|
+
# @param [String] exp - Old attributes literal or Hash literal generated from new attributes.
|
28
|
+
# @return [Hash<String, String>,nil] - Return parsed attribute Hash whose values are Ruby literals, or return nil if argument is not a single Hash literal.
|
29
|
+
def parse(exp)
|
30
|
+
return nil unless hash_literal?(exp)
|
31
|
+
|
32
|
+
hash = {}
|
33
|
+
each_attribute(exp) do |key, value|
|
34
|
+
hash[key] = value
|
35
|
+
end
|
36
|
+
hash
|
37
|
+
rescue UnexpectedTokenError, UnexpectedKeyError
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
# @param [String] exp - Ruby expression
|
44
|
+
# @return [Boolean] - Return true if exp is a single Hash literal
|
45
|
+
def hash_literal?(exp)
|
46
|
+
return false if Temple::StaticAnalyzer.syntax_error?(exp)
|
47
|
+
sym, body = Ripper.sexp(exp)
|
48
|
+
sym == :program && body.is_a?(Array) && body.size == 1 && body[0] && body[0][0] == :hash
|
49
|
+
end
|
50
|
+
|
51
|
+
# @param [Array] tokens - Ripper tokens. Scanned tokens will be destructively removed from this argument.
|
52
|
+
# @return [String] - attribute name in String
|
53
|
+
def shift_key!(tokens)
|
54
|
+
while !tokens.empty? && IGNORED_TYPES.include?(tokens.first[TYPE])
|
55
|
+
tokens.shift # ignore spaces
|
56
|
+
end
|
57
|
+
|
58
|
+
_, type, first_text = tokens.shift
|
59
|
+
case type
|
60
|
+
when :on_label # `key:`
|
61
|
+
first_text.tr(':', '')
|
62
|
+
when :on_symbeg # `:key =>`, `:'key' =>` or `:"key" =>`
|
63
|
+
key = tokens.shift[TEXT]
|
64
|
+
if first_text != ':' # `:'key'` or `:"key"`
|
65
|
+
expect_string_end!(tokens.shift)
|
66
|
+
end
|
67
|
+
shift_hash_rocket!(tokens)
|
68
|
+
key
|
69
|
+
when :on_tstring_beg # `"key":`, `'key':` or `"key" =>`
|
70
|
+
key = tokens.shift[TEXT]
|
71
|
+
next_token = tokens.shift
|
72
|
+
if next_token[TYPE] != :on_label_end # on_label_end is `":` or `':`, so `"key" =>`
|
73
|
+
expect_string_end!(next_token)
|
74
|
+
shift_hash_rocket!(tokens)
|
75
|
+
end
|
76
|
+
key
|
77
|
+
else
|
78
|
+
raise UnexpectedKeyError.new("unexpected token is given!: #{first_text} (#{type})")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# @param [Array] token - Ripper token
|
83
|
+
def expect_string_end!(token)
|
84
|
+
if token[TYPE] != :on_tstring_end
|
85
|
+
raise UnexpectedTokenError
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# @param [Array] tokens - Ripper tokens
|
90
|
+
def shift_hash_rocket!(tokens)
|
91
|
+
until tokens.empty?
|
92
|
+
_, type, str = tokens.shift
|
93
|
+
break if type == :on_op && str == '=>'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# @param [String] hash_literal
|
98
|
+
# @param [Proc] block - that takes [String, String] as arguments
|
99
|
+
def each_attribute(hash_literal, &block)
|
100
|
+
all_tokens = Ripper.lex(hash_literal.strip)
|
101
|
+
all_tokens = all_tokens[1...-1] || [] # strip tokens for brackets
|
102
|
+
|
103
|
+
each_balanced_tokens(all_tokens) do |tokens|
|
104
|
+
key = shift_key!(tokens)
|
105
|
+
value = tokens.map {|t| t[2] }.join.strip
|
106
|
+
block.call(key, value)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# @param [Array] tokens - Ripper tokens
|
111
|
+
# @param [Proc] block - that takes balanced Ripper tokens as arguments
|
112
|
+
def each_balanced_tokens(tokens, &block)
|
113
|
+
attr_tokens = []
|
114
|
+
open_tokens = Hash.new { |h, k| h[k] = 0 }
|
115
|
+
|
116
|
+
tokens.each do |token|
|
117
|
+
case token[TYPE]
|
118
|
+
when :on_comma
|
119
|
+
if open_tokens.values.all?(&:zero?)
|
120
|
+
block.call(attr_tokens)
|
121
|
+
attr_tokens = []
|
122
|
+
next
|
123
|
+
end
|
124
|
+
when :on_lbracket
|
125
|
+
open_tokens[:array] += 1
|
126
|
+
when :on_rbracket
|
127
|
+
open_tokens[:array] -= 1
|
128
|
+
when :on_lbrace
|
129
|
+
open_tokens[:block] += 1
|
130
|
+
when :on_rbrace
|
131
|
+
open_tokens[:block] -= 1
|
132
|
+
when :on_lparen
|
133
|
+
open_tokens[:paren] += 1
|
134
|
+
when :on_rparen
|
135
|
+
open_tokens[:paren] -= 1
|
136
|
+
when :on_embexpr_beg
|
137
|
+
open_tokens[:embexpr] += 1
|
138
|
+
when :on_embexpr_end
|
139
|
+
open_tokens[:embexpr] -= 1
|
140
|
+
when *IGNORED_TYPES
|
141
|
+
next if attr_tokens.empty?
|
142
|
+
end
|
143
|
+
|
144
|
+
attr_tokens << token
|
145
|
+
end
|
146
|
+
block.call(attr_tokens) unless attr_tokens.empty?
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Haml
|
2
4
|
# This class is used only internally. It holds the buffer of HTML that
|
3
5
|
# is eventually output as the resulting document.
|
@@ -90,7 +92,8 @@ module Haml
|
|
90
92
|
def initialize(upper = nil, options = {})
|
91
93
|
@active = true
|
92
94
|
@upper = upper
|
93
|
-
@options =
|
95
|
+
@options = Options.buffer_defaults
|
96
|
+
@options = @options.merge(options) unless options.empty?
|
94
97
|
@buffer = new_encoded_string
|
95
98
|
@tabulation = 0
|
96
99
|
|
@@ -115,8 +118,8 @@ module Haml
|
|
115
118
|
text.sub!(tabs, '') if dont_tab_up
|
116
119
|
end
|
117
120
|
|
118
|
-
@buffer << text
|
119
121
|
@real_tabs += tab_change
|
122
|
+
@buffer << text
|
120
123
|
end
|
121
124
|
|
122
125
|
# Modifies the indentation of the document.
|
@@ -127,82 +130,15 @@ module Haml
|
|
127
130
|
@real_tabs += tab_change
|
128
131
|
end
|
129
132
|
|
130
|
-
Haml::Util.def_static_method(self, :format_script, [:result],
|
131
|
-
:preserve_script, :in_tag, :preserve_tag, :escape_html,
|
132
|
-
:nuke_inner_whitespace, :interpolated, :ugly, <<RUBY)
|
133
|
-
<% # Escape HTML here so that the safety of the string is preserved in Rails
|
134
|
-
result_name = escape_html ? "html_escape(result.to_s)" : "result.to_s" %>
|
135
|
-
<% unless ugly %>
|
136
|
-
# If we're interpolated,
|
137
|
-
# then the custom tabulation is handled in #push_text.
|
138
|
-
# The easiest way to avoid it here is to reset @tabulation.
|
139
|
-
<% if interpolated %>
|
140
|
-
old_tabulation = @tabulation
|
141
|
-
@tabulation = 0
|
142
|
-
<% end %>
|
143
|
-
|
144
|
-
<% if !(in_tag && preserve_tag && !nuke_inner_whitespace) %>
|
145
|
-
tabulation = @real_tabs
|
146
|
-
<% end %>
|
147
|
-
result = <%= result_name %>.<% if nuke_inner_whitespace %>strip<% else %>rstrip<% end %>
|
148
|
-
<% else %>
|
149
|
-
result = <%= result_name %><% if nuke_inner_whitespace %>.strip<% end %>
|
150
|
-
<% end %>
|
151
|
-
|
152
|
-
<% if preserve_tag %>
|
153
|
-
result = Haml::Helpers.preserve(result)
|
154
|
-
<% elsif preserve_script %>
|
155
|
-
result = Haml::Helpers.find_and_preserve(result, options[:preserve])
|
156
|
-
<% end %>
|
157
|
-
|
158
|
-
<% if ugly %>
|
159
|
-
fix_textareas!(result) if toplevel? && result.include?('<textarea')
|
160
|
-
return result
|
161
|
-
<% else %>
|
162
|
-
<% if !(in_tag && preserve_tag && !nuke_inner_whitespace) %>
|
163
|
-
has_newline = result.include?("\\n")
|
164
|
-
<% end %>
|
165
|
-
|
166
|
-
<% if in_tag && !nuke_inner_whitespace %>
|
167
|
-
<% unless preserve_tag %> if !has_newline <% end %>
|
168
|
-
@real_tabs -= 1
|
169
|
-
<% if interpolated %> @tabulation = old_tabulation <% end %>
|
170
|
-
return result
|
171
|
-
<% unless preserve_tag %> end <% end %>
|
172
|
-
<% end %>
|
173
|
-
|
174
|
-
<% if !(in_tag && preserve_tag && !nuke_inner_whitespace) %>
|
175
|
-
# Precompiled tabulation may be wrong
|
176
|
-
<% if !interpolated && !in_tag %>
|
177
|
-
result = tabs + result if @tabulation > 0
|
178
|
-
<% end %>
|
179
|
-
|
180
|
-
if has_newline
|
181
|
-
result = result.gsub "\\n", "\\n" + tabs(tabulation)
|
182
|
-
|
183
|
-
# Add tabulation if it wasn't precompiled
|
184
|
-
<% if in_tag && !nuke_inner_whitespace %> result = tabs(tabulation) + result <% end %>
|
185
|
-
end
|
186
|
-
|
187
|
-
fix_textareas!(result) if toplevel? && result.include?('<textarea')
|
188
|
-
|
189
|
-
<% if in_tag && !nuke_inner_whitespace %>
|
190
|
-
result = "\\n\#{result}\\n\#{tabs(tabulation-1)}"
|
191
|
-
@real_tabs -= 1
|
192
|
-
<% end %>
|
193
|
-
<% if interpolated %> @tabulation = old_tabulation <% end %>
|
194
|
-
result
|
195
|
-
<% end %>
|
196
|
-
<% end %>
|
197
|
-
RUBY
|
198
|
-
|
199
133
|
def attributes(class_id, obj_ref, *attributes_hashes)
|
200
134
|
attributes = class_id
|
201
135
|
attributes_hashes.each do |old|
|
202
|
-
|
136
|
+
result = {}
|
137
|
+
old.each { |k, v| result[k.to_s] = v }
|
138
|
+
AttributeBuilder.merge_attributes!(attributes, result)
|
203
139
|
end
|
204
|
-
|
205
|
-
|
140
|
+
AttributeBuilder.merge_attributes!(attributes, parse_object_ref(obj_ref)) if obj_ref
|
141
|
+
AttributeBuilder.build_attributes(
|
206
142
|
html?, @options[:attr_wrapper], @options[:escape_attrs], @options[:hyphenate_data_attrs], attributes)
|
207
143
|
end
|
208
144
|
|
@@ -217,50 +153,6 @@ RUBY
|
|
217
153
|
buffer << buffer.slice!(capture_position..-1).rstrip
|
218
154
|
end
|
219
155
|
|
220
|
-
# Merges two attribute hashes.
|
221
|
-
# This is the same as `to.merge!(from)`,
|
222
|
-
# except that it merges id, class, and data attributes.
|
223
|
-
#
|
224
|
-
# ids are concatenated with `"_"`,
|
225
|
-
# and classes are concatenated with `" "`.
|
226
|
-
# data hashes are simply merged.
|
227
|
-
#
|
228
|
-
# Destructively modifies both `to` and `from`.
|
229
|
-
#
|
230
|
-
# @param to [{String => String}] The attribute hash to merge into
|
231
|
-
# @param from [{String => #to_s}] The attribute hash to merge from
|
232
|
-
# @return [{String => String}] `to`, after being merged
|
233
|
-
def self.merge_attrs(to, from)
|
234
|
-
from['id'] = Compiler.filter_and_join(from['id'], '_') if from['id']
|
235
|
-
if to['id'] && from['id']
|
236
|
-
to['id'] << '_' << from.delete('id').to_s
|
237
|
-
elsif to['id'] || from['id']
|
238
|
-
from['id'] ||= to['id']
|
239
|
-
end
|
240
|
-
|
241
|
-
from['class'] = Compiler.filter_and_join(from['class'], ' ') if from['class']
|
242
|
-
if to['class'] && from['class']
|
243
|
-
# Make sure we don't duplicate class names
|
244
|
-
from['class'] = (from['class'].to_s.split(' ') | to['class'].split(' ')).sort.join(' ')
|
245
|
-
elsif to['class'] || from['class']
|
246
|
-
from['class'] ||= to['class']
|
247
|
-
end
|
248
|
-
|
249
|
-
from_data = from.delete('data') || {}
|
250
|
-
to_data = to.delete('data') || {}
|
251
|
-
|
252
|
-
# forces to_data & from_data into a hash
|
253
|
-
from_data = { nil => from_data } unless from_data.is_a?(Hash)
|
254
|
-
to_data = { nil => to_data } unless to_data.is_a?(Hash)
|
255
|
-
|
256
|
-
merged_data = to_data.merge(from_data)
|
257
|
-
|
258
|
-
to['data'] = merged_data unless merged_data.empty?
|
259
|
-
to.merge!(from)
|
260
|
-
end
|
261
|
-
|
262
|
-
private
|
263
|
-
|
264
156
|
# Works like #{find_and_preserve}, but allows the first newline after a
|
265
157
|
# preserved opening tag to remain unencoded, and then outdents the content.
|
266
158
|
# This change was motivated primarily by the change in Rails 3.2.3 to emit
|
@@ -270,6 +162,8 @@ RUBY
|
|
270
162
|
# @since Haml 4.0.1
|
271
163
|
# @private
|
272
164
|
def fix_textareas!(input)
|
165
|
+
return input unless input.include?('<textarea'.freeze)
|
166
|
+
|
273
167
|
pattern = /<(textarea)([^>]*)>(\n|
)(.*?)<\/textarea>/im
|
274
168
|
input.gsub!(pattern) do |s|
|
275
169
|
match = pattern.match(s)
|
@@ -281,16 +175,13 @@ RUBY
|
|
281
175
|
end
|
282
176
|
"<#{match[1]}#{match[2]}>\n#{content}</#{match[1]}>"
|
283
177
|
end
|
178
|
+
input
|
284
179
|
end
|
285
180
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
else
|
291
|
-
def new_encoded_string
|
292
|
-
"".encode(Encoding.find(options[:encoding]))
|
293
|
-
end
|
181
|
+
private
|
182
|
+
|
183
|
+
def new_encoded_string
|
184
|
+
"".encode(options[:encoding])
|
294
185
|
end
|
295
186
|
|
296
187
|
@@tab_cache = {}
|
@@ -328,18 +219,20 @@ RUBY
|
|
328
219
|
id = "#{ prefix }_#{ id }"
|
329
220
|
end
|
330
221
|
|
331
|
-
{'id' => id, 'class' => class_name}
|
222
|
+
{ 'id'.freeze => id, 'class'.freeze => class_name }
|
332
223
|
end
|
333
224
|
|
334
225
|
# Changes a word from camel case to underscores.
|
335
226
|
# Based on the method of the same name in Rails' Inflector,
|
336
227
|
# but copied here so it'll run properly without Rails.
|
337
228
|
def underscore(camel_cased_word)
|
338
|
-
camel_cased_word.to_s.
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
229
|
+
word = camel_cased_word.to_s.dup
|
230
|
+
word.gsub!(/::/, '_')
|
231
|
+
word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
232
|
+
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
233
|
+
word.tr!('-', '_')
|
234
|
+
word.downcase!
|
235
|
+
word
|
343
236
|
end
|
344
237
|
end
|
345
238
|
end
|