Skip to content

Commit 8c36520

Browse files
committed
html tag attribute values may also be un- or singlequoted.
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.
1 parent b91dbe9 commit 8c36520

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

after/indent/html.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum)
1818

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

after/syntax/html.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ endif
99

1010
" Syntax highlighting for text/coffeescript script tags
1111
syn include @htmlCoffeeScript syntax/coffee.vim
12-
syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
12+
syn region coffeeScript start=#<script [^>]*type=['"]\?text/coffeescript['"]\?[^>]*>#
1313
\ end=#</script>#me=s-1 keepend
1414
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
1515
\ containedin=htmlHead

test/test.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,14 @@
44
def: 42
55
}
66
</script>
7+
<script type='text/coffeescript'>
8+
abc = {
9+
def: 42
10+
}
11+
</script>
12+
<script type=text/coffeescript>
13+
abc = {
14+
def: 42
15+
}
16+
</script>
717
</head>

0 commit comments

Comments
 (0)