Skip to content

Commit

Permalink
html tag attribute values may also be un- or singlequoted.
Browse files Browse the repository at this point in the history
The html standard
[allows](http://www.w3.org/TR/html-markup/syntax.html#attribute)
unquoted, single-quoted and double-quoted attribute values, this
patch accepts all three behaviours.
  • Loading branch information
lucasb-eyer committed Dec 23, 2016
1 parent b91dbe9 commit 8c36520
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion after/indent/html.vim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum)

function! GetCoffeeHtmlIndent(curlinenum)
" See if we're inside a coffeescript block.
let scriptlnum = searchpair('<script [^>]*type="text/coffeescript"[^>]*>', '',
let scriptlnum = searchpair('<script [^>]*type=[''"]\?text/coffeescript[''"]\?[^>]*>', '',
\ '</script>', 'bWn')
let prevlnum = prevnonblank(a:curlinenum)

Expand Down
2 changes: 1 addition & 1 deletion after/syntax/html.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ endif

" Syntax highlighting for text/coffeescript script tags
syn include @htmlCoffeeScript syntax/coffee.vim
syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
syn region coffeeScript start=#<script [^>]*type=['"]\?text/coffeescript['"]\?[^>]*>#
\ end=#</script>#me=s-1 keepend
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
\ containedin=htmlHead
Expand Down
10 changes: 10 additions & 0 deletions test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,14 @@
def: 42
}
</script>
<script type='text/coffeescript'>
abc = {
def: 42
}
</script>
<script type=text/coffeescript>
abc = {
def: 42
}
</script>
</head>

0 comments on commit 8c36520

Please sign in to comment.