Skip to content

Commit 51fa67d

Browse files
committed
NEWS; allow for eruby nesting
1 parent 3339278 commit 51fa67d

File tree

4 files changed

+73
-5
lines changed

4 files changed

+73
-5
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2007-05-06 Tim Pope <[email protected]>
2+
3+
* NEWS: update documentation for next release
4+
* syntax/eruby.vim: allow for nesting (foo.erb.erb)
5+
* syntax/ruby.vim: removed : from rubyOptionalDoLine (falsely matches
6+
on symbols, and the syntax is deprecated anyways)
7+
18
2007-05-06 Tim Pope <[email protected]>
29

310
* ftplugin/ruby.vim: maps for [[, ]], [], ][, [m, ]m, [M, ]M

NEWS

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
= 2007.05.07
2+
3+
== Ruby Syntax Highlighting
4+
5+
Highlight OPTIMIZE alongside FIXME and TODO.
6+
7+
Multiline array literals can now be folded.
8+
9+
== Ruby Filetype Support
10+
11+
Added mappings for [[, ]], [], ][, [m, ]m, [M, and ]M. The first four bounce
12+
between class and module declarations, and the last four between method
13+
declarations.
14+
15+
== eRuby Syntax Highlighting
16+
17+
Tim Pope has taken over maintenance of the eRuby syntax file. The subtype of
18+
the file is now determined dynamically from the filename, rather than being
19+
hardwired to HTML. It can be overridden with b:eruby_subtype.
20+
21+
== eRuby Filetype Support
22+
23+
Tim Pope has taken over maintenance of the eRuby filetype plugin. Like with
24+
the syntax file, the subtype is now determined dynamically.
25+
26+
== eRuby Indenting
27+
28+
As with the syntax file and filetype plugin, the subtype is now determined
29+
dynamically.
30+
31+
== Bug Fixes
32+
33+
Ruby syntax file
34+
- when ruby_operators is set, highlight scope and range operators, and don't
35+
match '>' in =>'
36+
- regexp literals are highlighted after the 'else' keyword
37+
- don't match [!=?] as part of a sigil prefixed symbol name
38+
- allow text to appear after, and on the same line, as '=begin' in
39+
rubyDocumentation regions
40+
- highlight %s() ans a symbol, not a string
41+
- eliminated some false positves for here docs, symbols, ASCII codes, and
42+
conditionals as statement modifiers
43+
- added "neus" to regexp flags
44+
- Highlight punctuation variables in string interpolation, and flag invalid
45+
ones as errors
46+
- removed : from rubyOptionalDoLine (falsely matches on symbols)
47+
48+
Ruby filetype plugin
49+
- eliminated some false positives with the matchit patterns
50+
51+
Ruby indent plugin
52+
- ignore instance, class, and global variables named "end"
53+
54+
155
= 2007.03.02
256

357
== Omni Completion

syntax/eruby.vim

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ if !exists("b:eruby_subtype") && main_syntax == 'eruby'
4040
endif
4141
endif
4242

43+
if !exists("b:eruby_nest_level")
44+
let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.erb\>','@','g'),'[^@]','','g'))
45+
endif
46+
if !b:eruby_nest_level
47+
let b:eruby_nest_level = 1
48+
endif
49+
4350
if exists("b:eruby_subtype") && b:eruby_subtype != ''
4451
exe "runtime! syntax/".b:eruby_subtype.".vim"
4552
unlet! b:current_syntax
@@ -48,10 +55,10 @@ syn include @rubyTop syntax/ruby.vim
4855

4956
syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
5057

51-
syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend oneline
52-
syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions
53-
syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions
54-
syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erbRegions keepend
58+
exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend oneline'
59+
exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions'
60+
exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions'
61+
exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erbRegions keepend'
5562

5663
" Define the default highlighting.
5764
" For version 5.7 and earlier: only when not done already

syntax/ruby.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
198198
syn keyword rubyConditional then else elsif contained containedin=rubyConditionalExpression
199199

200200
" statements with optional 'do'
201-
syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\%(\<do\>\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP
201+
syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=TOP
202202
syn region rubyRepeatExpression start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=TOP nextgroup=rubyOptionalDoLine fold
203203

204204
if !exists("ruby_minlines")

0 commit comments

Comments
 (0)