forked from rooney/zencoding
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to expand for attribute to htmlFor? #116
Comments
Quick fix: (defun +web-emmet-make-tag-a (tag-maker tag-info &optional content)
"Extract tag info and pass them to tag-maker."
(let* ((name (pop tag-info))
(has-body? (pop tag-info))
(id (pop tag-info))
(classes (pop tag-info))
(props (pop tag-info))
(txt (pop tag-info))
(settings (gethash name emmet-tag-settings-table))
(self-closing?
(and (not (or txt content))
(or (not has-body?)
(and settings (gethash "selfClosing" settings))))))
(when (string= name "label")
(let ((defaultAttr (gethash "defaultAttr" settings)))
(remhash "for" defaultAttr)
(remhash "htmlFor" defaultAttr)
(if (derived-mode-p 'rjsx-mode)
(puthash "htmlFor" "" defaultAttr)
(puthash "for" "" defaultAttr))))
(funcall tag-maker name has-body? id classes props txt settings
(if content content
(if (and emmet-leaf-function (not self-closing?))
(funcall emmet-leaf-function))))))
(advice-add #'emmet-make-tag :override #'+web-emmet-make-tag-a) |
Or (defun +web-emmet-make-tag-a (_ tag-info)
(let ((name (car tag-info)))
(when (string= name "label")
(let ((defaultAttr (gethash "defaultAttr" (gethash name emmet-tag-settings-table))))
(remhash "for" defaultAttr)
(remhash "htmlFor" defaultAttr)
(if (derived-mode-p 'rjsx-mode)
(puthash "htmlFor" "" defaultAttr)
(puthash "for" "" defaultAttr))))))
(advice-add #'emmet-make-tag :before #'+web-emmet-make-tag-a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's nice that there's an option to expand class as
className
, but how do I go about implementing the same for thefor
attribute in jsx?The text was updated successfully, but these errors were encountered: