本文整理汇总了Java中org.pegdown.ast.VerbatimNode类的典型用法代码示例。如果您正苦于以下问题:Java VerbatimNode类的具体用法?Java VerbatimNode怎么用?Java VerbatimNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VerbatimNode类属于org.pegdown.ast包,在下文中一共展示了VerbatimNode类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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>");
}
开发者ID:microacup,项目名称:microbbs,代码行数:20,代码来源:PrettifyVerbatimSerializer.java
示例2: visit
import org.pegdown.ast.VerbatimNode; //导入依赖的package包/类
@Override
public void visit(VerbatimNode vn) {
final String lines[] = vn.getText().split("\n");
if( lines.length == 1 ) {
_buffer.append( "\n{noformat}")
.append(vn.getText())
.append( "{noformat}\n\n");
return;
}
if( vn.getType()==null || vn.getType().isEmpty() ) {
_buffer.append( "\n{noformat}\n")
.append(vn.getText())
.append("\n{noformat}\n\n")
;
return;
}
_buffer.append( format("\n{code:%s}\n", vn.getType()) )
.append(vn.getText())
.append("\n{code}\n\n")
;
}
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:25,代码来源:ToConfluenceSerializer.java
示例3: serialize
import org.pegdown.ast.VerbatimNode; //导入依赖的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
示例4: 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>");
}
开发者ID:windsource,项目名称:evernote-markdown-sync,代码行数:18,代码来源:MyCustomVerbatimSerializer.java
示例5: process
import org.pegdown.ast.VerbatimNode; //导入依赖的package包/类
@Override
public void process(int level, Node node, InvocationContext context) {
VerbatimNode vNode = (VerbatimNode) node;
SourceCode code = convertToSourceCode(vNode);
Attributes attributes = context.peekAttributes(level);
applyAttributes(code, attributes);
ITextContext iTextContext = context.iTextContext();
List<Element> elements = iTextContext.emitButCollectElements(code);
for (Element element : elements) {
ITextUtils.applyAttributes(element, attributes);
context.append(element);
}
}
开发者ID:Arnauld,项目名称:gutenberg,代码行数:17,代码来源:VerbatimNodeProcessor.java
示例6: visit
import org.pegdown.ast.VerbatimNode; //导入依赖的package包/类
/**
* Accept verbatim node.
* <p>
* put literals to translation entry.
* @param node verbatim node.
*/
@Override
public void visit(final VerbatimNode node) {
int start = node.getStartIndex();
if (handler.getChars(start, 3).equals("```")) {
if (!handler.getChars(start + 3, 1).equals("\n")) {
// github favored fenced code with language name.
int langEnd = handler.findFirst(start + 3, '\n');
if (langEnd > 0 && langEnd > start) {
String lang = handler.getChars(start + 3, langEnd - start - 3);
handler.startFenced(start, lang);
handler.putEntry(node);
handler.endFenced();
} else {
handler.throwTranslationException();
}
} else {
handler.startFenced(start, "");
handler.putEntry(node);
handler.endFenced();
}
} else {
handler.startVerbatim(start);
handler.putEntry(node);
handler.endVerbatim();
}
}
开发者ID:miurahr,项目名称:omegat-markdown-plugin,代码行数:33,代码来源:MarkdownSerializer.java
示例7: 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);
}
开发者ID:daisy,项目名称:pipeline-gui,代码行数:10,代码来源:MarkdownToJavafx.java
示例8: 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());
}
}
}
开发者ID:sillelien,项目名称:dollar,代码行数:12,代码来源:CodeExtractionVisitor.java
示例9: 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);
}
}
开发者ID:Abnaxos,项目名称:markdown-doclet,代码行数:20,代码来源:DocletSerializer.java
示例10: visit
import org.pegdown.ast.VerbatimNode; //导入依赖的package包/类
public void visit(final VerbatimNode node) {
}
开发者ID:miurahr,项目名称:omegat-markdown-plugin,代码行数:3,代码来源:AbstractMarkdownSerializer.java
示例11: f
import org.pegdown.ast.VerbatimNode; //导入依赖的package包/类
@Override
public void f(VerbatimNode node) {
System.out.printf( " text=[%s], type=[%s]", node.getText(), node.getType());
}
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:6,代码来源:PegdownParse.java
示例12: 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);
}
开发者ID:Arnauld,项目名称:gutenberg,代码行数:6,代码来源:VerbatimNodeProcessor.java
示例13: visit
import org.pegdown.ast.VerbatimNode; //导入依赖的package包/类
@Override public void visit(VerbatimNode node) {
//To change body of implemented methods use File | Settings | File Templates.
}
开发者ID:mindsnacks,项目名称:penmanship,代码行数:4,代码来源:BaseVisitor.java
注:本文中的org.pegdown.ast.VerbatimNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论