本文整理汇总了Java中org.pegdown.Printer类的典型用法代码示例。如果您正苦于以下问题:Java Printer类的具体用法?Java Printer怎么用?Java Printer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Printer类属于org.pegdown包,在下文中一共展示了Printer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: serialize
import org.pegdown.Printer; //导入依赖的package包/类
@Override
public void serialize(final VerbatimNode node, final Printer printer) {
printer.println().print("<pre><code");
String className = "prettyprint";
if (!StringUtils.isEmpty(node.getType())) {
className = className.concat(" " + node.getType());
}
printAttribute(printer, "class", className);
printer.print(">");
String text = node.getText();
// print HTML breaks for all initial newlines
while (text.charAt(0) == '\n') {
printer.print("<br/>");
text = text.substring(1);
}
printer.printEncoded(text);
printer.print("</code></pre>");
}
开发者ID:microacup,项目名称:microbbs,代码行数:20,代码来源:PrettifyVerbatimSerializer.java
示例2: serialize
import org.pegdown.Printer; //导入依赖的package包/类
@Override
public void serialize(VerbatimNode node, Printer printer) {
Type type = Type.getByName(node.getType());
String formatted = type.wrap(node.getText());
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
SourceStringReader reader = new SourceStringReader(formatted);
String desc;
try {
desc = reader.generateImage(baos, type.getFormatOption());
} catch (IOException e) {
throw new GeneratorException("Could not generate uml for node " + node, e);
}
final String rendered = type.render(baos.toByteArray(), desc);
printer.print(rendered);
}
开发者ID:protostuff,项目名称:protostuff-compiler,代码行数:17,代码来源:PlantUmlVerbatimSerializer.java
示例3: serialize
import org.pegdown.Printer; //导入依赖的package包/类
@Override
public void serialize(final VerbatimNode node, final Printer printer) {
printer.println().print("<pre><code");
// if (!StringUtils.isEmpty(node.getType())) {
// printAttribute(printer, "class", node.getType());
// }
printer.print(">");
String text = node.getText();
// print HTML breaks for all initial newlines
while (text.charAt(0) == '\n') {
printer.print("<br/>");
text = text.substring(1);
}
printer.printEncoded(text);
printer.print("</code></pre>");
}
开发者ID:windsource,项目名称:evernote-markdown-sync,代码行数:18,代码来源:MyCustomVerbatimSerializer.java
示例4: loadTitle
import org.pegdown.Printer; //导入依赖的package包/类
private void loadTitle() {
rootNode.accept(new CollectTextVisitor() {
@Override
public void visit(HeaderNode node) {
printer = new Printer();
visit((SuperNode) node);
title = printer.getString();
printer = null;
exit = true;
}
});
}
开发者ID:nicolaschriste,项目名称:docdown,代码行数:13,代码来源:PegdownDoc.java
示例5: visit
import org.pegdown.Printer; //导入依赖的package包/类
@Override
public boolean visit(Node node, Visitor visitor, Printer printer) {
log.debug("visiting node '" + node + "'");
if (!(node instanceof NamedBlockNode))
return false;
NamedBlockNode named = (NamedBlockNode) node;
if (!acceptsNode(named))
return false;
File imageFile = null;
try {
imageFile = getOrGenerateImage(named);
if (imageFile != null) {
printer
.println()
.print("<p>").indent(+1).println();
printImageHtml(printer, imageFile);
printer
.println().indent(-1).print("</p>")
.println();
} else {
// fallback on raw content...
printer.println()
.print("<pre>").indent(+1).println()
.print(named.getBody())
.println().indent(-1).print("</pre>")
.println();
}
} catch (Exception e) {
log.error("Failed to generate image", e);
}
return true;
}
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:36,代码来源:ImageBasedToHtmlPlugin.java
示例6: printAttribute
import org.pegdown.Printer; //导入依赖的package包/类
private void printAttribute(final Printer printer, final String name, final String value) {
printer.print(' ').print(name).print('=').print('"').print(value).print('"');
}
开发者ID:microacup,项目名称:microbbs,代码行数:4,代码来源:PrettifyVerbatimSerializer.java
示例7: printImageHtml
import org.pegdown.Printer; //导入依赖的package包/类
protected void printImageHtml(Printer printer, File imageFile) throws MalformedURLException {
printer.print("<").print(getHtmlTagName()).print(" src=\"").print(imageFile.toURI().toURL().toString()).print("\" />");
}
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:4,代码来源:ImageBasedToHtmlPlugin.java
注:本文中的org.pegdown.Printer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论