mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-08 11:34:46 +08:00
fixed ${nr}. and fixed multi-line text for haml & slim.
This commit is contained in:
@@ -35,7 +35,8 @@ function! zencoding#lang#haml#toString(settings, current, type, inline, filters,
|
|||||||
let str .= '.' . substitute(val, ' ', '.', 'g')
|
let str .= '.' . substitute(val, ' ', '.', 'g')
|
||||||
else
|
else
|
||||||
if len(tmp) > 0 | let tmp .= ',' | endif
|
if len(tmp) > 0 | let tmp .= ',' | endif
|
||||||
let tmp .= ' :' . attr . ' => "' . val . '"'
|
let val = substitute(val, '\${cursor}', '', '')
|
||||||
|
let tmp .= ' :' . attr . ' => "' . val . '${cursor}' . '"'
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if len(tmp)
|
if len(tmp)
|
||||||
@@ -52,10 +53,13 @@ function! zencoding#lang#haml#toString(settings, current, type, inline, filters,
|
|||||||
let text = substitute(text, '\${nr}', "\n", 'g')
|
let text = substitute(text, '\${nr}', "\n", 'g')
|
||||||
let text = substitute(text, '\\\$', '$', 'g')
|
let text = substitute(text, '\\\$', '$', 'g')
|
||||||
let lines = split(text, "\n")
|
let lines = split(text, "\n")
|
||||||
let str .= " " . lines[0]
|
if len(lines) == 1
|
||||||
for line in lines[1:]
|
let str .= " " . text
|
||||||
let str .= " |\n" . line
|
else
|
||||||
endfor
|
for line in lines
|
||||||
|
let str .= "\n" . indent . line . " |"
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
if len(current.child) == 1 && len(current.child[0].name) == 0
|
if len(current.child) == 1 && len(current.child[0].name) == 0
|
||||||
let text = current.child[0].value[1:-2]
|
let text = current.child[0].value[1:-2]
|
||||||
@@ -63,17 +67,20 @@ function! zencoding#lang#haml#toString(settings, current, type, inline, filters,
|
|||||||
let text = substitute(text, '\${nr}', "\n", 'g')
|
let text = substitute(text, '\${nr}', "\n", 'g')
|
||||||
let text = substitute(text, '\\\$', '$', 'g')
|
let text = substitute(text, '\\\$', '$', 'g')
|
||||||
let lines = split(text, "\n")
|
let lines = split(text, "\n")
|
||||||
let str .= " " . lines[0]
|
if len(lines) == 1
|
||||||
for line in lines[1:]
|
let str .= " " . text
|
||||||
let str .= " |\n" . line
|
else
|
||||||
endfor
|
for line in lines
|
||||||
|
let str .= "\n" . indent . line . " |"
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
elseif len(current.child) > 0
|
elseif len(current.child) > 0
|
||||||
for child in current.child
|
for child in current.child
|
||||||
let inner .= zencoding#toString(child, type, inline, filters, itemno)
|
let inner .= zencoding#toString(child, type, inline, filters, itemno)
|
||||||
endfor
|
endfor
|
||||||
let inner = substitute(inner, "\n", "\n ", 'g')
|
let inner = substitute(inner, "\n", "\n" . indent, 'g')
|
||||||
let inner = substitute(inner, "\n $", "", 'g')
|
let inner = substitute(inner, "\n" . indent . "$", "", 'g')
|
||||||
let str .= "\n " . inner
|
let str .= "\n" . indent . inner
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let str = current.value[1:-2]
|
let str = current.value[1:-2]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
let s:mx = '\([+>]\|<\+\)\{-}\s*'
|
let s:mx = '\([+>]\|<\+\)\{-}\s*'
|
||||||
\ .'\((*\)\{-}\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_\-\$]\+\)'
|
\ .'\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)'
|
||||||
@@ -8,7 +8,7 @@ let s:mx = '\([+>]\|<\+\)\{-}\s*'
|
|||||||
\ .'\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)'
|
\ .'\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)'
|
||||||
\ .'\)*'
|
\ .'\)*'
|
||||||
\ .'\)'
|
\ .'\)'
|
||||||
\ .'\%(\({\%([^$}]\+\|\$#\|\$\${\w\+}\|\$\+\)*}\)\)\{0,1}'
|
\ .'\%(\({\%([^$}]\+\|\$#\|\${\w\+}\|\$\+\)*}\)\)\{0,1}'
|
||||||
\ .'\%(\*\([0-9]\+\)\)\{0,1}'
|
\ .'\%(\*\([0-9]\+\)\)\{0,1}'
|
||||||
\ .'\(\%()\%(\*[0-9]\+\)\{0,1}\)*\)'
|
\ .'\(\%()\%(\*[0-9]\+\)\{0,1}\)*\)'
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ function! zencoding#lang#slim#toString(settings, current, type, inline, filters,
|
|||||||
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
||||||
endwhile
|
endwhile
|
||||||
let attr = substitute(attr, '\$$', itemno+1, '')
|
let attr = substitute(attr, '\$$', itemno+1, '')
|
||||||
let sval = substitute(val, '\${cursor}', '', '')
|
let str .= ' ' . attr . '="' . val . '${cursor}' . '"'
|
||||||
let str .= ' ' . attr . '="' . val . '"'
|
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
let inner = ''
|
let inner = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user