Skip to content

Commit

Permalink
improved region detection
Browse files Browse the repository at this point in the history
  • Loading branch information
yko committed May 11, 2011
1 parent 2c117a3 commit f7e52b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion after/syntax/perl/MojoliciousLite.vim
Expand Up @@ -3,7 +3,7 @@
" Language: Mojo epl templates stored in Perl __DATA__
" Maintainer: yko <ykorshak@gmail.com>
" Version: 0.04
" Last Change: 2010 Dec 27
" Last Change: 2011 Feb 11
" Location: http://github.com/yko/mojo.vim
"
" Thanks to Viacheslav Tykhanovskyi for simplified region syntax
Expand Down
9 changes: 5 additions & 4 deletions syntax/epl.vim
Expand Up @@ -27,22 +27,22 @@ endif

" Begin and end of code blocks
syn match MojoStart /<%=\{0,2}/ contained
syn match MojoStart /^\s*%=\{0,2}/ contained
syn match MojoSingleStart /^\s*%=\{0,2}/ contained
syn match MojoEnd /=\{0,1}%>/ contained

syn cluster Mojo contains=MojoStart,MojoEnd

" Highlight code blocks
syn region PerlInside keepend oneline start=+<%=\{0,2}+hs=s skip=+".*%>.*"+ end=+=\{0,1}%>+ contains=@Mojo,@Perl
syn region PerlInside keepend oneline start=+^\s*%=\{0,2}+hs=s end=+$+ contains=@Mojo,@Perl
syn region PerlInside keepend oneline start=+<%=\{0,2}+hs=s end=+=\{0,1}%>+he=s-1,me=s-1 contains=MojoStart,@Perl nextgroup=MojoEnd
syn region PerlInside keepend oneline start=+^\s*%=\{0,2}+hs=s end=+$+ contains=MojoSingleStart,@Perl

if !exists("mojo_no_helpers")

" Default helpers
syn match perlStatementFiledesc "\<\%(app\|content\|content_for\|dumper\|extends\|flash\|include\|layout\|memorize\|param\|session\|stash\|url_for\|title\)\>" nextgroup=perlGenericBlock skipwhite contained

" Tag helpers
syn match perlStatementFiledesc "\<\%(base_tag\|check_box\|file_field\|form_for\|hidden_field\|input_tag\|javascript\|link_to\|password_field\|radio_button\|select_field\|stylesheet\|submit_button\|tag\|text_area\|text_field\)\>" nextgroup=perlGenericBlock skipwhite contained
syn match perlStatementFiledesc "\<\%(base_tag\|check_box\|file_field\|form_for\|hidden_field\|input_tag\|javascript\|link_to\|password_field\|radio_button\|select_field\|stylesheet\|submit_button\|tag\|text_area\|text_field\)\>" nextgroup=perlGenericBlock skipwhite contained

endif

Expand All @@ -53,6 +53,7 @@ syn cluster htmlPreproc add=PerlInside
command -nargs=+ HiLink hi def link <args>

HiLink MojoStart perlType
HiLink MojoSingleStart perlType
HiLink MojoEnd perlType
HiLink MojoFileName perlString
HiLink MojoFileNameStart perlSpecial
Expand Down

0 comments on commit f7e52b5

Please sign in to comment.