diff --git a/erb.jsf b/erb.jsf new file mode 100644 index 0000000..19f8955 --- /dev/null +++ b/erb.jsf @@ -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 diff --git a/ftyperc b/ftyperc index b3d6086..3a9563e 100644 --- a/ftyperc +++ b/ftyperc @@ -860,3 +860,11 @@ -syntax whitespace --force --spaces + + plain ERB +*.erb +-syntax erb + + .html.erb +*.html.erb +-syntax htmlerb diff --git a/html.jsf b/html.jsf index 7a0ba94..6bdc018 100644 --- a/html.jsf +++ b/html.jsf @@ -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 diff --git a/htmlerb.jsf b/htmlerb.jsf new file mode 100644 index 0000000..13b3dd3 --- /dev/null +++ b/htmlerb.jsf @@ -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) diff --git a/ruby.jsf b/ruby.jsf index e0b9073..cc35676 100644 --- a/ruby.jsf +++ b/ruby.jsf @@ -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