mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-08 11:34:46 +08:00
support linear gradient.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" zencoding.vim
|
" zencoding.vim
|
||||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||||
" Last Change: 24-Jul-2012.
|
" Last Change: 16-Oct-2012.
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
@@ -861,7 +861,7 @@ let s:zen_settings = {
|
|||||||
\ 'bdr+': 'border-right:1px solid #000;',
|
\ 'bdr+': 'border-right:1px solid #000;',
|
||||||
\ 'bdr:n': 'border-right:none;',
|
\ 'bdr:n': 'border-right:none;',
|
||||||
\ 'bdrw': 'border-right-width:|;',
|
\ 'bdrw': 'border-right-width:|;',
|
||||||
\ 'bdrs': 'border-right-style:|;',
|
\ 'bdrt': 'border-right-style:|;',
|
||||||
\ 'bdrs:n': 'border-right-style:none;',
|
\ 'bdrs:n': 'border-right-style:none;',
|
||||||
\ 'bdrc': 'border-right-color:#000;',
|
\ 'bdrc': 'border-right-color:#000;',
|
||||||
\ 'bdb': 'border-bottom:|;',
|
\ 'bdb': 'border-bottom:|;',
|
||||||
@@ -878,7 +878,7 @@ let s:zen_settings = {
|
|||||||
\ 'bdls': 'border-left-style:|;',
|
\ 'bdls': 'border-left-style:|;',
|
||||||
\ 'bdls:n': 'border-left-style:none;',
|
\ 'bdls:n': 'border-left-style:none;',
|
||||||
\ 'bdlc': 'border-left-color:#000;',
|
\ 'bdlc': 'border-left-color:#000;',
|
||||||
\ 'bdrz': 'border-radius:|;',
|
\ 'bdrs': 'border-radius:|;',
|
||||||
\ 'bdtrrz': 'border-top-right-radius:|;',
|
\ 'bdtrrz': 'border-top-right-radius:|;',
|
||||||
\ 'bdtlrz': 'border-top-left-radius:|;',
|
\ 'bdtlrz': 'border-top-left-radius:|;',
|
||||||
\ 'bdbrrz': 'border-bottom-right-radius:|;',
|
\ 'bdbrrz': 'border-bottom-right-radius:|;',
|
||||||
|
|||||||
@@ -5,7 +5,26 @@ endfunction
|
|||||||
function! zencoding#lang#css#parseIntoTree(abbr, type)
|
function! zencoding#lang#css#parseIntoTree(abbr, type)
|
||||||
let abbr = a:abbr
|
let abbr = a:abbr
|
||||||
let type = a:type
|
let type = a:type
|
||||||
|
let prefix = 0
|
||||||
|
let value = ''
|
||||||
|
|
||||||
|
" emmet
|
||||||
|
let prop = matchlist(abbr, '^\(-\{0,1}[a-zA-Z]\+\)\([0-9.]\+p\{0,1}\)$')
|
||||||
|
if len(prop)
|
||||||
|
let abbr = prop[1]
|
||||||
|
if abbr =~ '^-'
|
||||||
|
let prefix = 1
|
||||||
|
let abbr = abbr[1:]
|
||||||
|
endif
|
||||||
|
let value = prop[2]
|
||||||
|
if value =~ 'p$'
|
||||||
|
let value = substitute(prop[2], 'p$', '%', '')
|
||||||
|
elseif value =~ '\.'
|
||||||
|
let value .= 'em'
|
||||||
|
else
|
||||||
|
let value .= 'px'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
let settings = zencoding#getSettings()
|
let settings = zencoding#getSettings()
|
||||||
let indent = zencoding#getIndentation(type)
|
let indent = zencoding#getIndentation(type)
|
||||||
|
|
||||||
@@ -40,9 +59,33 @@ function! zencoding#lang#css#parseIntoTree(abbr, type)
|
|||||||
call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")')
|
call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")')
|
||||||
let current.snippet = join(lines, "\n")
|
let current.snippet = join(lines, "\n")
|
||||||
let current.name = ''
|
let current.name = ''
|
||||||
|
let current.snippet = substitute(current.snippet, ';', value . ';', '')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let current.pos = 0
|
let current.pos = 0
|
||||||
call add(root.child, current)
|
let lg = matchlist(abbr, '^\%(linear-gradient\|lg\)(\s*\(\w\+\)\s*,\s*\(\w\+\)\s*,\s*\(\w\+\)\s*)$')
|
||||||
|
if len(lg)
|
||||||
|
let current.name = ''
|
||||||
|
let current.snippet = printf("background-image: -webkit-gradient(%s, 0 0, 0 100%, from(%s), to(%s));\n", lg[1], lg[2], lg[3])
|
||||||
|
call add(root.child, deepcopy(current))
|
||||||
|
let current.snippet = printf("background-image: -webkit-linear-gradient(%s, %s);\n", lg[2], lg[3])
|
||||||
|
call add(root.child, deepcopy(current))
|
||||||
|
let current.snippet = printf("background-image: -moz-linear-gradient(%s, %s);\n", lg[2], lg[3])
|
||||||
|
call add(root.child, deepcopy(current))
|
||||||
|
let current.snippet = printf("background-image: -o-linear-gradient(%s, %s);\n", lg[2], lg[3])
|
||||||
|
call add(root.child, deepcopy(current))
|
||||||
|
let current.snippet = printf("background-image: linear-gradient(%s, %s);\n", lg[2], lg[3])
|
||||||
|
call add(root.child, deepcopy(current))
|
||||||
|
elseif prefix
|
||||||
|
let snippet = current.snippet
|
||||||
|
let current.snippet = '-webkit-' . snippet . "\n"
|
||||||
|
call add(root.child, deepcopy(current))
|
||||||
|
let current.snippet = '-moz-' . snippet . "\n"
|
||||||
|
call add(root.child, deepcopy(current))
|
||||||
|
call add(root.child, current)
|
||||||
|
else
|
||||||
|
call add(root.child, current)
|
||||||
|
endif
|
||||||
return root
|
return root
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user