Sha256: fe85d84bf2ce62b2df9af9e34da720c6b333a214344aa9aa3736b06d5e21fe64

Contents?: true

Size: 956 Bytes

Versions: 18

Compression:

Stored size: 956 Bytes

Contents

# -*- coding: utf-8 -*- #

module Rouge
  module Lexers
    class EEX < TemplateLexer
      title "EEX"
      desc "Embedded Elixir"

      tag 'eex'
      aliases 'leex', 'heex'

      filenames '*.eex', '*.leex', '*.heex'

      def initialize(opts={})
        @elixir_lexer = Elixir.new(opts)

        super(opts)
      end

      start do
        parent.reset!
        @elixir_lexer.reset!
      end

      open  = /<%%|<%=|<%#|<%/
      close = /%%>|%>/

      state :root do
        rule %r/<%#/, Comment, :comment

        rule open, Comment::Preproc, :elixir

        rule %r/.+?(?=#{open})|.+/mo do
          delegate parent
        end
      end

      state :comment do
        rule close, Comment, :pop!
        rule %r/.+?(?=#{close})|.+/mo, Comment
      end

      state :elixir do
        rule close, Comment::Preproc, :pop!

        rule %r/.+?(?=#{close})|.+/mo do
          delegate @elixir_lexer
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
rouge-4.5.1 lib/rouge/lexers/eex.rb
rouge-4.5.0 lib/rouge/lexers/eex.rb
rouge-4.4.0 lib/rouge/lexers/eex.rb
rouge-4.3.0 lib/rouge/lexers/eex.rb
rouge-4.2.1 lib/rouge/lexers/eex.rb
rouge-4.2.0 lib/rouge/lexers/eex.rb
rouge-4.1.3 lib/rouge/lexers/eex.rb
rouge-4.1.2 lib/rouge/lexers/eex.rb
rouge-4.1.1 lib/rouge/lexers/eex.rb
mumukit-content-type-1.12.1 vendor/bundle/ruby/2.7.0/gems/rouge-3.30.0/lib/rouge/lexers/eex.rb
mumukit-content-type-1.12.0 vendor/bundle/ruby/2.7.0/gems/rouge-3.30.0/lib/rouge/lexers/eex.rb
rouge-4.1.0 lib/rouge/lexers/eex.rb
rouge-4.0.1 lib/rouge/lexers/eex.rb
rouge-4.0.0 lib/rouge/lexers/eex.rb
rouge-3.30.0 lib/rouge/lexers/eex.rb
rouge-3.29.0 lib/rouge/lexers/eex.rb
rouge-3.28.0 lib/rouge/lexers/eex.rb
rouge-3.27.0 lib/rouge/lexers/eex.rb