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.
Este commit está contenido en:
cn 2011-10-04 21:26:20 +02:00
padre 4d138ffec2
commit 09bdf55037
Se han modificado 5 ficheros con 74 adiciones y 1 borrados

31
erb.jsf Archivo normal
Ver fichero

@ -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

Ver fichero

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

Ver fichero

@ -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 Archivo normal
Ver fichero

@ -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)

Ver fichero

@ -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