diff --git a/autoload/emmet/lang/html.vim b/autoload/emmet/lang/html.vim
index b970402..0bdd956 100644
--- a/autoload/emmet/lang/html.vim
+++ b/autoload/emmet/lang/html.vim
@@ -1,6 +1,6 @@
let s:mx = '\([+>]\|[<^]\+\)\{-}\s*'
\ .'\((*\)\{-}\s*'
-\ .'\([@#.]\{-}[a-zA-Z_\!][a-zA-Z0-9:_\!\-$]*\|{\%([^$}]\+\|\$#\|\${\w\+}\|\$\+\)*}*[ \t\r\n}]*\|\[[^\]]\+\]\)'
+\ .'\([@#.]\{-}[a-zA-Z_\!][a-zA-Z0-9:_\!\-$]*\|{\%([^%$}]\+\|\$#\|\${\w\+}\|\$\+\)*}*[ \t\r\n}]*\|\[[^\]]\+\]\)'
\ .'\('
\ .'\%('
\ .'\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)'
@@ -22,6 +22,13 @@ function! emmet#lang#html#findTokens(str) abort
endif
let pos = stridx(str, tag, pos) + len(tag)
endwhile
+ while 1
+ let tag = matchstr(str, '{%[^%]\{-}%}', pos)
+ if len(tag) == 0
+ break
+ endif
+ let pos = stridx(str, tag, pos) + len(tag)
+ endwhile
let last_pos = pos
while len(str) > 0
let token = matchstr(str, s:mx, pos)