• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Options类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.asciidoctor.Options的典型用法代码示例。如果您正苦于以下问题:Java Options类的具体用法?Java Options怎么用?Java Options使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Options类属于org.asciidoctor包,在下文中一共展示了Options类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getAsciiDocOptionsAndAttributes

import org.asciidoctor.Options; //导入依赖的package包/类
private Options getAsciiDocOptionsAndAttributes(ParserContext context) {
    Configuration config = context.getConfig();
    final AttributesBuilder attributes = attributes(config.getStringArray(Keys.ASCIIDOCTOR_ATTRIBUTES));
    if (config.getBoolean(Keys.ASCIIDOCTOR_ATTRIBUTES_EXPORT, false)) {
        final String prefix = config.getString(  Keys.ASCIIDOCTOR_ATTRIBUTES_EXPORT_PREFIX, "");
        for (final Iterator<String> it = config.getKeys(); it.hasNext();) {
            final String key = it.next();
            if (!key.startsWith("asciidoctor")) {
                attributes.attribute(prefix + key.replace(".", "_"), config.getProperty(key));
            }
        }
    }
    final Configuration optionsSubset = config.subset(Keys.ASCIIDOCTOR_OPTION);
    final Options options = options().attributes(attributes.get()).get();
    for (final Iterator<String> iterator = optionsSubset.getKeys(); iterator.hasNext();) {
        final String name = iterator.next();
        if (name.equals(Options.TEMPLATE_DIRS)) {
        	options.setTemplateDirs(optionsSubset.getString(name));
        } else {
        	options.setOption(name,  guessTypeByContent(optionsSubset.getString(name)));
        }
    }
    options.setBaseDir(context.getFile().getParentFile().getAbsolutePath());
    options.setSafe(UNSAFE);
    return options;
}
 
开发者ID:ghaseminya,项目名称:jbake-rtl-jalaali,代码行数:27,代码来源:AsciidoctorEngine.java


示例2: options

import org.asciidoctor.Options; //导入依赖的package包/类
protected Options options() {
    this.asciidocTemplates.mkdirs();

    String imagesOutputDirectory = generatedDocsDirectory.getAbsolutePath();

    Map<String, Object> attributes = new HashMap<>();
    attributes.put("imagesoutdir", imagesOutputDirectory);
    attributes.put("outdir", imagesOutputDirectory);

    return OptionsBuilder.options()
            .backend("html5")
            .safe(UNSAFE)
            .baseDir(generatedDocsDirectory)
            .templateDirs(asciidocTemplates)
            .attributes(attributes)
            .get();
}
 
开发者ID:jboz,项目名称:living-documentation,代码行数:18,代码来源:AbstractAsciidoctorMojo.java


示例3: newAsciidocConfluencePage

import org.asciidoctor.Options; //导入依赖的package包/类
public static AsciidocConfluencePage newAsciidocConfluencePage(AsciidocPage asciidocPage, Charset sourceEncoding, Path templatesDir, Path pageAssetsFolder, PageTitlePostProcessor pageTitlePostProcessor) {
    try {
        Path asciidocPagePath = asciidocPage.path();
        String asciidocContent = readIntoString(newInputStream(asciidocPagePath), sourceEncoding);

        Map<String, String> attachmentCollector = new HashMap<>();

        Options options = options(templatesDir, asciidocPagePath.getParent(), pageAssetsFolder);
        String pageContent = convertedContent(asciidocContent, options, asciidocPagePath, attachmentCollector, pageTitlePostProcessor, sourceEncoding);

        String pageTitle = pageTitle(asciidocContent, pageTitlePostProcessor);

        return new AsciidocConfluencePage(pageTitle, pageContent, attachmentCollector);
    } catch (IOException e) {
        throw new RuntimeException("Could not create asciidoc confluence page", e);
    }
}
 
开发者ID:alainsahli,项目名称:confluence-publisher,代码行数:18,代码来源:AsciidocConfluencePage.java


示例4: options

