forked from VimPlug/emmet-vim
@@ -60,6 +60,13 @@ function! emmet#lang#html#parseIntoTree(abbr, type) abort
|
|||||||
|
|
||||||
let settings = emmet#getSettings()
|
let settings = emmet#getSettings()
|
||||||
let indent = emmet#getIndentation(type)
|
let indent = emmet#getIndentation(type)
|
||||||
|
let pmap = {
|
||||||
|
\ 'html': 'body',
|
||||||
|
\ 'table': 'tr',
|
||||||
|
\ 'tr': 'td',
|
||||||
|
\ 'ul': 'li',
|
||||||
|
\ 'ol': 'li',
|
||||||
|
\}
|
||||||
|
|
||||||
" try 'foo' to (foo-x)
|
" try 'foo' to (foo-x)
|
||||||
let rabbr = emmet#getExpandos(type, abbr)
|
let rabbr = emmet#getExpandos(type, abbr)
|
||||||
@@ -91,7 +98,7 @@ function! emmet#lang#html#parseIntoTree(abbr, type) abort
|
|||||||
endif
|
endif
|
||||||
if tag_name =~# '^#'
|
if tag_name =~# '^#'
|
||||||
let attributes = tag_name . attributes
|
let attributes = tag_name . attributes
|
||||||
let tag_name = 'div'
|
let tag_name = ''
|
||||||
endif
|
endif
|
||||||
if tag_name =~# '[^!]!$'
|
if tag_name =~# '[^!]!$'
|
||||||
let tag_name = tag_name[:-2]
|
let tag_name = tag_name[:-2]
|
||||||
@@ -99,12 +106,20 @@ function! emmet#lang#html#parseIntoTree(abbr, type) abort
|
|||||||
endif
|
endif
|
||||||
if tag_name =~# '^\.'
|
if tag_name =~# '^\.'
|
||||||
let attributes = tag_name . attributes
|
let attributes = tag_name . attributes
|
||||||
let tag_name = 'div'
|
let tag_name = ''
|
||||||
endif
|
endif
|
||||||
if tag_name =~# '^\[.*\]$'
|
if tag_name =~# '^\[.*\]$'
|
||||||
let attributes = tag_name . attributes
|
let attributes = tag_name . attributes
|
||||||
|
let tag_name = ''
|
||||||
|
endif
|
||||||
|
if empty(tag_name)
|
||||||
|
let pname = len(parent.child) > 0 ? parent.child[0].name : ''
|
||||||
|
if !empty(pname) && has_key(pmap, pname)
|
||||||
|
let tag_name = pmap[pname]
|
||||||
|
else
|
||||||
let tag_name = 'div'
|
let tag_name = 'div'
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
let basedirect = basevalue[1] ==# '-' ? -1 : 1
|
let basedirect = basevalue[1] ==# '-' ? -1 : 1
|
||||||
let basevalue = 0 + abs(basevalue[1:])
|
let basevalue = 0 + abs(basevalue[1:])
|
||||||
if multiplier <= 0 | let multiplier = 1 | endif
|
if multiplier <= 0 | let multiplier = 1 | endif
|
||||||
|
|||||||
Reference in New Issue
Block a user