1 -- Copyright 2006-2015 Mitchell mitchell.att.foicica.com. See LICENSE.
4 local l
= require('lexer')
5 local token
, word_match
= l
.token
, l
.word_match
6 local P
, R
, S
= lpeg
.P
, lpeg
.R
, lpeg
.S
8 local M
= {_NAME
= 'rhtml'}
11 local html
= l
.load('html')
14 local ruby
= l
.load('rails')
15 local ruby_start_rule
= token('rhtml_tag', '<%' * P('=')^
-1)
16 local ruby_end_rule
= token('rhtml_tag', '%>')
17 l
.embed_lexer(html
, ruby
, ruby_start_rule
, ruby_end_rule
)
20 rhtml_tag
= l
.STYLE_EMBEDDED
23 local _foldsymbols
= html
._foldsymbols
24 _foldsymbols
._patterns
[#_foldsymbols
._patterns
+ 1] = '<%%'
25 _foldsymbols
._patterns
[#_foldsymbols
._patterns
+ 1] = '%%>'
26 _foldsymbols
.rhtml_tag
= {['<%'] = 1, ['%>'] = -1}
27 M
._foldsymbols
= _foldsymbols