fixed behavior of '+' operator

This commit is contained in:
mattn
2010-02-21 00:49:48 +09:00
parent 5270670c0b
commit 4ad297b80d
2 changed files with 12 additions and 7 deletions

View File

@@ -1,8 +1,8 @@
"============================================================================= "=============================================================================
" File: zencoding.vim " File: zencoding.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com> " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 20-Feb-2010. " Last Change: 21-Feb-2010.
" Version: 0.9 " Version: 0.10
" WebPage: http://github.com/mattn/zencoding-vim " WebPage: http://github.com/mattn/zencoding-vim
" Description: vim plugins for HTML and CSS hi-speed coding. " Description: vim plugins for HTML and CSS hi-speed coding.
" SeeAlso: http://code.google.com/p/zen-coding/ " SeeAlso: http://code.google.com/p/zen-coding/
@@ -800,7 +800,7 @@ function! s:zen_parseIntoTree(abbr, type)
let mx = '\([\+>]\|<\+\)\{-}\(@\{-}[a-z][a-z0-9:\!\-]*\|{[^}]\+}\)\(#[0-9A-Za-z_\-\$]\+\)\{0,1}\(\%(\[[^\]]\+\]\)*\)\(\%(\.[0-9A-Za-z_\-\$]\+\)*\)\({[^}]\+}\)\{0,1}\%(\*\([0-9]\+\)\)\{0,1}' let mx = '\([\+>]\|<\+\)\{-}\(@\{-}[a-z][a-z0-9:\!\-]*\|{[^}]\+}\)\(#[0-9A-Za-z_\-\$]\+\)\{0,1}\(\%(\[[^\]]\+\]\)*\)\(\%(\.[0-9A-Za-z_\-\$]\+\)*\)\({[^}]\+}\)\{0,1}\%(\*\([0-9]\+\)\)\{0,1}'
let last = {} let last = {}
let parent = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '' } let parent = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'brother': 0 }
let granma = parent let granma = parent
let root = parent let root = parent
while len(abbr) while len(abbr)
@@ -821,7 +821,7 @@ function! s:zen_parseIntoTree(abbr, type)
let tag_name = s:zen_settings[type]['aliases'][tag_name] let tag_name = s:zen_settings[type]['aliases'][tag_name]
endif endif
endif endif
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '' } let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'brother': 0 }
if has_key(s:zen_settings[type]['snippets'], tag_name) if has_key(s:zen_settings[type]['snippets'], tag_name)
let current['snippet'] = s:zen_settings[type]['snippets'][tag_name] let current['snippet'] = s:zen_settings[type]['snippets'][tag_name]
else else
@@ -872,6 +872,9 @@ function! s:zen_parseIntoTree(abbr, type)
let parent = last let parent = last
let parent['parent'] = tmp let parent['parent'] = tmp
endif endif
if operator == '+'
let last['brother'] = 1
endif
if operator =~ '<' if operator =~ '<'
for c in split(operator, '\zs') for c in split(operator, '\zs')
let tmp = parent['parent'] let tmp = parent['parent']
@@ -937,10 +940,10 @@ function! s:zen_toString(...)
let str .= " />\n" let str .= " />\n"
else else
if stridx(','.s:zen_settings[type]['block_elements'].',', ','.current['name'].',') != -1 && len(current['child']) if stridx(','.s:zen_settings[type]['block_elements'].',', ','.current['name'].',') != -1 && len(current['child'])
let str .= ">\n" . inner . "|</" . current['name'] . ">aa\n" let str .= ">\n" . inner . "|</" . current['name'] . ">\n"
else else
let str .= ">" . inner . "|</" . current['name'] . ">" let str .= ">" . inner . "|</" . current['name'] . ">"
if current['multiplier'] > 1 if current['multiplier'] > 1 || current['brother']
let str .= "\n" let str .= "\n"
endif endif
endif endif

View File

@@ -2,7 +2,7 @@ script_name: ZenCoding.vim
script_id: '2981' script_id: '2981'
script_type: utility script_type: utility
script_package: zencoding.vim script_package: zencoding.vim
script_version: '0.9' script_version: '0.10'
required_vim_version: '7.0' required_vim_version: '7.0'
summary: vim plugins for HTML and CSS hi-speed coding. summary: vim plugins for HTML and CSS hi-speed coding.
@@ -67,6 +67,8 @@ install_details: |
copy zencoding.vim to your plugin directory. copy zencoding.vim to your plugin directory.
versions: versions:
- '0.10': |
This is an upgrade for ZenCoding.vim: fixed behavior of '+' operator
- '0.9': | - '0.9': |
This is an upgrade for ZenCoding.vim: fixed single line behavior This is an upgrade for ZenCoding.vim: fixed single line behavior
- '0.8': | - '0.8': |