Support jsx's className. Close #255

This commit is contained in:
mattn
2015-02-21 21:06:33 +09:00
parent c24f2dcfcb
commit 3d6862d5d1
2 changed files with 9 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" emmet.vim " emmet.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com> " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 17-Dec-2014. " Last Change: 21-Feb-2015.
let s:save_cpo = &cpoptions let s:save_cpo = &cpoptions
set cpoptions&vim set cpoptions&vim
@@ -1815,6 +1815,10 @@ let s:emmet_settings = {
\ 'choose': 'xsl:choose>xsl:when+xsl:otherwise', \ 'choose': 'xsl:choose>xsl:when+xsl:otherwise',
\ } \ }
\ }, \ },
\ 'jsx': {
\ 'extends': 'html',
\ 'attribute_name': {'class': 'className'},
\ },
\ 'xslt': { \ 'xslt': {
\ 'extends': 'xsl', \ 'extends': 'xsl',
\ }, \ },

View File

@@ -371,6 +371,7 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1) let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
let q = emmet#getResource(type, 'quote_char', '"') let q = emmet#getResource(type, 'quote_char', '"')
let ct = emmet#getResource(type, 'comment_type', 'both') let ct = emmet#getResource(type, 'comment_type', 'both')
let an = emmet#getResource(type, 'attribute_name', {})
if emmet#useFilter(filters, 'haml') if emmet#useFilter(filters, 'haml')
return emmet#lang#haml#toString(settings, current, type, inline, filters, itemno, indent) return emmet#lang#haml#toString(settings, current, type, inline, filters, itemno, indent)
@@ -457,6 +458,9 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
endif endif
endfor endfor
endif endif
if has_key(an, attr)
let attr = an[attr]
endif
let str .= ' ' . attr . '=' . q . Val . q let str .= ' ' . attr . '=' . q . Val . q
if emmet#useFilter(filters, 'c') if emmet#useFilter(filters, 'c')
if attr ==# 'id' | let comment .= '#' . Val | endif if attr ==# 'id' | let comment .= '#' . Val | endif