Skip to content

Add Ruby ERB language spec

Jeremy Wilkins requested to merge jebw/gtksourceview:add-html-erb-support into master

ERB (or Embedded Ruby) is a preprocessor or templating language in common use in Ruby projects.

ERB is similar in concept PHP, and is commonly embedded within HTML files. It uses

  • <% ruby code %> - this will just execute the embedded ruby code
  • <%- ruby code -%> - this will execute the embedded ruby code and strip the white space from the ERB segment
  • <%= ruby code %> - this will execute the embedded ruby code, and replace the ERB tag with the output from the ruby code
  • <%# ruby code %> - this is a commented out section of ERB and will be removed from the file and ignored

This merge request

  1. Fixes a bug in the Ruby language spec to prevent ERB closing tags being interpreted as an uncommon literal syntax in Ruby
  2. Adds an ERB language spec as a default (*.erb files)
  3. Adds an ERB in HTML language spec (*.html.erb files) - these are the default for view templates in Ruby on Rails projects
  4. Adds an ERB in Javascript language spec (*.js.erb files) - these are used for SJR responses in Ruby on Rails projects

Merge request reports