当前位置: 首页>>代码示例>>Java>>正文


Java Block类代码示例

本文整理汇总了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;
}
 
开发者ID:kontext-e,项目名称:jqassistant-plugins,代码行数:20,代码来源:AsciidocImporter.java

示例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;
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:23,代码来源:TerminalCommandTreeprocessor.java

示例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>());
    }
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:22,代码来源:TerminalCommandTreeprocessor.java

示例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());
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:10,代码来源:GistMacro.java


注:本文中的org.asciidoctor.ast.Block类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。