本文整理汇总了Java中org.pegdown.LinkRenderer.Rendering方法的典型用法代码示例。如果您正苦于以下问题:Java LinkRenderer.Rendering方法的具体用法?Java LinkRenderer.Rendering怎么用?Java LinkRenderer.Rendering使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pegdown.LinkRenderer
的用法示例。
在下文中一共展示了LinkRenderer.Rendering方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
@Override
public void visit(HeaderNode node) {
String tag = "h" + node.getLevel();
String title = printChildrenToString(node);
LinkRenderer.Rendering anchorLink = createAnchorLink(title);
printer.print('<').print(tag).print('>');
printLink(anchorLink);
visitChildren(node);
printer.print('<').print('/').print(tag).print('>');
}
示例2: printAnchorLink
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
protected void printAnchorLink(LinkRenderer.Rendering rendering) {
printer.print('<').print('a');
printAttribute("href", rendering.href);
for (LinkRenderer.Attribute attr : rendering.attributes) {
printAttribute(attr.name, attr.value);
}
printer.print('>').print("<span class=\"octicon octicon-link\"></span>").print(rendering.text).print("</a>");
}
示例3: printImageTag
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
protected void printImageTag(LinkRenderer.Rendering rendering) {
printer.print("<img");
printAttribute("src", rendering.href);
printAttribute("title", rendering.text);
printAttribute("class", "chat-image");
for (LinkRenderer.Attribute attr : rendering.attributes) {
printAttribute(attr.name, attr.value);
}
printer.print("\"/>");
}
示例4: printLink
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
@Override
protected void printLink(LinkRenderer.Rendering rendering)
{
printer.print('<').print('a');
printAttribute("href", rendering.href);
for (LinkRenderer.Attribute attr : rendering.attributes) {
printAttribute(attr.name, attr.value);
}
printAttribute("target", "_blank");
printer.print('>').print(rendering.text).print("</a>");
}
示例5: createAnchorLink
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
private LinkRenderer.Rendering createAnchorLink(String title) {
String cleanedTitle = title.toLowerCase().replace("\n", " ").replaceAll("[^a-z\\d\\s]", " ");
String slug = StringUtils.arrayToDelimitedString(StringUtils.tokenizeToStringArray(cleanedTitle, " "), "-");
return new LinkRenderer.Rendering("#"+slug, "").withAttribute("class","anchor").withAttribute("name", slug);
}
示例6: printLink
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
@Override
protected void printLink(LinkRenderer.Rendering rendering) {
printer.print(rendering.text);
}
示例7: renderWithDefaultText
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
@Test
void renderWithDefaultText() {
LinkRenderer.Rendering rendering = renderer.render(new WikiLinkNode("io.protostuff.Test"));
assertEquals("#/types/io.protostuff.Test", rendering.href);
assertEquals("io.protostuff.Test", rendering.text);
}
示例8: renderWithCustomText
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
@Test
void renderWithCustomText() {
LinkRenderer.Rendering rendering = renderer.render(new WikiLinkNode("io.protostuff.Test|Test"));
assertEquals("#/types/io.protostuff.Test", rendering.href);
assertEquals("Test", rendering.text);
}
示例9: printLink
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
protected void printLink(LinkRenderer.Rendering rendering) {
printer.print("\\href{" + rendering.href + "}{" + rendering.text + "}");
}
示例10: printImageTag
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
@Override
protected void printImageTag(LinkRenderer.Rendering rendering) {
printer.print('<').print(rendering.href).print('>');
}
示例11: printLink
import org.pegdown.LinkRenderer; //导入方法依赖的package包/类
@Override
protected void printLink(LinkRenderer.Rendering rendering) {
printer.print('<').print(rendering.href).print('|').print(rendering.text).print('>');
}