From 3d6862d5d10c68ccfc19ae1cc5121473511b69c5 Mon Sep 17 00:00:00 2001 From: mattn Date: Sat, 21 Feb 2015 21:06:33 +0900 Subject: [PATCH] Support jsx's className. Close #255 --- autoload/emmet.vim | 6 +++++- autoload/emmet/lang/html.vim | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index 1296018..82d1405 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -1,7 +1,7 @@ "============================================================================= " emmet.vim " Author: Yasuhiro Matsumoto -" Last Change: 17-Dec-2014. +" Last Change: 21-Feb-2015. let s:save_cpo = &cpoptions set cpoptions&vim @@ -1815,6 +1815,10 @@ let s:emmet_settings = { \ 'choose': 'xsl:choose>xsl:when+xsl:otherwise', \ } \ }, +\ 'jsx': { +\ 'extends': 'html', +\ 'attribute_name': {'class': 'className'}, +\ }, \ 'xslt': { \ 'extends': 'xsl', \ }, diff --git a/autoload/emmet/lang/html.vim b/autoload/emmet/lang/html.vim index 1de1f62..9dc90e5 100644 --- a/autoload/emmet/lang/html.vim +++ b/autoload/emmet/lang/html.vim @@ -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 q = emmet#getResource(type, 'quote_char', '"') let ct = emmet#getResource(type, 'comment_type', 'both') + let an = emmet#getResource(type, 'attribute_name', {}) if emmet#useFilter(filters, 'haml') 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 endfor endif + if has_key(an, attr) + let attr = an[attr] + endif let str .= ' ' . attr . '=' . q . Val . q if emmet#useFilter(filters, 'c') if attr ==# 'id' | let comment .= '#' . Val | endif