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
|
@@ -228,13 +228,13 @@ module Slim
|
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
# These engines are executed at compile time, embedded ruby is interpolated
|
|
231
|
+
register :asciidoc, InterpolateTiltEngine
|
|
231
232
|
register :markdown, InterpolateTiltEngine
|
|
232
233
|
register :textile, InterpolateTiltEngine
|
|
233
234
|
register :rdoc, InterpolateTiltEngine
|
|
234
235
|
|
|
235
236
|
# These engines are executed at compile time
|
|
236
237
|
register :coffee, JavaScriptEngine, engine: TiltEngine
|
|
237
|
-
register :less, TagEngine, tag: :style, engine: TiltEngine
|
|
238
238
|
register :sass, TagEngine, :pretty, tag: :style, engine: SassEngine
|
|
239
239
|
register :scss, TagEngine, :pretty, tag: :style, engine: SassEngine
|
|
240
240
|
|
|
@@ -27,7 +27,8 @@ module Slim
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def section(name)
|
|
30
|
-
|
|
30
|
+
dict = scope[name]
|
|
31
|
+
if dict && !(dict.respond_to?(:empty?) && dict.empty?)
|
|
31
32
|
if !dict.respond_to?(:has_key?) && dict.respond_to?(:each)
|
|
32
33
|
new_scope do
|
|
33
34
|
dict.each do |d|
|
|
@@ -42,8 +43,8 @@ module Slim
|
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
def inverted_section(name)
|
|
45
|
-
|
|
46
|
-
yield if !
|
|
46
|
+
dict = scope[name]
|
|
47
|
+
yield if !dict || (dict.respond_to?(:empty?) && dict.empty?)
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
def to_s
|
|
@@ -48,25 +48,7 @@ module Slim
|
|
|
48
48
|
tag = @attrs.delete('tag').to_s
|
|
49
49
|
tag = @options[:default_tag] if tag.empty?
|
|
50
50
|
if block
|
|
51
|
-
|
|
52
|
-
#
|
|
53
|
-
# TODO: Add this as a helper somewhere to solve these capturing issues
|
|
54
|
-
# once and for all.
|
|
55
|
-
#
|
|
56
|
-
# If we have Slim capturing disabled and the scope defines the method `capture` (i.e. Rails)
|
|
57
|
-
# we use this method to capture the content.
|
|
58
|
-
#
|
|
59
|
-
# otherwise we just use normal Slim capturing (yield).
|
|
60
|
-
#
|
|
61
|
-
# See https://github.com/slim-template/slim/issues/591
|
|
62
|
-
# https://github.com/slim-template/slim#helpers-capturing-and-includes
|
|
63
|
-
#
|
|
64
|
-
content =
|
|
65
|
-
if @options[:disable_capture] && (scope = block.binding.eval('self')).respond_to?(:capture)
|
|
66
|
-
scope.capture(&block)
|
|
67
|
-
else
|
|
68
|
-
yield
|
|
69
|
-
end
|
|
51
|
+
content = capture_block_content(&block)
|
|
70
52
|
"<#{tag}#{build_attrs}>#{content}</#{tag}>"
|
|
71
53
|
else
|
|
72
54
|
"<#{tag}#{build_attrs} />"
|
|
@@ -90,6 +72,23 @@ module Slim
|
|
|
90
72
|
|
|
91
73
|
private
|
|
92
74
|
|
|
75
|
+
# Captures block content using the appropriate capturing mechanism.
|
|
76
|
+
#
|
|
77
|
+
# If we have Slim capturing disabled and the scope defines the method `capture` (i.e. Rails)
|
|
78
|
+
# we use this method to capture the content.
|
|
79
|
+
#
|
|
80
|
+
# Otherwise we just use normal Slim capturing (yield).
|
|
81
|
+
#
|
|
82
|
+
# See https://github.com/slim-template/slim/issues/591
|
|
83
|
+
# https://github.com/slim-template/slim#helpers-capturing-and-includes
|
|
84
|
+
def capture_block_content(&block)
|
|
85
|
+
if @options[:disable_capture] && (scope = block.binding.eval('self')).respond_to?(:capture)
|
|
86
|
+
scope.capture(&block)
|
|
87
|
+
else
|
|
88
|
+
yield
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
93
92
|
def hyphen_attr(name, escape, value)
|
|
94
93
|
if Hash === value
|
|
95
94
|
if @options[:hyphen_underscore_attrs]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Temple
|
|
2
2
|
======
|
|
3
3
|
|
|
4
|
-
[](https://github.com/judofyr/temple/actions/workflows/test.yml) [](https://github.com/judofyr/temple/actions/workflows/test.yml) [](https://qlty.sh/gh/judofyr/projects/temple) [](https://rubygems.org/gems/temple) [](http://rubydoc.info/gems/temple/frames)
|
|
5
5
|
|
|
6
6
|
Temple is an abstraction and a framework for compiling templates to pure Ruby.
|
|
7
7
|
It's all about making it easier to experiment, implement and optimize template
|
data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/static_analyzer.rb
RENAMED
|
@@ -4,7 +4,7 @@ module Temple
|
|
|
4
4
|
# Convert [:dynamic, code] to [:static, text] if code is static Ruby expression.
|
|
5
5
|
class StaticAnalyzer < Filter
|
|
6
6
|
def call(exp)
|
|
7
|
-
# Optimize only when
|
|
7
|
+
# Optimize only when a parser engine is available.
|
|
8
8
|
if ::Temple::StaticAnalyzer.available?
|
|
9
9
|
super
|
|
10
10
|
else
|
data/bundle/ruby/3.2.0/gems/{temple-0.10.4 → temple-0.10.6}/lib/temple/filters/string_splitter.rb
RENAMED
|
@@ -1,14 +1,70 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'ripper'
|
|
4
|
-
rescue LoadError
|
|
5
|
-
end
|
|
2
|
+
require 'temple/parser_engine'
|
|
6
3
|
|
|
7
4
|
module Temple
|
|
8
5
|
module Filters
|
|
9
6
|
# Compile [:dynamic, "foo#{bar}"] to [:multi, [:static, 'foo'], [:dynamic, 'bar']]
|
|
10
7
|
class StringSplitter < Filter
|
|
11
|
-
if
|
|
8
|
+
if PARSER_ENGINE == :prism
|
|
9
|
+
class << self
|
|
10
|
+
# `code` param must be valid string literal
|
|
11
|
+
def compile(code)
|
|
12
|
+
compiled = try_compile(code)
|
|
13
|
+
raise(FilterError, "Expected string literal") unless compiled
|
|
14
|
+
compiled
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def try_compile(code)
|
|
18
|
+
result = Prism.parse(code)
|
|
19
|
+
return unless result.success?
|
|
20
|
+
|
|
21
|
+
stmts = result.value.statements.body
|
|
22
|
+
return if stmts.size != 1
|
|
23
|
+
|
|
24
|
+
stack = [stmts.first]
|
|
25
|
+
compiled = []
|
|
26
|
+
|
|
27
|
+
until stack.empty?
|
|
28
|
+
case (node = stack.pop).type
|
|
29
|
+
when :interpolated_string_node
|
|
30
|
+
stack.concat(node.parts.reverse)
|
|
31
|
+
when :string_node
|
|
32
|
+
if !(unescaped = node.unescaped).empty?
|
|
33
|
+
compiled << [:static, unescaped]
|
|
34
|
+
end
|
|
35
|
+
when :embedded_statements_node
|
|
36
|
+
if (stmts = node.statements) && !(slice = stmts.slice).empty?
|
|
37
|
+
compiled << [:dynamic, slice]
|
|
38
|
+
end
|
|
39
|
+
when :embedded_variable_node
|
|
40
|
+
compiled << [:dynamic, node.variable.slice]
|
|
41
|
+
else
|
|
42
|
+
return
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
compiled
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def on_dynamic(code)
|
|
51
|
+
return [:dynamic, code] if code.include?("\n")
|
|
52
|
+
|
|
53
|
+
compiled = StringSplitter.try_compile(code)
|
|
54
|
+
return [:dynamic, code] unless compiled
|
|
55
|
+
|
|
56
|
+
temple = [:multi]
|
|
57
|
+
compiled.each do |type, content|
|
|
58
|
+
case type
|
|
59
|
+
when :static
|
|
60
|
+
temple << [:static, content]
|
|
61
|
+
when :dynamic
|
|
62
|
+
temple << on_dynamic(content)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
temple
|
|
66
|
+
end
|
|
67
|
+
elsif PARSER_ENGINE == :ripper
|
|
12
68
|
class << self
|
|
13
69
|
# `code` param must be valid string literal
|
|
14
70
|
def compile(code)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Temple
|
|
4
|
+
temple_parser_engine = ENV['TEMPLE_PARSER_ENGINE']
|
|
5
|
+
|
|
6
|
+
prism_available =
|
|
7
|
+
if !temple_parser_engine || temple_parser_engine == 'prism'
|
|
8
|
+
begin
|
|
9
|
+
require 'prism'
|
|
10
|
+
true
|
|
11
|
+
rescue LoadError
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
ripper_available =
|
|
16
|
+
if !temple_parser_engine || temple_parser_engine == 'ripper'
|
|
17
|
+
begin
|
|
18
|
+
require 'ripper'
|
|
19
|
+
Ripper.respond_to?(:lex)
|
|
20
|
+
rescue LoadError
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
PARSER_ENGINE =
|
|
25
|
+
if prism_available
|
|
26
|
+
:prism
|
|
27
|
+
elsif ripper_available
|
|
28
|
+
:ripper
|
|
29
|
+
else
|
|
30
|
+
:none
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private_constant :PARSER_ENGINE
|
|
34
|
+
end
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'temple/parser_engine'
|
|
3
|
+
|
|
4
|
+
module Temple
|
|
5
|
+
module StaticAnalyzer
|
|
6
|
+
if PARSER_ENGINE == :prism
|
|
7
|
+
class << self
|
|
8
|
+
def available?
|
|
9
|
+
true
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def static?(code)
|
|
13
|
+
return false if code.nil? || code.strip.empty?
|
|
14
|
+
(result = Prism.parse(code)).success? && static_node?(result.value)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def syntax_error?(code)
|
|
18
|
+
!Prism.parse_success?(code)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def static_node?(node)
|
|
24
|
+
case node.type
|
|
25
|
+
when :program_node
|
|
26
|
+
static_node?(node.statements)
|
|
27
|
+
when :parentheses_node
|
|
28
|
+
(stmts = node.body).is_a?(Prism::StatementsNode) &&
|
|
29
|
+
static_node?(stmts)
|
|
30
|
+
when :statements_node
|
|
31
|
+
node.body.size == 1 && static_node?(node.body.first)
|
|
32
|
+
when :interpolated_string_node
|
|
33
|
+
node.parts.all? { |part| static_node?(part) }
|
|
34
|
+
when :embedded_statements_node
|
|
35
|
+
(stmts = node.statements) && static_node?(stmts)
|
|
36
|
+
when :array_node
|
|
37
|
+
node.elements.all? { |elem| static_node?(elem) }
|
|
38
|
+
when :hash_node, :keyword_hash_node
|
|
39
|
+
node.elements.all? { |elem| static_node?(elem) }
|
|
40
|
+
when :assoc_node
|
|
41
|
+
static_node?(node.key) && static_node?(node.value)
|
|
42
|
+
when :string_node, :integer_node, :float_node, :imaginary_node,
|
|
43
|
+
:rational_node, :symbol_node, :true_node, :false_node, :nil_node
|
|
44
|
+
true
|
|
45
|
+
else
|
|
46
|
+
false
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
elsif PARSER_ENGINE == :ripper
|
|
51
|
+
STATIC_TOKENS = [
|
|
52
|
+
:on_tstring_beg, :on_tstring_end, :on_tstring_content,
|
|
53
|
+
:on_embexpr_beg, :on_embexpr_end,
|
|
54
|
+
:on_lbracket, :on_rbracket,
|
|
55
|
+
:on_qwords_beg, :on_words_sep, :on_qwords_sep,
|
|
56
|
+
:on_lparen, :on_rparen,
|
|
57
|
+
:on_lbrace, :on_rbrace, :on_label,
|
|
58
|
+
:on_int, :on_float, :on_imaginary,
|
|
59
|
+
:on_comma, :on_sp, :on_ignored_nl,
|
|
60
|
+
].freeze
|
|
61
|
+
|
|
62
|
+
DYNAMIC_TOKENS = [
|
|
63
|
+
:on_ident, :on_period,
|
|
64
|
+
].freeze
|
|
65
|
+
|
|
66
|
+
STATIC_KEYWORDS = [
|
|
67
|
+
'true', 'false', 'nil',
|
|
68
|
+
].freeze
|
|
69
|
+
|
|
70
|
+
STATIC_OPERATORS = [
|
|
71
|
+
'=>',
|
|
72
|
+
].freeze
|
|
73
|
+
|
|
74
|
+
class << self
|
|
75
|
+
def available?
|
|
76
|
+
true
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def static?(code)
|
|
80
|
+
return false if code.nil? || code.strip.empty? || syntax_error?(code)
|
|
81
|
+
|
|
82
|
+
Ripper.lex(code).each do |_, token, str|
|
|
83
|
+
case token
|
|
84
|
+
when *STATIC_TOKENS
|
|
85
|
+
# noop
|
|
86
|
+
when :on_kw
|
|
87
|
+
return false unless STATIC_KEYWORDS.include?(str)
|
|
88
|
+
when :on_op
|
|
89
|
+
return false unless STATIC_OPERATORS.include?(str)
|
|
90
|
+
when *DYNAMIC_TOKENS
|
|
91
|
+
return false
|
|
92
|
+
else
|
|
93
|
+
return false
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
!ShorthandSyntaxChecker.shorthand?(code)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def syntax_error?(code)
|
|
101
|
+
SyntaxChecker.new(code).parse
|
|
102
|
+
false
|
|
103
|
+
rescue SyntaxChecker::ParseError
|
|
104
|
+
true
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
class SyntaxChecker < Ripper
|
|
108
|
+
class ParseError < StandardError; end
|
|
109
|
+
|
|
110
|
+
private
|
|
111
|
+
|
|
112
|
+
def on_parse_error(*)
|
|
113
|
+
raise ParseError
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
class ShorthandSyntaxChecker < Ripper
|
|
118
|
+
class << self
|
|
119
|
+
def shorthand?(code)
|
|
120
|
+
instance = new(code)
|
|
121
|
+
instance.parse
|
|
122
|
+
instance.shorthand
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
attr_reader :shorthand
|
|
127
|
+
|
|
128
|
+
def initialize(*)
|
|
129
|
+
super
|
|
130
|
+
@shorthand = nil
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
private
|
|
134
|
+
|
|
135
|
+
def on_assoc_new(key, value)
|
|
136
|
+
@shorthand = true if value.nil?
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
else
|
|
141
|
+
class << self
|
|
142
|
+
def available?
|
|
143
|
+
false
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Copyright (c) 2010-2016 Ryan Tomayko <http://tomayko.com/about>
|
|
2
|
-
Copyright (c) 2015-
|
|
2
|
+
Copyright (c) 2015-2026 Jeremy Evans and contributors
|
|
3
3
|
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'asciidoctor'
|
|
4
|
-
# AsciiDoc see: http://asciidoc.org/
|
|
5
2
|
|
|
6
|
-
#
|
|
7
|
-
#
|
|
3
|
+
# = AsciiDoc
|
|
4
|
+
#
|
|
5
|
+
# Asciidoctor implementation for AsciiDoc
|
|
8
6
|
#
|
|
9
7
|
# Asciidoctor is an open source, pure-Ruby processor for
|
|
10
8
|
# converting AsciiDoc documents or strings into HTML 5,
|
|
11
9
|
# DocBook 4.5 and other formats.
|
|
10
|
+
#
|
|
11
|
+
# === See also
|
|
12
|
+
#
|
|
13
|
+
# * http://asciidoc.org
|
|
14
|
+
# * http://asciidoctor.github.com
|
|
15
|
+
|
|
16
|
+
require_relative 'template'
|
|
17
|
+
require 'asciidoctor'
|
|
18
|
+
|
|
12
19
|
Tilt::AsciidoctorTemplate = Tilt::StaticTemplate.subclass do
|
|
13
20
|
@options[:header_footer] = false if @options[:header_footer].nil?
|
|
14
21
|
Asciidoctor.render(@data, @options)
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# CoffeeScript / Literate CoffeeScript template implementation.
|
|
4
|
+
#
|
|
5
|
+
# CoffeeScript templates do not support object scopes, locals, or yield.
|
|
6
|
+
#
|
|
7
|
+
# === See also
|
|
8
|
+
#
|
|
9
|
+
# * http://coffeescript.org
|
|
10
|
+
#
|
|
11
|
+
# === Related modules
|
|
12
|
+
#
|
|
13
|
+
# * Tilt::CoffeeScriptTemplate
|
|
14
|
+
# * Tilt::CoffeeScriptLiterateTemplate
|
|
15
|
+
|
|
2
16
|
require_relative 'template'
|
|
3
17
|
require 'coffee_script'
|
|
4
18
|
|
|
5
19
|
module Tilt
|
|
6
|
-
# CoffeeScript template implementation. See:
|
|
7
|
-
# http://coffeescript.org/
|
|
8
|
-
#
|
|
9
|
-
# CoffeeScript templates do not support object scopes, locals, or yield.
|
|
10
20
|
class CoffeeScriptTemplate < StaticTemplate
|
|
11
21
|
self.default_mime_type = 'application/javascript'
|
|
12
22
|
|
|
@@ -1,4 +1,45 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# = Markdown (<tt>markdown</tt>, <tt>md</tt>, <tt>mkd</tt>)
|
|
4
|
+
#
|
|
5
|
+
# Markdown is a lightweight markup language, created by John Gruber
|
|
6
|
+
# and Aaron Swartz. For any markup that is not covered by Markdown’s syntax, HTML
|
|
7
|
+
# is used. Marking up plain text with Markdown markup is easy and Markdown
|
|
8
|
+
# formatted texts are readable.
|
|
9
|
+
#
|
|
10
|
+
# === Example
|
|
11
|
+
#
|
|
12
|
+
# Hello Markdown Templates
|
|
13
|
+
# ========================
|
|
14
|
+
#
|
|
15
|
+
# Hello World. This is a paragraph.
|
|
16
|
+
#
|
|
17
|
+
# === Usage
|
|
18
|
+
#
|
|
19
|
+
# To wrap a Markdown formatted document with a layout:
|
|
20
|
+
#
|
|
21
|
+
# layout = Tilt['erb'].new do
|
|
22
|
+
# "<!doctype html><title></title><%= yield %>"
|
|
23
|
+
# end
|
|
24
|
+
# data = Tilt['md'].new { "# hello tilt" }
|
|
25
|
+
# layout.render { data.render }
|
|
26
|
+
# # => "<!doctype html><title></title><h1>hello tilt</h1>\n"
|
|
27
|
+
#
|
|
28
|
+
# === Options
|
|
29
|
+
#
|
|
30
|
+
# ==== <tt>:smartypants => true|false</tt>
|
|
31
|
+
#
|
|
32
|
+
# Set <tt>true</tt> to enable [Smarty Pants][smartypants] style punctuation replacement.
|
|
33
|
+
#
|
|
34
|
+
# ==== <tt>:escape_html => true|false</tt>
|
|
35
|
+
#
|
|
36
|
+
# Set <tt>true</tt> disallow raw HTML in Markdown contents. HTML is converted to
|
|
37
|
+
# literal text by escaping <tt><</tt> characters.
|
|
38
|
+
#
|
|
39
|
+
# === See also
|
|
40
|
+
#
|
|
41
|
+
# * {Markdown Syntax Documentation}[http://daringfireball.net/projects/markdown/syntax]
|
|
42
|
+
|
|
2
43
|
require_relative 'template'
|
|
3
44
|
require 'commonmarker'
|
|
4
45
|
|
|
@@ -9,14 +50,24 @@ if defined?(::Commonmarker)
|
|
|
9
50
|
parse_opts = [
|
|
10
51
|
:smart,
|
|
11
52
|
:default_info_string,
|
|
53
|
+
:relaxed_tasklist_matching,
|
|
54
|
+
:relaxed_autolinks,
|
|
55
|
+
:leave_footnote_definitions,
|
|
56
|
+
:ignore_setext,
|
|
12
57
|
].freeze
|
|
13
58
|
render_opts = [
|
|
14
59
|
:hardbreaks,
|
|
15
60
|
:github_pre_lang,
|
|
61
|
+
:full_info_string,
|
|
16
62
|
:width,
|
|
17
63
|
:unsafe,
|
|
18
64
|
:escape,
|
|
19
65
|
:sourcepos,
|
|
66
|
+
:escaped_char_spans,
|
|
67
|
+
:ignore_empty_links,
|
|
68
|
+
:gfm_quirks,
|
|
69
|
+
:prefer_fenced,
|
|
70
|
+
:tasklist_classes,
|
|
20
71
|
].freeze
|
|
21
72
|
exts = [
|
|
22
73
|
:strikethrough,
|
|
@@ -27,9 +78,23 @@ if defined?(::Commonmarker)
|
|
|
27
78
|
:superscript,
|
|
28
79
|
:header_ids,
|
|
29
80
|
:footnotes,
|
|
81
|
+
:inline_footnotes,
|
|
30
82
|
:description_lists,
|
|
31
83
|
:front_matter_delimiter,
|
|
84
|
+
:multiline_block_quotes,
|
|
85
|
+
:math_dollars,
|
|
86
|
+
:math_code,
|
|
32
87
|
:shortcodes,
|
|
88
|
+
:wikilinks_title_before_pipe,
|
|
89
|
+
:wikilinks_title_after_pipe,
|
|
90
|
+
:underline,
|
|
91
|
+
:spoiler,
|
|
92
|
+
:greentext,
|
|
93
|
+
:subscript,
|
|
94
|
+
:subtext,
|
|
95
|
+
:alerts,
|
|
96
|
+
:cjk_friendly_emphasis,
|
|
97
|
+
:highlight,
|
|
33
98
|
].freeze
|
|
34
99
|
|
|
35
100
|
Tilt::CommonMarkerTemplate = Tilt::StaticTemplate.subclass do
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# = CSV
|
|
4
|
+
#
|
|
5
|
+
# CSV Template implementation.
|
|
6
|
+
#
|
|
7
|
+
# === Example
|
|
8
|
+
#
|
|
9
|
+
# # Example of csv template
|
|
10
|
+
# tpl = <<-EOS
|
|
11
|
+
# # header
|
|
12
|
+
# csv << ['NAME', 'ID']
|
|
13
|
+
#
|
|
14
|
+
# # data rows
|
|
15
|
+
# @people.each do |person|
|
|
16
|
+
# csv << [person[:name], person[:id]]
|
|
17
|
+
# end
|
|
18
|
+
# EOS
|
|
19
|
+
#
|
|
20
|
+
# @people = [
|
|
21
|
+
# {:name => "Joshua Peek", :id => 1},
|
|
22
|
+
# {:name => "Ryan Tomayko", :id => 2},
|
|
23
|
+
# {:name => "Simone Carletti", :id => 3}
|
|
24
|
+
# ]
|
|
25
|
+
#
|
|
26
|
+
# template = Tilt::CSVTemplate.new { tpl }
|
|
27
|
+
# template.render(self)
|
|
28
|
+
#
|
|
29
|
+
# === See also
|
|
30
|
+
#
|
|
31
|
+
# * http://ruby-doc.org/stdlib/libdoc/csv/rdoc/CSV.html
|
|
32
|
+
#
|
|
33
|
+
# === Related module
|
|
34
|
+
#
|
|
35
|
+
# * Tilt::CSVTemplate
|
|
36
|
+
|
|
37
|
+
require_relative 'template'
|
|
38
|
+
require 'csv'
|
|
39
|
+
|
|
40
|
+
module Tilt
|
|
41
|
+
|
|
42
|
+
class CSVTemplate < Template
|
|
43
|
+
self.default_mime_type = 'text/csv'
|
|
44
|
+
|
|
45
|
+
def prepare
|
|
46
|
+
@outvar = @options.delete(:outvar) || '_csvout'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def precompiled_template(locals)
|
|
50
|
+
<<-RUBY
|
|
51
|
+
#{@outvar} = CSV.generate(**#{@options}) do |csv|
|
|
52
|
+
#{@data}
|
|
53
|
+
end
|
|
54
|
+
RUBY
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def precompiled(locals)
|
|
58
|
+
source, offset = super
|
|
59
|
+
[source, offset + 1]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
end
|