mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 03:04:27 +08:00
mv zencoding/xxx.vim to zencoding/lang/xxx.vim
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"=============================================================================
|
||||
" zencoding.vim
|
||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
" Last Change: 29-May-2012.
|
||||
" Last Change: 30-May-2012.
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
@@ -51,7 +51,7 @@ function! zencoding#parseIntoTree(abbr, type)
|
||||
let abbr = a:abbr
|
||||
let type = a:type
|
||||
let rtype = len(globpath(&rtp, 'autoload/zencoding/'.type.'.vim')) ? type : 'html'
|
||||
return zencoding#{rtype}#parseIntoTree(abbr, type)
|
||||
return zencoding#lang#{rtype}#parseIntoTree(abbr, type)
|
||||
endfunction
|
||||
|
||||
function! s:parseTag(tag)
|
||||
@@ -141,7 +141,7 @@ function! zencoding#toString(...)
|
||||
while itemno < current.multiplier
|
||||
if len(current.name)
|
||||
let rtype = len(globpath(&rtp, 'autoload/zencoding/'.type.'.vim')) ? type : 'html'
|
||||
let inner = zencoding#{rtype}#toString(s:zen_settings, current, type, inline, filters, itemno, indent)
|
||||
let inner = zencoding#lang#{rtype}#toString(s:zen_settings, current, type, inline, filters, itemno, indent)
|
||||
if current.multiplier > 1
|
||||
let inner = substitute(inner, '\$#', '$line'.(itemno+1).'$', 'g')
|
||||
endif
|
||||
@@ -344,7 +344,7 @@ function! zencoding#expandAbbr(mode) range
|
||||
let part = substitute(part, '^.*<.\{-}>', '', '')
|
||||
endwhile
|
||||
let rtype = len(globpath(&rtp, 'autoload/zencoding/'.type.'.vim')) ? type : 'html'
|
||||
let part = zencoding#{rtype}#findTokens(part)
|
||||
let part = zencoding#lang#{rtype}#findTokens(part)
|
||||
elseif zencoding#isExtends(type, "css")
|
||||
let part = substitute(part, '^.*[;{]\s*', '', '')
|
||||
endif
|
||||
@@ -438,28 +438,15 @@ function! zencoding#moveNextPrev(flag)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#imageSize()
|
||||
let img_region = s:search_region('<img\s', '>')
|
||||
if !s:region_is_valid(img_region) || !s:cursor_in_region(img_region)
|
||||
return
|
||||
endif
|
||||
let content = s:get_content(img_region)
|
||||
if content !~ '^<img[^><]\+>$'
|
||||
return
|
||||
endif
|
||||
let current = s:parseTag(content)
|
||||
let fn = current.attr.src
|
||||
if fn !~ '^\(/\|http\)'
|
||||
let fn = simplify(expand('%:h') . '/' . fn)
|
||||
endif
|
||||
let [type, width, height] = ['', -1, -1]
|
||||
|
||||
function! zencoding#getImageSize(fn)
|
||||
let fn = a:fn
|
||||
if filereadable(fn)
|
||||
let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g')
|
||||
else
|
||||
let hex = substitute(system(g:zencoding_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g')
|
||||
endif
|
||||
|
||||
let [type, width, height] = ['', -1, -1]
|
||||
if hex =~ '^89504e470d0a1a0a'
|
||||
let type = 'png'
|
||||
let width = eval('0x'.hex[32:39])
|
||||
@@ -477,6 +464,25 @@ function! zencoding#imageSize()
|
||||
let height = eval('0x'.hex[18:19].hex[16:17])
|
||||
endif
|
||||
|
||||
return [width, height]
|
||||
endfunction
|
||||
|
||||
function! zencoding#imageSize()
|
||||
let img_region = s:search_region('<img\s', '>')
|
||||
if !s:region_is_valid(img_region) || !s:cursor_in_region(img_region)
|
||||
return
|
||||
endif
|
||||
let content = s:get_content(img_region)
|
||||
if content !~ '^<img[^><]\+>$'
|
||||
return
|
||||
endif
|
||||
let current = s:parseTag(content)
|
||||
let fn = current.attr.src
|
||||
if fn !~ '^\(/\|http\)'
|
||||
let fn = simplify(expand('%:h') . '/' . fn)
|
||||
endif
|
||||
|
||||
let [width, height] = zencoding#getImageSize(fn)
|
||||
if width == -1 && height == -1
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
function! zencoding#css#findTokens(str)
|
||||
function! zencoding#lang#css#findTokens(str)
|
||||
return substitute(a:str, '^.*[;{]\s*', '', '')
|
||||
endfunction
|
||||
|
||||
function! zencoding#css#parseIntoTree(abbr, type)
|
||||
function! zencoding#lang#css#parseIntoTree(abbr, type)
|
||||
let abbr = a:abbr
|
||||
let type = a:type
|
||||
|
||||
@@ -49,6 +49,6 @@ function! zencoding#css#parseIntoTree(abbr, type)
|
||||
return root
|
||||
endfunction
|
||||
|
||||
function! zencoding#css#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! zencoding#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
return ''
|
||||
endfunction
|
||||
@@ -1,12 +1,12 @@
|
||||
function! zencoding#haml#findTokens(str)
|
||||
function! zencoding#lang#haml#findTokens(str)
|
||||
return zencoding#html#findTokens(a:str)
|
||||
endfunction
|
||||
|
||||
function! zencoding#haml#parseIntoTree(abbr, type)
|
||||
return zencoding#html#parseIntoTree(a:abbr, a:type)
|
||||
function! zencoding#lang#haml#parseIntoTree(abbr, type)
|
||||
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
endfunction
|
||||
|
||||
function! zencoding#haml#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! zencoding#lang#haml#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let settings = a:settings
|
||||
let current = a:current
|
||||
let type = a:type
|
||||
@@ -5,7 +5,7 @@ let s:mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:_\!
|
||||
\ .'\%(\.{[{}a-zA-Z0-9_\-\$]\+\|'
|
||||
\ .'\.[a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\+\)\)\{0,1}\%(\*\([0-9]\+\)\)\{0,1}\(\%()\%(\*[0-9]\+\)\{0,1}\)*\)'
|
||||
|
||||
function! zencoding#html#findTokens(str)
|
||||
function! zencoding#lang#html#findTokens(str)
|
||||
let str = a:str
|
||||
let [pos, last_pos] = [0, 0]
|
||||
while len(str) > 0
|
||||
@@ -22,7 +22,7 @@ function! zencoding#html#findTokens(str)
|
||||
return a:str[last_pos :-1]
|
||||
endfunction
|
||||
|
||||
function! zencoding#html#parseIntoTree(abbr, type)
|
||||
function! zencoding#lang#html#parseIntoTree(abbr, type)
|
||||
let abbr = a:abbr
|
||||
let type = a:type
|
||||
|
||||
@@ -271,7 +271,7 @@ function! zencoding#html#parseIntoTree(abbr, type)
|
||||
return root
|
||||
endfunction
|
||||
|
||||
function! zencoding#html#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! zencoding#lang#html#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let settings = a:settings
|
||||
let current = a:current
|
||||
let type = a:type
|
||||
@@ -282,10 +282,10 @@ function! zencoding#html#toString(settings, current, type, inline, filters, item
|
||||
let str = ""
|
||||
|
||||
if zencoding#useFilter(filters, 'haml')
|
||||
return zencoding#haml#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
return zencoding#lang#haml#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
endif
|
||||
if zencoding#useFilter(filters, 'slim')
|
||||
return zencoding#slim#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
return zencoding#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
endif
|
||||
|
||||
let comment_indent = ''
|
||||
@@ -1,12 +1,12 @@
|
||||
function! zencoding#slim#findTokens(str)
|
||||
return zencoding#html#findTokens(a:str)
|
||||
function! zencoding#lang#slim#findTokens(str)
|
||||
return zencoding#lang#html#findTokens(a:str)
|
||||
endfunction
|
||||
|
||||
function! zencoding#slim#parseIntoTree(abbr, type)
|
||||
return zencoding#html#parseIntoTree(a:abbr, a:type)
|
||||
function! zencoding#lang#slim#parseIntoTree(abbr, type)
|
||||
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
endfunction
|
||||
|
||||
function! zencoding#slim#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! zencoding#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let settings = a:settings
|
||||
let current = a:current
|
||||
let type = a:type
|
||||
Reference in New Issue
Block a user