suppress data attributes in XHTML

This commit is contained in:
Grahame Grieve 2023-03-21 17:27:14 +11:00
parent 5444c3a33a
commit c053ed9c6e
2 changed files with 20 additions and 1 deletions

View File

@ -187,7 +187,11 @@ public class XhtmlGenerator {
out.write(" ");
if (adorner != null) {
XhtmlGeneratorAdornerState attrState = adorner.getAttributeMarkup(this, newstate, node, node.getAttributes().item(i).getNodeName(), node.getAttributes().item(i).getTextContent());
out.write(node.getAttributes().item(i).getNodeName()+"=\"<span class=\"xmlattrvalue\">"+attrState.getPrefix()+escapeHtml(Utilities.escapeXml(node.getAttributes().item(i).getTextContent()), level)+attrState.getSuffix()+"</span>\"");
if (attrState.getAltText() != null) {
out.write(node.getAttributes().item(i).getNodeName()+"=\"<span class=\"xmlattrvalue\">"+attrState.getPrefix()+escapeHtml(Utilities.escapeXml(attrState.getAltText()), level)+attrState.getSuffix()+"</span>\"");
} else {
out.write(node.getAttributes().item(i).getNodeName()+"=\"<span class=\"xmlattrvalue\">"+attrState.getPrefix()+escapeHtml(Utilities.escapeXml(node.getAttributes().item(i).getTextContent()), level)+attrState.getSuffix()+"</span>\"");
}
} else
out.write(node.getAttributes().item(i).getNodeName()+"=\"<span class=\"xmlattrvalue\">"+escapeHtml(Utilities.escapeXml(node.getAttributes().item(i).getTextContent()), level)+"</span>\"");
}

View File

@ -41,6 +41,7 @@ public interface XhtmlGeneratorAdorner {
private String suffix;
private String supressionMessage;
private String path;
private String altText;
public XhtmlGeneratorAdornerState(String path, String prefix, String suffix) {
super();
@ -49,6 +50,15 @@ public interface XhtmlGeneratorAdorner {
this.suffix = suffix;
}
public XhtmlGeneratorAdornerState(String path, String prefix, String suffix, String altText) {
super();
this.path = path;
this.prefix = prefix;
this.suffix = suffix;
this.altText = altText;
}
public XhtmlGeneratorAdornerState(String path, String supressionMessage) {
super();
this.path = path;
@ -70,6 +80,11 @@ public interface XhtmlGeneratorAdorner {
public String getPath() {
return path;
}
public String getAltText() {
return altText;
}
}
XhtmlGeneratorAdornerState getState(XhtmlGenerator ref, XhtmlGeneratorAdornerState state, Element node) throws Exception;