Class: Syntax::ErbTokenizer

Inherits:
Tokenizer show all
Defined in:
lib/zena/code/default_syntax.rb

Instance Method Summary collapse

Instance Method Details

#stepObject



195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/zena/code/default_syntax.rb', line 195

def step
  if methods = scan(/<%[^>]+%>/m)
    methods =~ /<%(=?)([^>]+?)(-?)%>/m
    start_group :punct, "<%#{$1}"
    trailing = $3
    sub_lang :expr, "<code class='ruby'>#{Convertors::HTML.for_syntax('ruby').convert($2, false)}</code>"
    start_group :punct, "#{trailing}%>"
  elsif html = scan(/<\/?[^>]+>/)
    html =~/<\/?([^>]+)>/
    start_group :tag, html
  else
    start_group :normal, scan(/./m)
  end
end