use jsx comments and honor className attribute (WEB-37786)

This commit is contained in:
Dennis Ushakov
2019-03-20 15:03:43 +03:00
parent ff92b72bb0
commit aaf4bf8c3c
@@ -45,16 +45,26 @@ public class CommentZenCodingFilter extends ZenCodingFilter {
public String filterText(@NotNull String text, @NotNull TemplateToken token) {
XmlTag tag = token.getXmlTag();
if (tag != null) {
String classAttr = tag.getAttributeValue(HtmlUtil.CLASS_ATTRIBUTE_NAME);
String classAttr = tag.getAttributeValue(getClassAttributeName());
String idAttr = tag.getAttributeValue(HtmlUtil.ID_ATTRIBUTE_NAME);
if (!isNullOrEmpty(classAttr) || !isNullOrEmpty(idAttr)) {
String commentString = buildCommentString(classAttr, idAttr);
return text + "\n<!-- /" + commentString + " -->";
return String.format(getCommentFormat(), text, commentString);
}
}
return text;
}
@NotNull
protected String getCommentFormat() {
return "%s\n<!-- /%s -->";
}
@NotNull
public String getClassAttributeName() {
return HtmlUtil.CLASS_ATTRIBUTE_NAME;
}
@NotNull
@Override
public String getSuffix() {