brakeman 7.1.2 → 8.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +48 -0
- data/README.md +1 -1
- data/bundle/load.rb +7 -7
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/NEWS.md +39 -1
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/README.md +1 -1
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/lib/csv/parser.rb +7 -2
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/lib/csv/row.rb +26 -2
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/lib/csv/version.rb +1 -1
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/lib/csv.rb +30 -58
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/CHANGELOG +111 -0
- data/bundle/ruby/3.2.0/gems/{erubis-2.7.0 → erubi-1.13.1}/MIT-LICENSE +1 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/README.rdoc +151 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/lib/erubi/capture_block.rb +91 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/lib/erubi/capture_end.rb +58 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/lib/erubi.rb +299 -0
- data/bundle/ruby/3.2.0/gems/parallel-1.28.0/lib/parallel/version.rb +4 -0
- data/bundle/ruby/3.2.0/gems/{parallel-1.27.0 → parallel-1.28.0}/lib/parallel.rb +11 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/io/ansi.rb +6 -4
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/io/windows.rb +49 -23
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/io.rb +8 -2
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/line_editor.rb +49 -21
- data/bundle/ruby/3.2.0/gems/reline-0.7.0/lib/reline/version.rb +3 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline.rb +10 -9
- data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/CHANGES +8 -2
- data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/Gemfile +5 -2
- data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/LICENSE +1 -1
- data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/README.jp.md +10 -12
- data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/README.md +21 -26
- data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/embedded.rb +1 -1
- data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/logic_less/context.rb +4 -3
- data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/splat/builder.rb +18 -19
- data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/version.rb +1 -1
- data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/CHANGES +8 -0
- data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/README.md +1 -1
- data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/static_analyzer.rb +1 -1
- data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/string_splitter.rb +61 -5
- data/bundle/ruby/3.2.0/gems/temple-0.10.6/lib/temple/parser_engine.rb +34 -0
- data/bundle/ruby/3.2.0/gems/temple-0.10.6/lib/temple/static_analyzer.rb +148 -0
- data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/version.rb +1 -1
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/COPYING +1 -1
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/asciidoc.rb +12 -5
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/babel.rb +5 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/builder.rb +4 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/coffee.rb +14 -4
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/commonmarker.rb +65 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/csv.rb +63 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/erb.rb +130 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/erubi.rb +41 -8
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/etanni.rb +7 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/haml.rb +67 -1
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/kramdown.rb +59 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/liquid.rb +93 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/livescript.rb +11 -4
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/mapping.rb +8 -8
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/markaby.rb +11 -2
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/nokogiri.rb +13 -2
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/pandoc.rb +81 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/pipeline.rb +6 -1
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/plain.rb +5 -1
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/prawn.rb +17 -6
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/radius.rb +96 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/rdiscount.rb +82 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/rdoc.rb +41 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/redcarpet.rb +73 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/redcloth.rb +40 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/rst-pandoc.rb +33 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/sass.rb +16 -3
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/slim.rb +18 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/string.rb +10 -2
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/template.rb +5 -5
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/typescript.rb +5 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.8.0/lib/tilt/yajl.rb +91 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt.rb +1 -2
- data/lib/brakeman/app_tree.rb +7 -2
- data/lib/brakeman/checks/check_eol_rails.rb +2 -1
- data/lib/brakeman/checks/check_eol_ruby.rb +1 -0
- data/lib/brakeman/checks/check_execute.rb +23 -19
- data/lib/brakeman/checks/check_model_attributes.rb +1 -1
- data/lib/brakeman/checks/check_render.rb +1 -27
- data/lib/brakeman/checks/check_render_rce.rb +43 -0
- data/lib/brakeman/checks/check_session_settings.rb +1 -1
- data/lib/brakeman/checks/check_sql.rb +4 -3
- data/lib/brakeman/checks.rb +31 -25
- data/lib/brakeman/commandline.rb +17 -5
- data/lib/brakeman/file_parser.rb +3 -2
- data/lib/brakeman/logger.rb +265 -0
- data/lib/brakeman/options.rb +6 -11
- data/lib/brakeman/parsers/rails_erubi.rb +82 -0
- data/lib/brakeman/parsers/template_parser.rb +7 -15
- data/lib/brakeman/processor.rb +2 -2
- data/lib/brakeman/processors/base_processor.rb +13 -6
- data/lib/brakeman/processors/controller_alias_processor.rb +1 -1
- data/lib/brakeman/processors/controller_processor.rb +3 -3
- data/lib/brakeman/processors/{erubis_template_processor.rb → erubi_template_procesor.rb} +3 -3
- data/lib/brakeman/processors/gem_processor.rb +1 -1
- data/lib/brakeman/processors/haml_template_processor.rb +3 -1
- data/lib/brakeman/processors/lib/rails2_config_processor.rb +4 -3
- data/lib/brakeman/processors/lib/rails2_route_processor.rb +1 -1
- data/lib/brakeman/processors/lib/rails3_config_processor.rb +10 -1
- data/lib/brakeman/processors/lib/render_helper.rb +4 -2
- data/lib/brakeman/processors/lib/render_path.rb +1 -1
- data/lib/brakeman/processors/model_processor.rb +1 -1
- data/lib/brakeman/report/ignore/config.rb +1 -1
- data/lib/brakeman/scanner.rb +33 -51
- data/lib/brakeman/tracker/collection.rb +12 -2
- data/lib/brakeman/tracker/config.rb +17 -13
- data/lib/brakeman/tracker/constants.rb +17 -2
- data/lib/brakeman/tracker/controller.rb +1 -1
- data/lib/brakeman/tracker.rb +7 -15
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman.rb +109 -55
- metadata +182 -210
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/CHANGES.txt +0 -828
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/README.txt +0 -102
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/contrib/erubis +0 -3468
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/contrib/erubis-run.rb +0 -132
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/contrib/inline-require +0 -179
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/context.rb +0 -83
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/converter.rb +0 -357
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ec.rb +0 -117
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ecpp.rb +0 -113
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ejava.rb +0 -110
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ejavascript.rb +0 -119
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/enhanced.rb +0 -126
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/eperl.rb +0 -95
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb +0 -99
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/eruby.rb +0 -125
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/escheme.rb +0 -114
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/optimized.rb +0 -127
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine.rb +0 -120
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/enhancer.rb +0 -723
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/error.rb +0 -23
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/evaluator.rb +0 -88
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/generator.rb +0 -85
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/helper.rb +0 -47
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/helpers/rails_form_helper.rb +0 -197
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/helpers/rails_helper.rb +0 -353
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/local-setting.rb +0 -9
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/main.rb +0 -516
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/preprocessing.rb +0 -58
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/tiny.rb +0 -144
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/util.rb +0 -22
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis.rb +0 -73
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/setup.rb +0 -1331
- data/bundle/ruby/3.2.0/gems/parallel-1.27.0/lib/parallel/version.rb +0 -4
- data/bundle/ruby/3.2.0/gems/reline-0.6.3/lib/reline/version.rb +0 -3
- data/bundle/ruby/3.2.0/gems/temple-0.10.4/lib/temple/static_analyzer.rb +0 -78
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/creole.rb +0 -16
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/csv.rb +0 -53
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/erb.rb +0 -65
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/kramdown.rb +0 -13
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/liquid.rb +0 -37
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/pandoc.rb +0 -39
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/radius.rb +0 -41
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/rdiscount.rb +0 -23
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/rdoc.rb +0 -11
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/redcarpet.rb +0 -31
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/redcloth.rb +0 -13
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/rst-pandoc.rb +0 -10
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/slim.rb +0 -5
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/yajl.rb +0 -81
- data/lib/brakeman/parsers/erubis_patch.rb +0 -11
- data/lib/brakeman/parsers/rails2_erubis.rb +0 -9
- data/lib/brakeman/parsers/rails2_xss_plugin_erubis.rb +0 -52
- data/lib/brakeman/parsers/rails3_erubis.rb +0 -85
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/LICENSE.txt +0 -0
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/lib/csv/core_ext/array.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/lib/csv/core_ext/string.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/lib/csv/fields_converter.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/lib/csv/input_record_separator.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/lib/csv/table.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{csv-3.3.5 → csv-3.3.6}/lib/csv/writer.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{parallel-1.27.0 → parallel-1.28.0}/MIT-LICENSE.txt +0 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/BSDL +0 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/COPYING +0 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/README.md +0 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/config.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/face.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/history.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/io/dumb.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/key_actor/base.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/key_actor/composite.rb +0 -0
- data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/key_actor/emacs.rb +2 -2
- /data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/key_actor/vi_command.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/key_actor/vi_insert.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/key_actor.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/key_stroke.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/kill_ring.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/unicode/east_asian_width.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/lib/reline/unicode.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{reline-0.6.3 → reline-0.7.0}/license_of_rb-readline +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/code_attributes.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/command.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/controls.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/do_inserter.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/end_inserter.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/engine.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/erb_converter.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/filter.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/grammar.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/include.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/interpolation.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/logic_less/filter.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/logic_less.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/parser.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/railtie.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/smart/escaper.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/smart/filter.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/smart/parser.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/smart.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/splat/filter.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/template.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim/translator.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/lib/slim.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{slim-5.2.1 → slim-5.2.2}/slim.gemspec +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/EXPRESSIONS.md +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/Gemfile +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/LICENSE +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/engine.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/erb/engine.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/erb/parser.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/erb/template.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/erb/trimming.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/exceptions.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filter.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/ambles.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/code_merger.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/control_flow.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/dynamic_inliner.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/dynamic_merger.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/encoding.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/eraser.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/escapable.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/multi_flattener.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/remove_bom.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/static_merger.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/validator.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/generator.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/generators/array.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/generators/array_buffer.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/generators/erb.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/generators/rails_output_buffer.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/generators/string_buffer.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/grammar.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/html/attribute_merger.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/html/attribute_remover.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/html/attribute_sorter.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/html/dispatcher.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/html/fast.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/html/filter.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/html/pretty.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/html/safe.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/map.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/mixins/dispatcher.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/mixins/engine_dsl.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/mixins/grammar_dsl.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/mixins/options.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/mixins/template.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/parser.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/templates/rails.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/templates/tilt.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/templates.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/utils.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/temple.gemspec +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/_emacs_org.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/_handlebars.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/_jbuilder.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/_org.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.8.0}/lib/tilt/cli.rb +0 -0
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
begin
|
|
3
|
-
require 'ripper'
|
|
4
|
-
rescue LoadError
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
module Temple
|
|
8
|
-
module StaticAnalyzer
|
|
9
|
-
STATIC_TOKENS = [
|
|
10
|
-
:on_tstring_beg, :on_tstring_end, :on_tstring_content,
|
|
11
|
-
:on_embexpr_beg, :on_embexpr_end,
|
|
12
|
-
:on_lbracket, :on_rbracket,
|
|
13
|
-
:on_qwords_beg, :on_words_sep, :on_qwords_sep,
|
|
14
|
-
:on_lparen, :on_rparen,
|
|
15
|
-
:on_lbrace, :on_rbrace, :on_label,
|
|
16
|
-
:on_int, :on_float, :on_imaginary,
|
|
17
|
-
:on_comma, :on_sp, :on_ignored_nl,
|
|
18
|
-
].freeze
|
|
19
|
-
|
|
20
|
-
DYNAMIC_TOKENS = [
|
|
21
|
-
:on_ident, :on_period,
|
|
22
|
-
].freeze
|
|
23
|
-
|
|
24
|
-
STATIC_KEYWORDS = [
|
|
25
|
-
'true', 'false', 'nil',
|
|
26
|
-
].freeze
|
|
27
|
-
|
|
28
|
-
STATIC_OPERATORS = [
|
|
29
|
-
'=>',
|
|
30
|
-
].freeze
|
|
31
|
-
|
|
32
|
-
class << self
|
|
33
|
-
def available?
|
|
34
|
-
defined?(Ripper) && Ripper.respond_to?(:lex)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def static?(code)
|
|
38
|
-
return false if code.nil? || code.strip.empty?
|
|
39
|
-
return false if syntax_error?(code)
|
|
40
|
-
|
|
41
|
-
Ripper.lex(code).each do |_, token, str|
|
|
42
|
-
case token
|
|
43
|
-
when *STATIC_TOKENS
|
|
44
|
-
# noop
|
|
45
|
-
when :on_kw
|
|
46
|
-
return false unless STATIC_KEYWORDS.include?(str)
|
|
47
|
-
when :on_op
|
|
48
|
-
return false unless STATIC_OPERATORS.include?(str)
|
|
49
|
-
when *DYNAMIC_TOKENS
|
|
50
|
-
return false
|
|
51
|
-
else
|
|
52
|
-
return false
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
true
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def syntax_error?(code)
|
|
59
|
-
SyntaxChecker.new(code).parse
|
|
60
|
-
false
|
|
61
|
-
rescue SyntaxChecker::ParseError
|
|
62
|
-
true
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
if defined?(Ripper)
|
|
67
|
-
class SyntaxChecker < Ripper
|
|
68
|
-
class ParseError < StandardError; end
|
|
69
|
-
|
|
70
|
-
private
|
|
71
|
-
|
|
72
|
-
def on_parse_error(*)
|
|
73
|
-
raise ParseError
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'creole'
|
|
4
|
-
|
|
5
|
-
warn 'tilt/creole is deprecated, as creole requires modifying string literals', uplevel: 1
|
|
6
|
-
|
|
7
|
-
allowed_opts = [:allowed_schemes, :extensions, :no_escape].freeze
|
|
8
|
-
|
|
9
|
-
# Creole implementation. See: http://www.wikicreole.org/
|
|
10
|
-
Tilt::CreoleTemplate = Tilt::StaticTemplate.subclass do
|
|
11
|
-
opts = {}
|
|
12
|
-
allowed_opts.each do |k|
|
|
13
|
-
opts[k] = @options[k] if @options[k]
|
|
14
|
-
end
|
|
15
|
-
Creole::Parser.new(@data, opts).to_html
|
|
16
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'csv'
|
|
4
|
-
|
|
5
|
-
module Tilt
|
|
6
|
-
|
|
7
|
-
# CSV Template implementation. See:
|
|
8
|
-
# http://ruby-doc.org/stdlib/libdoc/csv/rdoc/CSV.html
|
|
9
|
-
#
|
|
10
|
-
# == Example
|
|
11
|
-
#
|
|
12
|
-
# # Example of csv template
|
|
13
|
-
# tpl = <<-EOS
|
|
14
|
-
# # header
|
|
15
|
-
# csv << ['NAME', 'ID']
|
|
16
|
-
#
|
|
17
|
-
# # data rows
|
|
18
|
-
# @people.each do |person|
|
|
19
|
-
# csv << [person[:name], person[:id]]
|
|
20
|
-
# end
|
|
21
|
-
# EOS
|
|
22
|
-
#
|
|
23
|
-
# @people = [
|
|
24
|
-
# {:name => "Joshua Peek", :id => 1},
|
|
25
|
-
# {:name => "Ryan Tomayko", :id => 2},
|
|
26
|
-
# {:name => "Simone Carletti", :id => 3}
|
|
27
|
-
# ]
|
|
28
|
-
#
|
|
29
|
-
# template = Tilt::CSVTemplate.new { tpl }
|
|
30
|
-
# template.render(self)
|
|
31
|
-
#
|
|
32
|
-
class CSVTemplate < Template
|
|
33
|
-
self.default_mime_type = 'text/csv'
|
|
34
|
-
|
|
35
|
-
def prepare
|
|
36
|
-
@outvar = @options.delete(:outvar) || '_csvout'
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def precompiled_template(locals)
|
|
40
|
-
<<-RUBY
|
|
41
|
-
#{@outvar} = CSV.generate(**#{@options}) do |csv|
|
|
42
|
-
#{@data}
|
|
43
|
-
end
|
|
44
|
-
RUBY
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def precompiled(locals)
|
|
48
|
-
source, offset = super
|
|
49
|
-
[source, offset + 1]
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'erb'
|
|
4
|
-
|
|
5
|
-
module Tilt
|
|
6
|
-
# ERB template implementation. See:
|
|
7
|
-
# http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html
|
|
8
|
-
class ERBTemplate < Template
|
|
9
|
-
SUPPORTS_KVARGS = ::ERB.instance_method(:initialize).parameters.assoc(:key) rescue false
|
|
10
|
-
|
|
11
|
-
def prepare
|
|
12
|
-
@freeze_string_literals = !!@options[:freeze]
|
|
13
|
-
@outvar = @options[:outvar] || '_erbout'
|
|
14
|
-
trim = case @options[:trim]
|
|
15
|
-
when false
|
|
16
|
-
nil
|
|
17
|
-
when nil, true
|
|
18
|
-
'<>'
|
|
19
|
-
else
|
|
20
|
-
@options[:trim]
|
|
21
|
-
end
|
|
22
|
-
@engine = if SUPPORTS_KVARGS
|
|
23
|
-
::ERB.new(@data, trim_mode: trim, eoutvar: @outvar)
|
|
24
|
-
# :nocov:
|
|
25
|
-
else
|
|
26
|
-
::ERB.new(@data, options[:safe], trim, @outvar)
|
|
27
|
-
# :nocov:
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def precompiled_template(locals)
|
|
32
|
-
source = @engine.src
|
|
33
|
-
source
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def precompiled_preamble(locals)
|
|
37
|
-
<<-RUBY
|
|
38
|
-
begin
|
|
39
|
-
__original_outvar = #{@outvar} if defined?(#{@outvar})
|
|
40
|
-
#{super}
|
|
41
|
-
RUBY
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def precompiled_postamble(locals)
|
|
45
|
-
<<-RUBY
|
|
46
|
-
#{super}
|
|
47
|
-
ensure
|
|
48
|
-
#{@outvar} = __original_outvar
|
|
49
|
-
end
|
|
50
|
-
RUBY
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# ERB generates a line to specify the character coding of the generated
|
|
54
|
-
# source in 1.9. Account for this in the line offset.
|
|
55
|
-
def precompiled(locals)
|
|
56
|
-
source, offset = super
|
|
57
|
-
[source, offset + 1]
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def freeze_string_literals?
|
|
61
|
-
@freeze_string_literals
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'kramdown'
|
|
4
|
-
|
|
5
|
-
dumb_quotes = [39, 39, 34, 34].freeze
|
|
6
|
-
|
|
7
|
-
# Kramdown Markdown implementation. See: https://kramdown.gettalong.org/
|
|
8
|
-
Tilt::KramdownTemplate = Tilt::StaticTemplate.subclass do
|
|
9
|
-
# dup as Krawmdown modifies the passed option with map!
|
|
10
|
-
@options[:smart_quotes] = dumb_quotes.dup unless @options[:smartypants]
|
|
11
|
-
|
|
12
|
-
Kramdown::Document.new(@data, @options).to_html
|
|
13
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'liquid'
|
|
4
|
-
|
|
5
|
-
module Tilt
|
|
6
|
-
# Liquid template implementation. See:
|
|
7
|
-
# http://liquidmarkup.org/
|
|
8
|
-
#
|
|
9
|
-
# Liquid is designed to be a *safe* template system and therefore
|
|
10
|
-
# does not provide direct access to execuatable scopes. In order to
|
|
11
|
-
# support a +scope+, the +scope+ must be able to represent itself
|
|
12
|
-
# as a hash by responding to #to_h. If the +scope+ does not respond
|
|
13
|
-
# to #to_h it will be ignored.
|
|
14
|
-
#
|
|
15
|
-
# LiquidTemplate does not support yield blocks.
|
|
16
|
-
class LiquidTemplate < Template
|
|
17
|
-
def prepare
|
|
18
|
-
@options[:line_numbers] = true unless @options.has_key?(:line_numbers)
|
|
19
|
-
@engine = ::Liquid::Template.parse(@data, @options)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def evaluate(scope, locs)
|
|
23
|
-
locals = {}
|
|
24
|
-
if scope.respond_to?(:to_h)
|
|
25
|
-
scope.to_h.each{|k, v| locals[k.to_s] = v}
|
|
26
|
-
end
|
|
27
|
-
locs.each{|k, v| locals[k.to_s] = v}
|
|
28
|
-
locals['yield'] = block_given? ? yield : ''
|
|
29
|
-
locals['content'] = locals['yield']
|
|
30
|
-
@engine.render(locals)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def allows_script?
|
|
34
|
-
false
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'pandoc-ruby'
|
|
4
|
-
|
|
5
|
-
# Pandoc markdown implementation. See: http://pandoc.org/
|
|
6
|
-
Tilt::PandocTemplate = Tilt::StaticTemplate.subclass do
|
|
7
|
-
# turn options hash into an array
|
|
8
|
-
# Map tilt options to pandoc options
|
|
9
|
-
# Replace hash keys with value true with symbol for key
|
|
10
|
-
# Remove hash keys with value false
|
|
11
|
-
# Leave other hash keys untouched
|
|
12
|
-
pandoc_options = []
|
|
13
|
-
from = "markdown"
|
|
14
|
-
smart_extension = "-smart"
|
|
15
|
-
@options.each do |k,v|
|
|
16
|
-
case k
|
|
17
|
-
when :smartypants
|
|
18
|
-
smart_extension = "+smart" if v
|
|
19
|
-
when :escape_html
|
|
20
|
-
from = "markdown-raw_html" if v
|
|
21
|
-
when :commonmark
|
|
22
|
-
from = "commonmark" if v
|
|
23
|
-
when :markdown_strict
|
|
24
|
-
from = "markdown_strict" if v
|
|
25
|
-
else
|
|
26
|
-
case v
|
|
27
|
-
when true
|
|
28
|
-
pandoc_options << k
|
|
29
|
-
when false
|
|
30
|
-
# do nothing
|
|
31
|
-
else
|
|
32
|
-
pandoc_options << { k => v }
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
pandoc_options << { :f => from + smart_extension }
|
|
37
|
-
|
|
38
|
-
PandocRuby.new(@data, *pandoc_options).to_html.strip
|
|
39
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'radius'
|
|
4
|
-
|
|
5
|
-
module Tilt
|
|
6
|
-
# Radius Template
|
|
7
|
-
# http://github.com/jlong/radius/
|
|
8
|
-
class RadiusTemplate < Template
|
|
9
|
-
class ContextClass < Radius::Context
|
|
10
|
-
attr_accessor :tilt_scope
|
|
11
|
-
|
|
12
|
-
def tag_missing(name, attributes)
|
|
13
|
-
tilt_scope.__send__(name)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def dup
|
|
17
|
-
i = super
|
|
18
|
-
i.tilt_scope = tilt_scope
|
|
19
|
-
i
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def evaluate(scope, locals, &block)
|
|
24
|
-
context = ContextClass.new
|
|
25
|
-
context.tilt_scope = scope
|
|
26
|
-
context.define_tag("yield", &block) if block
|
|
27
|
-
locals.each do |tag, value|
|
|
28
|
-
context.define_tag(tag) do
|
|
29
|
-
value
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
@options[:tag_prefix] = 'r' unless @options.has_key?(:tag_prefix)
|
|
34
|
-
Radius::Parser.new(context, @options).parse(@data)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def allows_script?
|
|
38
|
-
false
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'rdiscount'
|
|
4
|
-
|
|
5
|
-
aliases = {
|
|
6
|
-
:escape_html => :filter_html,
|
|
7
|
-
:smartypants => :smart
|
|
8
|
-
}.freeze
|
|
9
|
-
|
|
10
|
-
_flags = [:smart, :filter_html, :smartypants, :escape_html].freeze
|
|
11
|
-
|
|
12
|
-
# Discount Markdown implementation. See:
|
|
13
|
-
# http://github.com/rtomayko/rdiscount
|
|
14
|
-
#
|
|
15
|
-
# RDiscount is a simple text filter. It does not support +scope+ or
|
|
16
|
-
# +locals+. The +:smart+ and +:filter_html+ options may be set true
|
|
17
|
-
# to enable those flags on the underlying RDiscount object.
|
|
18
|
-
Tilt::RDiscountTemplate = Tilt::StaticTemplate.subclass do
|
|
19
|
-
flags = _flags.select { |flag| @options[flag] }.
|
|
20
|
-
map! { |flag| aliases[flag] || flag }
|
|
21
|
-
|
|
22
|
-
RDiscount.new(@data, *flags).to_html
|
|
23
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'rdoc'
|
|
4
|
-
require 'rdoc/markup'
|
|
5
|
-
require 'rdoc/markup/to_html'
|
|
6
|
-
require 'rdoc/options'
|
|
7
|
-
|
|
8
|
-
# RDoc template. See: https://github.com/ruby/rdoc
|
|
9
|
-
Tilt::RDocTemplate = Tilt::StaticTemplate.subclass do
|
|
10
|
-
RDoc::Markup::ToHtml.new(RDoc::Options.new, nil).convert(@data).to_s
|
|
11
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'redcarpet'
|
|
4
|
-
|
|
5
|
-
aliases = {:escape_html => :filter_html, :smartypants => :smart}.freeze
|
|
6
|
-
|
|
7
|
-
Tilt::RedcarpetTemplate = Tilt::StaticTemplate.subclass do
|
|
8
|
-
aliases.each do |opt, aka|
|
|
9
|
-
if options.key?(aka) || !@options.key?(opt)
|
|
10
|
-
@options[opt] = @options.delete(aka)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# only raise an exception if someone is trying to enable :escape_html
|
|
15
|
-
@options.delete(:escape_html) unless @options[:escape_html]
|
|
16
|
-
|
|
17
|
-
renderer = @options.delete(:renderer) || ::Redcarpet::Render::HTML.new(@options)
|
|
18
|
-
if options.delete(:smartypants) && !(renderer.is_a?(Class) && renderer <= ::Redcarpet::Render::SmartyPants)
|
|
19
|
-
renderer = if renderer == ::Redcarpet::Render::XHTML
|
|
20
|
-
::Redcarpet::Render::SmartyHTML.new(:xhtml => true)
|
|
21
|
-
elsif renderer == ::Redcarpet::Render::HTML
|
|
22
|
-
::Redcarpet::Render::SmartyHTML
|
|
23
|
-
elsif renderer.is_a? Class
|
|
24
|
-
Class.new(renderer) { include ::Redcarpet::Render::SmartyPants }
|
|
25
|
-
else
|
|
26
|
-
renderer.extend ::Redcarpet::Render::SmartyPants
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
Redcarpet::Markdown.new(renderer, @options).render(@data)
|
|
31
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'redcloth'
|
|
4
|
-
|
|
5
|
-
# RedCloth implementation. See: https://github.com/jgarber/redcloth
|
|
6
|
-
Tilt::RedClothTemplate = Tilt::StaticTemplate.subclass do
|
|
7
|
-
engine = RedCloth.new(@data)
|
|
8
|
-
@options.each do |k, v|
|
|
9
|
-
m = :"#{k}="
|
|
10
|
-
engine.send(m, v) if engine.respond_to? m
|
|
11
|
-
end
|
|
12
|
-
engine.to_html
|
|
13
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require_relative 'pandoc'
|
|
4
|
-
|
|
5
|
-
rst = {:f => "rst"}.freeze
|
|
6
|
-
|
|
7
|
-
# Pandoc reStructuredText implementation. See: # http://pandoc.org/
|
|
8
|
-
Tilt::RstPandocTemplate = Tilt::StaticTemplate.subclass do
|
|
9
|
-
PandocRuby.new(@data, rst).to_html.strip
|
|
10
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'yajl'
|
|
4
|
-
|
|
5
|
-
module Tilt
|
|
6
|
-
# Yajl Template implementation
|
|
7
|
-
#
|
|
8
|
-
# Yajl is a fast JSON parsing and encoding library for Ruby
|
|
9
|
-
# See https://github.com/brianmario/yajl-ruby
|
|
10
|
-
#
|
|
11
|
-
# The template source is evaluated as a Ruby string,
|
|
12
|
-
# and the result is converted #to_json.
|
|
13
|
-
#
|
|
14
|
-
# == Example
|
|
15
|
-
#
|
|
16
|
-
# # This is a template example.
|
|
17
|
-
# # The template can contain any Ruby statement.
|
|
18
|
-
# tpl <<-EOS
|
|
19
|
-
# @counter = 0
|
|
20
|
-
#
|
|
21
|
-
# # The json variable represents the buffer
|
|
22
|
-
# # and holds the data to be serialized into json.
|
|
23
|
-
# # It defaults to an empty hash, but you can override it at any time.
|
|
24
|
-
# json = {
|
|
25
|
-
# :"user#{@counter += 1}" => { :name => "Joshua Peek", :id => @counter },
|
|
26
|
-
# :"user#{@counter += 1}" => { :name => "Ryan Tomayko", :id => @counter },
|
|
27
|
-
# :"user#{@counter += 1}" => { :name => "Simone Carletti", :id => @counter },
|
|
28
|
-
# }
|
|
29
|
-
#
|
|
30
|
-
# # Since the json variable is a Hash,
|
|
31
|
-
# # you can use conditional statements or any other Ruby statement
|
|
32
|
-
# # to populate it.
|
|
33
|
-
# json[:"user#{@counter += 1}"] = { :name => "Unknown" } if 1 == 2
|
|
34
|
-
#
|
|
35
|
-
# # The last line doesn't affect the returned value.
|
|
36
|
-
# nil
|
|
37
|
-
# EOS
|
|
38
|
-
#
|
|
39
|
-
# template = Tilt::YajlTemplate.new { tpl }
|
|
40
|
-
# template.render(self)
|
|
41
|
-
#
|
|
42
|
-
class YajlTemplate < Template
|
|
43
|
-
self.default_mime_type = 'application/json'
|
|
44
|
-
|
|
45
|
-
def evaluate(scope, locals, &block)
|
|
46
|
-
decorate(super)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def precompiled_preamble(locals)
|
|
50
|
-
return super if locals.include? :json
|
|
51
|
-
"json = {}\n#{super}"
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def precompiled_postamble(locals)
|
|
55
|
-
"Yajl::Encoder.new.encode(json)"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def precompiled_template(locals)
|
|
59
|
-
@data.to_str
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# Decorates the +json+ input according to given +options+.
|
|
63
|
-
#
|
|
64
|
-
# json - The json String to decorate.
|
|
65
|
-
# options - The option Hash to customize the behavior.
|
|
66
|
-
#
|
|
67
|
-
# Returns the decorated String.
|
|
68
|
-
def decorate(json)
|
|
69
|
-
callback, variable = @options[:callback], @options[:variable]
|
|
70
|
-
if callback && variable
|
|
71
|
-
"var #{variable} = #{json}; #{callback}(#{variable});"
|
|
72
|
-
elsif variable
|
|
73
|
-
"var #{variable} = #{json};"
|
|
74
|
-
elsif callback
|
|
75
|
-
"#{callback}(#{json});"
|
|
76
|
-
else
|
|
77
|
-
json
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
module Brakeman::ErubisPatch
|
|
2
|
-
# Simple patch to make `erubis` compatible with frozen string literals
|
|
3
|
-
def convert(input)
|
|
4
|
-
codebuf = +"" # Modified line, the rest is identitical
|
|
5
|
-
@preamble.nil? ? add_preamble(codebuf) : (@preamble && (codebuf << @preamble))
|
|
6
|
-
convert_input(codebuf, input)
|
|
7
|
-
@postamble.nil? ? add_postamble(codebuf) : (@postamble && (codebuf << @postamble))
|
|
8
|
-
@_proc = nil # clear cached proc object
|
|
9
|
-
return codebuf # or codebuf.join()
|
|
10
|
-
end
|
|
11
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
Brakeman.load_brakeman_dependency 'erubis'
|
|
2
|
-
|
|
3
|
-
require 'brakeman/parsers/erubis_patch'
|
|
4
|
-
|
|
5
|
-
#Erubis processor which ignores any output which is plain text.
|
|
6
|
-
class Brakeman::ScannerErubis < Erubis::Eruby
|
|
7
|
-
include Erubis::NoTextEnhancer
|
|
8
|
-
include Brakeman::ErubisPatch
|
|
9
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
Brakeman.load_brakeman_dependency 'erubis'
|
|
2
|
-
|
|
3
|
-
require 'brakeman/parsers/erubis_patch'
|
|
4
|
-
|
|
5
|
-
#This is from the rails_xss plugin for Rails 2
|
|
6
|
-
class Brakeman::Rails2XSSPluginErubis < ::Erubis::Eruby
|
|
7
|
-
include Brakeman::ErubisPatch
|
|
8
|
-
|
|
9
|
-
def add_preamble(src)
|
|
10
|
-
#src << "@output_buffer = ActiveSupport::SafeBuffer.new;"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
#This is different from rails_xss - fixes some line number issues
|
|
14
|
-
def add_text(src, text)
|
|
15
|
-
if text == "\n"
|
|
16
|
-
src << "\n"
|
|
17
|
-
elsif text.include? "\n"
|
|
18
|
-
lines = text.split("\n")
|
|
19
|
-
if text.match(/\n\z/)
|
|
20
|
-
lines.each do |line|
|
|
21
|
-
src << "@output_buffer.safe_concat('" << escape_text(line) << "');\n"
|
|
22
|
-
end
|
|
23
|
-
else
|
|
24
|
-
lines[0..-2].each do |line|
|
|
25
|
-
src << "@output_buffer.safe_concat('" << escape_text(line) << "');\n"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
src << "@output_buffer.safe_concat('" << escape_text(lines.last) << "');"
|
|
29
|
-
end
|
|
30
|
-
else
|
|
31
|
-
src << "@output_buffer.safe_concat('" << escape_text(text) << "');"
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
BLOCK_EXPR = /\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/
|
|
36
|
-
|
|
37
|
-
def add_expr_literal(src, code)
|
|
38
|
-
if code =~ BLOCK_EXPR
|
|
39
|
-
src << "@output_buffer.safe_concat((" << $1 << ").to_s);"
|
|
40
|
-
else
|
|
41
|
-
src << '@output_buffer << ((' << code << ').to_s);'
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def add_expr_escaped(src, code)
|
|
46
|
-
src << '@output_buffer << ' << escaped_expr(code) << ';'
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def add_postamble(src)
|
|
50
|
-
#src << '@output_buffer.to_s'
|
|
51
|
-
end
|
|
52
|
-
end
|