本文整理汇总了Java中com.vladsch.flexmark.util.html.Attributes.addValue方法的典型用法代码示例。如果您正苦于以下问题:Java Attributes.addValue方法的具体用法?Java Attributes.addValue怎么用?Java Attributes.addValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vladsch.flexmark.util.html.Attributes
的用法示例。
在下文中一共展示了Attributes.addValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAttributes
import com.vladsch.flexmark.util.html.Attributes; //导入方法依赖的package包/类
@Override
public void setAttributes(final Node node, final AttributablePart part, final Attributes attributes) {
if (node instanceof FencedCodeBlock) {
if (part.getName().equals("NODE")) {
String language = ((FencedCodeBlock) node).getInfo().toString();
if (!TextUtils.isEmpty(language) &&
!language.equals("nohighlight")) {
addJavascript(HIGHLIGHTJS);
addJavascript(HIGHLIGHT_INIT);
attributes.addValue("language", language);
attributes.addValue("onclick", String.format("javascript:android.onCodeTap('%s', this.textContent);",
language));
}
}
} else if (node instanceof MathJax) {
addJavascript(MATHJAX);
addJavascript(MATHJAX_CONFIG);
} else if (node instanceof Abbreviation) {
addJavascript(TOOLTIPSTER_JS);
addStyleSheet(TOOLTIPSTER_CSS);
addJavascript(TOOLTIPSTER_INIT);
attributes.addValue("class", "tooltip");
} else if (node instanceof Heading) {
attributes.addValue("onclick", String.format("javascript:android.onHeadingTap(%d, '%s');",
((Heading) node).getLevel(), ((Heading) node).getText()));
} else if (node instanceof Image) {
attributes.addValue("onclick", String.format("javascript: android.onImageTap(this.src, this.clientWidth, this.clientHeight);"));
} else if (node instanceof Mark) {
attributes.addValue("onclick", String.format("javascript: android.onMarkTap(this.textContent)"));
} else if (node instanceof Keystroke) {
attributes.addValue("onclick", String.format("javascript: android.onKeystrokeTap(this.textContent)"));
} else if (node instanceof Link ||
node instanceof AutoLink) {
attributes.addValue("onclick", String.format("javascript: android.onLinkTap(this.href, this.textContent)"));
}
}
示例2: processAttributes
import com.vladsch.flexmark.util.html.Attributes; //导入方法依赖的package包/类
/**
* Parse attributes of the form NodeName:attributeName=attribute value:attributeName=attribute value...
*
* @param attributeList list of attributes
* @return map of Node class to attributable part and attributes
*/
private Map<String, Attributes> processAttributes(String[] attributeList) {
HashMap<String, Attributes> nodeAttributeMap = new HashMap<>();
for (String attribute : attributeList) {
String[] nodeAttributes = attribute.split("\\|");
Attributes attributes = new Attributes();
for (int i = 1; i < nodeAttributes.length; i++) {
String[] attributeNameValue = nodeAttributes[i].split("=", 2);
if (attributeNameValue.length > 1) {
String value = attributeNameValue[1];
if (!value.isEmpty()) {
if (value.charAt(0) == '"' && value.charAt(value.length() - 1) == '"') {
value = value.substring(1, value.length() - 1);
} else if (value.charAt(0) == '\'' && value.charAt(value.length() - 1) == '\'') {
value = value.substring(1, value.length() - 1);
}
}
attributes.addValue(attributeNameValue[0], value);
} else {
attributes.addValue(attributeNameValue[0], attributeNameValue[0]);
}
}
nodeAttributeMap.put(nodeAttributes[0], attributes);
}
return nodeAttributeMap;
}
示例3: setAttributes
import com.vladsch.flexmark.util.html.Attributes; //导入方法依赖的package包/类
public void setAttributes(Node node, AttributablePart part, Attributes attributes) {
if (node instanceof FencedCodeBlock) {
if (part.getName().equals("NODE")) {
String language = ((FencedCodeBlock) node).getInfo().toString();
if (!TextUtils.isEmpty(language) && !language.equals("nohighlight")) {
addJavascript(
MarkdownView.HIGHLIGHTJS);
addJavascript(
MarkdownView.HIGHLIGHT_INIT);
attributes.addValue("language", language);
attributes.addValue("onclick", String.format(
"javascript:android.onCodeTap(\'%s\', this.textContent);",
language));
}
}
} else if (node instanceof MathJax) {
addJavascript(MarkdownView.MATHJAX);
addJavascript(
MarkdownView.MATHJAX_CONFIG);
} else if (node instanceof Abbreviation) {
addJavascript(
MarkdownView.TOOLTIPSTER_JS);
addStyleSheet(
MarkdownView.TOOLTIPSTER_CSS);
addJavascript(
MarkdownView.TOOLTIPSTER_INIT);
attributes.addValue("class", "tooltip");
} else if (node instanceof Heading) {
attributes.addValue("onclick",
String.format(Locale.getDefault(),
"javascript:android.onHeadingTap(%d, \'%s\');",
((Heading) node).getLevel(),
((Heading) node).getText()));
} else if (node instanceof Image) {
attributes.addValue("onclick",
"javascript: android.onImageTap(this.src, this.clientWidth, this.clientHeight);");
} else if (node instanceof Mark) {
attributes.addValue("onclick", "javascript: android.onMarkTap(this.textContent)");
} else if (node instanceof Keystroke) {
attributes.addValue("onclick",
"javascript: android.onKeystrokeTap(this.textContent)");
} else if (node instanceof Link || node instanceof AutoLink) {
attributes.addValue("onclick",
"javascript: android.onLinkTap(this.href, this.textContent)");
}
}
示例4: setAttributes
import com.vladsch.flexmark.util.html.Attributes; //导入方法依赖的package包/类
@Override
public void setAttributes(Node node, AttributablePart part, Attributes attributes) {
attributes.addValue("data-pos", node.getStartOffset() + ":" + node.getEndOffset());
}