import org.asciidoctor.Options; //导入依赖的package包/类
private static Options options(Path templatesFolder, Path baseFolder, Path generatedAssetsTargetFolder) {
    if (!exists(templatesFolder)) {
        throw new RuntimeException("templateDir folder does not exist");
    }

    if (!isDirectory(templatesFolder)) {
        throw new RuntimeException("templateDir folder is not a folder");
    }

    Map<String, Object> attributes = new HashMap<>();
    attributes.put("imagesoutdir", generatedAssetsTargetFolder.toString());
    attributes.put("outdir", generatedAssetsTargetFolder.toString());

    return OptionsBuilder.options()
            .backend("xhtml5")
            .safe(UNSAFE)
            .baseDir(baseFolder.toFile())
            .templateDirs(templatesFolder.toFile())
            .attributes(attributes)
            .get();
}
 
开发者ID:alainsahli,项目名称:confluence-publisher,代码行数:22,代码来源:AsciidocConfluencePage.java


示例5: createOptions

import org.asciidoctor.Options; //导入依赖的package包/类
private Options createOptions(File base, File outputFile) {
  OptionsBuilder optionsBuilder = OptionsBuilder.options();

  optionsBuilder
      .backend(backend)
      .docType(DOCTYPE)
      .eruby(ERUBY)
      .safe(SafeMode.UNSAFE)
      .baseDir(base)
      .toFile(outputFile);

  AttributesBuilder attributesBuilder = AttributesBuilder.attributes();
  attributesBuilder.attributes(getAttributes());
  if (revnumber != null) {
    attributesBuilder.attribute(REVNUMBER_NAME, revnumber);
  }
  optionsBuilder.attributes(attributesBuilder.get());

  return optionsBuilder.get();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:AsciiDoctor.java


示例6: renderFiles

import org.asciidoctor.Options; //导入依赖的package包/类
private void renderFiles(List<String> inputFiles, ZipOutputStream zip) throws IOException {
  Asciidoctor asciidoctor = JRubyAsciidoctor.create();
  for (String inputFile : inputFiles) {
    String outName = mapInFileToOutFile(inputFile, inExt, outExt);
    File out = bazel ? new File(outName) : new File(tmpdir, outName);
    if (!bazel) {
      out.getParentFile().mkdirs();
    }
    File input = new File(inputFile);
    Options options = createOptions(basedir != null ? basedir : input.getParentFile(), out);
    asciidoctor.renderFile(input, options);
    if (zip != null) {
      zipFile(out, outName, zip);
    }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:AsciiDoctor.java


示例7: createInline

import org.asciidoctor.Options; //导入依赖的package包/类
public Inline createInline(AbstractBlock parent, String context, String text, Map<String, Object> attributes, Map<String, Object> options) {
    
    options.put(Options.ATTRIBUTES, attributes);
    
    IRubyObject rubyClass = rubyRuntime.evalScriptlet("Asciidoctor::Inline");
    RubyHash convertedOptions = RubyHashUtil.convertMapToRubyHashWithSymbols(rubyRuntime, options);
    // FIXME hack to ensure we have the underlying Ruby instance
    try {
        parent = parent.delegate();
    } catch (Exception e) {}

    Object[] parameters = {
            parent,
            RubyUtils.toSymbol(rubyRuntime, context),
            text,
            convertedOptions };
    return (Inline) JavaEmbedUtils.invokeMethod(rubyRuntime, rubyClass,
            "new", parameters, Inline.class);
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:20,代码来源:Processor.java


示例8: extensions_should_be_correctly_added_using_extension_registry

import org.asciidoctor.Options; //导入依赖的package包/类
@Test
@Ignore
public void extensions_should_be_correctly_added_using_extension_registry() throws IOException {

    // To avoid registering the same extension over and over for all tests,
    // service is instantiated manually.
    new ArrowsAndBoxesExtension().register(asciidoctor);

    Options options = options().inPlace(false).toFile(new File(testFolder.getRoot(), "rendersample.html"))
            .safe(SafeMode.UNSAFE).get();

    asciidoctor.renderFile(classpath.getResource("arrows-and-boxes-example.ad"), options);

    File renderedFile = new File(testFolder.getRoot(), "rendersample.html");
    Document doc = Jsoup.parse(renderedFile, "UTF-8");

    Element arrowsJs = doc.select("script[src=http://www.headjump.de/javascripts/arrowsandboxes.js").first();
    assertThat(arrowsJs, is(notNullValue()));

    Element arrowsCss = doc.select("link[href=http://www.headjump.de/stylesheets/arrowsandboxes.css").first();
    assertThat(arrowsCss, is(notNullValue()));

    Element arrowsAndBoxes = doc.select("pre[class=arrows-and-boxes").first();
    assertThat(arrowsAndBoxes, is(notNullValue()));

}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:27,代码来源:WhenJavaExtensionIsRegistered.java


示例9: getEngine

import org.asciidoctor.Options; //导入依赖的package包/类
private Asciidoctor getEngine(Options options) {
    try {
        lock.readLock().lock();
        if (engine==null) {
            lock.readLock().unlock();
            try {
                lock.writeLock().lock();
                if (engine==null) {
                    LOGGER.info("Initializing Asciidoctor engine...");
                    if (options.map().containsKey(OPT_GEM_PATH)) {
                        engine = Asciidoctor.Factory.create(String.valueOf(options.map().get(OPT_GEM_PATH)));
                    } else {
                        engine = Asciidoctor.Factory.create();
                    }

                    if (options.map().containsKey(OPT_REQUIRES)) {
                        String[] requires = String.valueOf(options.map().get(OPT_REQUIRES)).split(",");
                        if (requires.length != 0) {
                            for (String require : requires) {
                                engine.requireLibrary(require);
                            }
                        }
                    }

                    LOGGER.info("Asciidoctor engine initialized.");
                }
            } finally {
                lock.readLock().lock();
                lock.writeLock().unlock();
            }
        }
    } finally {
        lock.readLock().unlock();
    }
    return engine;
}
 
开发者ID:ghaseminya,项目名称:jbake-rtl-jalaali,代码行数:37,代码来源:AsciidoctorEngine.java


示例10: processHeader

import org.asciidoctor.Options; //导入依赖的package包/类
@Override
public void processHeader(final ParserContext context) {
    Options options = getAsciiDocOptionsAndAttributes(context);
    final Asciidoctor asciidoctor = getEngine(options);
    DocumentHeader header = asciidoctor.readDocumentHeader(context.getFile());
    Map<String, Object> contents = context.getContents();
    if (header.getDocumentTitle() != null) {
    	contents.put("title", header.getDocumentTitle().getCombined());
    }
    Map<String, Object> attributes = header.getAttributes();
    for (String key : attributes.keySet()) {
        if (key.startsWith("jbake-")) {
            Object val = attributes.get(key);
            if (val!=null) {
                String pKey = key.substring(6);
                contents.put(pKey, val);
            }
        }
        if (key.equals("revdate")) {
            if (attributes.get(key) != null && attributes.get(key) instanceof String) {

                DateFormat df = new SimpleDateFormat(context.getConfig().getString(Keys.DATE_FORMAT));
                Date date = null;
                try {
                    date = df.parse((String)attributes.get(key));
                    contents.put("date", date);
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            }
        }
        if (key.equals("jbake-tags")) {
            if (attributes.get(key) != null && attributes.get(key) instanceof String) {
                contents.put("tags", ((String) attributes.get(key)).split(","));
            }
        } else {
            contents.put(key, attributes.get(key));
        }
    }
}
 
开发者ID:ghaseminya,项目名称:jbake-rtl-jalaali,代码行数:41,代码来源:AsciidoctorEngine.java


示例11: processView

import org.asciidoctor.Options; //导入依赖的package包/类
@Override
public void processView(ViewEngineContext context) throws ViewEngineException {
    try (PrintWriter writer = context.getResponse().getWriter();
         InputStream is = servletContext.getResourceAsStream(resolveView(context));
         InputStreamReader isr = new InputStreamReader(is, "UTF-8");
         BufferedReader reader = new BufferedReader(isr)) {

        Options options = new Options();
        options.setAttributes(new HashMap(context.getModels()));

        asciidoctor.convert(reader, writer, options);
    } catch (IOException e) {
        throw new ViewEngineException(e);
    }
}
 
开发者ID:mvc-spec,项目名称:ozark,代码行数:16,代码来源:AsciiDocViewEngine.java


示例12: convertedContent

import org.asciidoctor.Options; //导入依赖的package包/类
private static String convertedContent(String adocContent, Options options, Path pagePath, Map<String, String> attachmentCollector, PageTitlePostProcessor pageTitlePostProcessor, Charset sourceEncoding) {
    String content = ASCIIDOCTOR.convert(adocContent, options);
    String postProcessedContent = postProcessContent(content,
            replaceCrossReferenceTargets(pagePath, pageTitlePostProcessor, sourceEncoding),
            collectAndReplaceAttachmentFileNames(attachmentCollector),
            unescapeCdataHtmlContent()
    );

    return postProcessedContent;
}
 
开发者ID:alainsahli,项目名称:confluence-publisher,代码行数:11,代码来源:AsciidocConfluencePage.java


示例13: i_render_the_asciidoctor_content_to_html

import org.asciidoctor.Options; //导入依赖的package包/类
@When("^I render the asciidoctor content to html$")
public void i_render_the_asciidoctor_content_to_html() throws Throwable {

	Attributes attrs = AttributesBuilder.attributes()
			.attribute("outdir", outputFolder.getAbsolutePath()).get();
	Options options = OptionsBuilder.options().safe(SafeMode.UNSAFE)
			.attributes(attrs).mkDirs(true).toDir(outputFolder)
			.destinationDir(outputFolder).baseDir(inputFolder)
			.backend("html5").get();
	asciidocOutputFile = new File(outputFolder,
			FilenameUtils.getBaseName(asciidocInputFile.getAbsolutePath())
					+ ".html");
	asciidoctor.convertFile(asciidocInputFile, options);
}
 
开发者ID:domgold,项目名称:asciidoctor-sdedit-extension,代码行数:15,代码来源:StepDef.java


示例14: createBlock

import org.asciidoctor.Options; //导入依赖的package包/类
public Block createBlock(AbstractBlock parent, String context, String content, Map<String, Object> attributes,
        Map<Object, Object> options) {

    options.put(Options.SOURCE, content);
    options.put(Options.ATTRIBUTES, attributes);        
    
    return createBlock(parent, context, options);
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:9,代码来源:Processor.java


示例15: isCopyCssActionRequired

import org.asciidoctor.Options; //导入依赖的package包/类
public boolean isCopyCssActionRequired(Map<String, Object> options) {

        Map<String, Object> attributes = (Map<String, Object>) options.get(Options.ATTRIBUTES);

        if (attributes != null && isCopyCssPresent(attributes)) {
            // if linkcss is not present by default is considered as true.
            if (isLinkCssWithValidValue(attributes)) {
                if (isStylesheetWithValidValue(attributes)) {
                    return true;
                }
            }
        }

        return false;
    }
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:16,代码来源:DefaultCssResolver.java


示例16: getDestinationDirectory

import org.asciidoctor.Options; //导入依赖的package包/类
private File getDestinationDirectory(File currentDirectory, Map<String, Object> options) {

        if ("".equals(options.get(Options.IN_PLACE))) {
            return currentDirectory;
        } else {

            if (options.containsKey(Options.TO_FILE)) {

                File toFile = new File((String) options.get(Options.TO_FILE));

                if (toFile.isAbsolute()) {
                    return toFile.getParentFile();
                } else {
                    if (options.containsKey(Options.TO_DIR)) {
                        File toDir = new File((String) options.get(Options.TO_DIR));
                        return new File(toDir, toFile.getParent());
                    } else {
                        return new File(currentDirectory, toFile.getParent());
                    }
                }

            } else {

                if (options.containsKey(Options.TO_DIR)) {
                    return new File((String) options.get(Options.TO_DIR));
                } else {
                    return currentDirectory;
                }
            }
        }
    }
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:32,代码来源:DefaultCssResolver.java


示例17: render

import org.asciidoctor.Options; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
@Deprecated
public String render(String content, Map<String, Object> options) {

    this.rubyGemsPreloader.preloadRequiredLibraries(options);

    logger.fine(AsciidoctorUtils.toAsciidoctorCommand(options, "-"));

    if (AsciidoctorUtils.isOptionWithAttribute(options, Attributes.SOURCE_HIGHLIGHTER, "pygments")) {
        logger.fine("In order to use Pygments with Asciidoctor, you need to install Pygments (and Python, if you don't have it yet). Read http://asciidoctor.org/news/#syntax-highlighting-with-pygments.");
    }

    String currentDirectory = rubyRuntime.getCurrentDirectory();

    if (options.containsKey(Options.BASEDIR)) {
        rubyRuntime.setCurrentDirectory((String) options.get(Options.BASEDIR));
    }

    RubyHash rubyHash = RubyHashUtil.convertMapToRubyHashWithSymbols(rubyRuntime, options);

    try {
        Object object = this.asciidoctorModule.convert(content, rubyHash);
        return returnExpectedValue(object);
    } catch(RaiseException e) {
        logger.severe(e.getException().getClass().getCanonicalName());
        throw new AsciidoctorCoreException(e);
    } finally {
        // we restore current directory to its original value.
        rubyRuntime.setCurrentDirectory(currentDirectory);
    }

}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:34,代码来源:JRubyAsciidoctor.java


示例18: renderFile

import org.asciidoctor.Options; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
@Deprecated
public String renderFile(File filename, Map<String, Object> options) {

    this.rubyGemsPreloader.preloadRequiredLibraries(options);

    logger.fine(AsciidoctorUtils.toAsciidoctorCommand(options, filename.getAbsolutePath()));

    String currentDirectory = rubyRuntime.getCurrentDirectory();

    if (options.containsKey(Options.BASEDIR)) {
        rubyRuntime.setCurrentDirectory((String) options.get(Options.BASEDIR));
    }

    RubyHash rubyHash = RubyHashUtil.convertMapToRubyHashWithSymbols(rubyRuntime, options);

    try {
        Object object = this.asciidoctorModule.convertFile(filename.getAbsolutePath(), rubyHash);
        return returnExpectedValue(object);
    } catch(RaiseException e) {
        logger.severe(e.getMessage());
        throw new AsciidoctorCoreException(e);
    } finally {
        // we restore current directory to its original value.
        rubyRuntime.setCurrentDirectory(currentDirectory);
    }
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:29,代码来源:JRubyAsciidoctor.java


示例19: preloadRequiredLibraries

import org.asciidoctor.Options; //导入依赖的package包/类
public void preloadRequiredLibraries(Map<String, Object> options) {

        if (options.containsKey(Options.ATTRIBUTES)) {
            Map<String, Object> attributes = (Map<String, Object>) options.get(Options.ATTRIBUTES);

            if (isOptionSet(attributes, Attributes.SOURCE_HIGHLIGHTER)
                    && isOptionWithValue(attributes, Attributes.SOURCE_HIGHLIGHTER, CODERAY)) {
                preloadLibrary(Attributes.SOURCE_HIGHLIGHTER);
            }

            if (isOptionSet(attributes, Attributes.CACHE_URI)) {
                preloadLibrary(Attributes.CACHE_URI);
            }

            if (isOptionSet(attributes, Attributes.DATA_URI)) {
                preloadLibrary(Attributes.DATA_URI);
            }
        }

        if (isOptionSet(options, Options.ERUBY) && isOptionWithValue(options, Options.ERUBY, ERUBIS)) {
            preloadLibrary(Options.ERUBY);
        }

        if (isOptionSet(options, Options.TEMPLATE_DIRS)) {
            preloadLibrary(Options.TEMPLATE_DIRS);
        }
        
        if(isOptionSet(options, Options.BACKEND) && "epub3".equalsIgnoreCase((String) options.get(Options.BACKEND))) {
            preloadLibrary(EPUB3);
        }

        if(isOptionSet(options, Options.BACKEND) && "pdf".equalsIgnoreCase((String) options.get(Options.BACKEND))) {
            preloadLibrary(PDF);
        }
    }
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:36,代码来源:RubyGemsPreloader.java


示例20: renderInput

import org.asciidoctor.Options; //导入依赖的package包/类
private String renderInput(Asciidoctor asciidoctor, Options options, List<File> inputFiles) {
    

    // jcommander bug makes this code not working.
    // if("-".equals(inputFile)) {
    // return asciidoctor.render(readInputFromStdIn(), options);
    // }

    StringBuilder output = new StringBuilder();

    for (File inputFile : inputFiles) {

        if (inputFile.canRead()) {

            String renderedFile = asciidoctor
                    .renderFile(inputFile, options);
            if (renderedFile != null) {
                output.append(renderedFile).append(
                        System.getProperty("line.separator"));
            }
        } else {
            System.err.println("asciidoctor: FAILED: input file(s) '"
                    + inputFile.getAbsolutePath()
                    + "' missing or cannot be read");
            throw new IllegalArgumentException(
                    "asciidoctor: FAILED: input file(s) '"
                            + inputFile.getAbsolutePath()
                            + "' missing or cannot be read");
        }
    }

    return output.toString();
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:34,代码来源:AsciidoctorInvoker.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClientModule类代码示例发布时间:2022-05-22
下一篇:
Java CyNetworkFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap