<?xml version="1.0" encoding="UTF-8"?>
<!--

 This file is part of GtkSourceView

 GtkSourceView is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 GtkSourceView is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public License
 along with this library; if not, see <http://www.gnu.org/licenses/>.

-->
<language id="erb" name="ERB" version="2.0" _section="Markup">
  <metadata>
    <property name="mimetypes">text/erb</property>
    <property name="globs">*.erb</property>
    <property name="block-comment-start">&lt;%#</property>
    <property name="block-comment-end">%&gt;</property>
    <property name="suggested-suffix">.erb</property>
  </metadata>

  <styles>
    <style id="preprocessor" name="Preprocessor tags" map-to="def:preprocessor"/>
    <style id="erb-comment"  name="Embedded Ruby comment" map-to="def:comment"/>
    <style id="erb-block" name="Embedded Ruby code"/>
  </styles>

  <definitions>
    <context id="erb-comment" style-ref="erb-comment" class-disabled="no-spell-check" class="comment">
      <start>&lt;%#</start>
      <end>%&gt;</end>
      <include>
        <context ref="def:in-comment"/>
      </include>
    </context>

    <context id="erb-literal" style-ref="preprocessor">
      <match>&lt;%%</match>
    </context>

    <context id="erb-block" style-ref="erb-block" class="no-spell-check">
      <start>&lt;%[=-]?</start>
      <end>-?%&gt;</end>
      <include>
        <context sub-pattern="0" where="start" style-ref="preprocessor"/>
        <context sub-pattern="0" where="end" style-ref="preprocessor"/>
        <context ref="ruby:ruby:*"/>
      </include>
    </context>

    <context id="erb">
      <include>
        <context ref="erb-comment"/>
        <context ref="erb-literal"/>
        <context ref="erb-block"/>
      </include>
    </context>
  </definitions>
</language>

