本文整理汇总了Java中org.pegdown.ast.VerbatimNode.getText方法的典型用法代码示例。如果您正苦于以下问题:Java VerbatimNode.getText方法的具体用法?Java VerbatimNode.getText怎么用?Java VerbatimNode.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pegdown.ast.VerbatimNode
的用法示例。
在下文中一共展示了VerbatimNode.getText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import org.pegdown.ast.VerbatimNode; //导入方法依赖的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>");
}
示例2: serialize
import org.pegdown.ast.VerbatimNode; //导入方法依赖的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>");
}
示例3: visit
import org.pegdown.ast.VerbatimNode; //导入方法依赖的package包/类
@Override
public void visit(VerbatimNode verbatim) {
Text elem =new Text(verbatim.getText());
elem.getStyleClass().add("code");
Text newline = new Text("\n");
this.parent.addChild(elem);
this.parent.addChild(newline);
}
示例4: visit
import org.pegdown.ast.VerbatimNode; //导入方法依赖的package包/类
@Override
public void visit(@NotNull VerbatimNode node) {
if ("dollar".equals(node.getType())) {
try {
new DollarParserImpl(new ParserOptions()).parse(
new ScriptScope(node.getText(), "(markdown)", true, false), node.getText());
} catch (Exception e) {
throw new DollarException(e, node.getText());
}
}
}
示例5: visit
import org.pegdown.ast.VerbatimNode; //导入方法依赖的package包/类
/**
* Overrides the default implementation to set the language to "no-highlight" no
* language is specified. If highlighting is disabled or auto-highlighting is enabled,
* this method just calls the default implementation.
*
* @param node The AST node.
*/
@Override
public void visit(VerbatimNode node) {
if ( options.isHighlightEnabled() && !options.isAutoHighlightEnabled() && node.getType().isEmpty() ) {
VerbatimNode noHighlightNode = new VerbatimNode(node.getText(), "no-highlight");
noHighlightNode.setStartIndex(node.getStartIndex());
noHighlightNode.setEndIndex(node.getEndIndex());
super.visit(noHighlightNode);
}
else {
super.visit(node);
}
}
示例6: convertToSourceCode
import org.pegdown.ast.VerbatimNode; //导入方法依赖的package包/类
private SourceCode convertToSourceCode(VerbatimNode vNode) {
String lang = vNode.getType();
String content = vNode.getText();
return new SourceCode(lang, content);
}