New highlighter for Ruby's ERB and HTML embedded ERB

Ruby code inside ERB tags (whether in plain or HTML environment) is highlighted
via the ruby.jsf colorer.
This commit is contained in:
cn 2011-10-04 21:26:20 +02:00
rodič 4d138ffec2
revize 09bdf55037
5 změnil soubory, kde provedl 74 přidání a 1 odebrání

31
erb.jsf Normal file
Zobrazit soubor

@ -0,0 +1,31 @@
# JOE syntax highlight file for plain ERB
=Idle
=Keyword bold
=Bad bold red
=Brace magenta
=ERB yellow
:content Idle
* content
"<" maybe_erb_start
:maybe_erb_start Idle
* content noeat
"%" maybe_erb_eq recolor=-2
:maybe_erb_eq ERB
* rtn_ruby noeat call=ruby.ruby(erb)
"=" rtn_ruby call=ruby.ruby(erb)
:rtn_ruby ERB
* content noeat
:erb ERB
* erb
"%" maybe_erb_end
:maybe_erb_end ERB
* erb
">" content

Zobrazit soubor

@ -860,3 +860,11 @@
-syntax whitespace
--force
--spaces
plain ERB
*.erb
-syntax erb
.html.erb
*.html.erb
-syntax htmlerb

Zobrazit soubor

@ -81,11 +81,18 @@
.else
"?" xml_pi recolor=-2
.endif
.ifdef erb
"%" maybe_erb_eq
.endif
# this state allows php and perl to recolor the ?> %> or &> properly.
:rtn_php TagEdge
* idle noeat
:maybe_erb_eq TagEdge
* rtn_php noeat call=ruby.ruby(erb)
"=" rtn_php call=ruby.ruby(erb)
:tag_name_first Mystery
* tag_idle noeat
"-A-Za-z0-9._:" tag_name recolor=-1

11
htmlerb.jsf Normal file
Zobrazit soubor

@ -0,0 +1,11 @@
# JOE syntax highlight file for HTML embedded ERB
=Idle
=Keyword bold
=Bad bold red
=Brace magenta
=ERB yellow
:begin Idle
* NULL noeat call=html.html(erb)

Zobrazit soubor

@ -27,11 +27,13 @@
# Detect pod
:idle Idle
* rest noeat
* NULL noeat call=.ruby()
"=" pod_start
# Rest of line
.subr ruby
:rest Idle
* rest
"#" line_comment recolor=-1
@ -59,7 +61,16 @@
:after_term Idle
* rest noeat
" \t)" after_term
.ifdef erb
"/" rest
"%" after_term_erb_end
.else
"/%" rest
.endif
:after_term_erb_end Idle
* rest noeat
">" NULL recolor=-2 return
:pod_start Idle
* pod_start
@ -430,6 +441,9 @@ done
* match noeat
" \t" after_term noeat
"xrqQw" match
.ifdef erb
">" NULL recolor=-2 return
.endif
:match Idle
* inmatch save_c recolor=-1
@ -539,6 +553,8 @@ done
* rest noeat
"a-zA-Z0-9_" global_var
.end
.subr comment_todo
# initial state
:comment_todo_init Comment