本文整理汇总了Java中org.asciidoctor.ast.Block类的典型用法代码示例。如果您正苦于以下问题:Java Block类的具体用法?Java Block怎么用?Java Block使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Block类属于org.asciidoctor.ast包,在下文中一共展示了Block类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanOneBlock
import org.asciidoctor.ast.Block; //导入依赖的package包/类
private AsciidocBlockDescriptor scanOneBlock(final AbstractBlock block) {
AsciidocBlockDescriptor blockDescriptor;
if(block instanceof Table) {
blockDescriptor = scanTableBlock((Table) block);
} else if(block instanceof ListNode) {
blockDescriptor = scanListBlock((ListNode) block);
} else if(block instanceof ListItem) {
blockDescriptor = scanListItemBlock((ListItem) block);
} else if(block instanceof Section) {
blockDescriptor = scanSectionBlock((Section) block);
} else if(block instanceof Block) {
blockDescriptor = store.create(AsciidocBlockDescriptor.class);
} else {
blockDescriptor = store.create(AsciidocBlockDescriptor.class);
}
setCommonBlockProperties(block, blockDescriptor);
return blockDescriptor;
}
示例2: process
import org.asciidoctor.ast.Block; //导入依赖的package包/类
@Override
public Document process(Document document) {
this.document = document;
final List<AbstractBlock> blocks = this.document.getBlocks();
for (int i = 0; i < blocks.size(); i++) {
final AbstractBlock currentBlock = blocks.get(i);
if(currentBlock instanceof Block) {
Block block = (Block)currentBlock;
List<String> lines = block.lines();
if (lines.size() > 0 && lines.get(0).startsWith("$")) {
blocks.set(
i, convertToTerminalListing(block));
}
}
}
return this.document;
}
示例3: convertToTerminalListing
import org.asciidoctor.ast.Block; //导入依赖的package包/类
public Block convertToTerminalListing(Block block) {
Map<String, Object> attributes = block.getAttributes();
attributes.put("role", "terminal");
StringBuilder resultLines = new StringBuilder();
List<String> lines = block.lines();
for (String line : lines) {
if (line.startsWith("$")) {
resultLines.append("<span class=\"command\">")
.append(line.substring(2, line.length()))
.append("</command");
} else {
resultLines.append(line);
}
}
return createBlock(this.document, "listing", Arrays.asList(resultLines.toString()), attributes,
new HashMap<Object, Object>());
}
示例4: process
import org.asciidoctor.ast.Block; //导入依赖的package包/类
@Override
public Block process(AbstractBlock parent, String target, Map<String, Object> attributes) {
String content = "<div class=\"content\">\n" +
"<script src=\"https://gist.github.com/"+target+".js\"></script>\n" +
"</div>";
return createBlock(parent, "pass", Arrays.asList(content), attributes, this.getConfig());
}