mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 11:14:26 +08:00
mv zencoding/xxx.vim to zencoding/lang/xxx.vim
This commit is contained in:
59
autoload/zencoding/lang/slim.vim
Normal file
59
autoload/zencoding/lang/slim.vim
Normal file
@@ -0,0 +1,59 @@
|
||||
function! zencoding#lang#slim#findTokens(str)
|
||||
return zencoding#lang#html#findTokens(a:str)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#parseIntoTree(abbr, type)
|
||||
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let settings = a:settings
|
||||
let current = a:current
|
||||
let type = a:type
|
||||
let inline = a:inline
|
||||
let filters = a:filters
|
||||
let itemno = a:itemno
|
||||
let indent = a:indent
|
||||
let str = ""
|
||||
|
||||
let comment_indent = ''
|
||||
let comment = ''
|
||||
let current_name = current.name
|
||||
let current_name = substitute(current.name, '\$$', itemno+1, '')
|
||||
if len(current.name) > 0
|
||||
let str .= current_name
|
||||
for attr in keys(current.attr)
|
||||
let val = current.attr[attr]
|
||||
while val =~ '\$\([^#{]\|$\)'
|
||||
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
||||
endwhile
|
||||
let attr = substitute(attr, '\$$', itemno+1, '')
|
||||
let str .= ' ' . attr . '="' . val . '"'
|
||||
endfor
|
||||
|
||||
let inner = ''
|
||||
if len(current.value) > 0
|
||||
let str .= "\n"
|
||||
for line in split(current.value[1:-2], "\n")
|
||||
let str .= " | " . line . "\n"
|
||||
endfor
|
||||
endif
|
||||
if len(current.child) == 1 && len(current.child[0].name) == 0
|
||||
let str .= "\n"
|
||||
for line in split(current.child[0].value[1:-2], "\n")
|
||||
let str .= " | " . line . "\n"
|
||||
endfor
|
||||
elseif len(current.child) > 0
|
||||
for child in current.child
|
||||
let inner .= zencoding#toString(child, type, inline, filters)
|
||||
endfor
|
||||
let inner = substitute(inner, "\n", "\n ", 'g')
|
||||
let inner = substitute(inner, "\n $", "", 'g')
|
||||
let str .= "\n " . inner
|
||||
endif
|
||||
endif
|
||||
if str !~ "\n$"
|
||||
let str .= "\n"
|
||||
endif
|
||||
return str
|
||||
endfunction
|
||||
Reference in New Issue
Block a user