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

Java AttributesBuilder类代码示例

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

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



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

示例1: getAsciiDocOptionsAndAttributes

import org.asciidoctor.AttributesBuilder; //导入依赖的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: createOptions

import org.asciidoctor.AttributesBuilder; //导入依赖的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


示例3: test

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
@Test
public void test() throws IOException {
	folder.create();
	Asciidoctor asciidoctor = Asciidoctor.Factory.create();
	asciidoctor.javaExtensionRegistry().block(
			SdEditBlockProcessor.SDEDIT_BLOCK_NAME,
			SdEditBlockProcessor.class);
	asciidoctor.javaExtensionRegistry().blockMacro(
			SdEditBlockMacroProcessor.SDEDIT_BLOCK_MACRO_NAME,
			SdEditBlockMacroProcessor.class);
	File baseDir = new File("src/test/resources");
	File adoc = new File(baseDir, "sdinclude.adoc");
	File destDir = folder.newFolder();
	AttributesBuilder attributes = AttributesBuilder.attributes()
			.attribute("outdir", destDir.getAbsolutePath());
	OptionsBuilder options = OptionsBuilder.options().safe(SafeMode.UNSAFE)
			.mkDirs(true).toDir(destDir).destinationDir(destDir)
			.baseDir(baseDir).attributes(attributes);
	asciidoctor.convertFile(adoc, options.asMap());

	assertTrue(new File(destDir, "sdinclude.html").exists());
	assertTrue(new File(destDir, "testdiagram.png").exists());
	assertTrue(new File(destDir, "fromblock.svg").exists());
}
 
开发者ID:domgold,项目名称:asciidoctor-sdedit-extension,代码行数:25,代码来源:TestSdEditIncludeProcessor.java


示例4: should_convert_adoc_to_html

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
public void should_convert_adoc_to_html() throws URISyntaxException,
        DeploymentException, IOException, InterruptedException {

    Map<String, Object> parameters;
    parameters = options()
            .backend("html5")
            .safe(SafeMode.UNSAFE).headerFooter(true)
            .eruby("erubis")
            .attributes(
                    AttributesBuilder.attributes()
                            .attribute("icons!", "")
                            .attribute("allow-uri-read")
                            .attribute("copycss!", "").asMap())
            .asMap();

    AsciidoctorProcessor asciidoctor = new AsciidoctorProcessor();
    asciidoctor.init();

    final String result = asciidoctor.getDelegate().render(dataConvertToPDF, parameters);
    assertNotNull(result);
    assertEquals(result.contains("<h1>Document Title"), true);

    long start = System.currentTimeMillis();
    final String result2 = asciidoctor.getDelegate().convert(getResourceAsString("adoc/websocket.adoc"), parameters);
    assertNotNull(result2);
    System.out.println("time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:adoc-editor,项目名称:editor-backend,代码行数:28,代码来源:AsciidoctorProcessorTest.java


示例5: generate

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
public String generate(final Entry entry, final boolean oneLine) {
    final AttributesBuilder attributes = AttributesBuilder.attributes().linkAttrs(true);
    final OptionsBuilder options = OptionsBuilder.options().attributes(attributes);

    final String content = oneLine ? generateOneLine(entry) : generateContent(entry);
    return asciidoctor.convert(content, options);
}
 
开发者ID:sdaschner,项目名称:asciidoctor-blog-extension,代码行数:8,代码来源:ContentGenerator.java


示例6: testGenerate

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
@Test
public void testGenerate() {
    final String expectedSource = "++++\n<div class=\"sect1\">\n++++\n" +
            "++++\n<span class=\"note\">Published on 2014-12-12</span>\n++++\n" +
            "++++\n<h2><a href=\"/entries/test_entry\">Test entry</a></h2>\n++++\n" +
            "Lorem ipsum dolor sit amet + \n" +
            "link:/entries/test_entry[\"more\", role=\"more\"]\n++++\n</div>\n++++\n";
    final OptionsBuilder options = OptionsBuilder.options().attributes(AttributesBuilder.attributes().linkAttrs(true));
    final String expectedOutput = asciidoctor.convert(expectedSource, options);

    final String actualOutput = classUnderTest.generate(new Entry("Lorem ipsum dolor sit amet", "Test entry", "2014-12-12", "/entries/test_entry"), false);

    assertEquals(expectedOutput, actualOutput);
}
 
开发者ID:sdaschner,项目名称:asciidoctor-blog-extension,代码行数:15,代码来源:ContentGeneratorTest.java


示例7: testGenerateOneLine

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
@Test
public void testGenerateOneLine() {
    final String expectedSource ="link:/entries/test_entry[\"Test entry\"]\n";
    final OptionsBuilder options = OptionsBuilder.options().attributes(AttributesBuilder.attributes().linkAttrs(true));
    final String expectedOutput = asciidoctor.convert(expectedSource, options);

    final String actualOutput = classUnderTest.generate(new Entry("Lorem ipsum dolor sit amet", "Test entry", "2014-12-12", "/entries/test_entry"), true);

    assertEquals(expectedOutput, actualOutput);
}
 
开发者ID:sdaschner,项目名称:asciidoctor-blog-extension,代码行数:11,代码来源:ContentGeneratorTest.java


示例8: i_render_the_asciidoctor_content_to_html

import org.asciidoctor.AttributesBuilder; //导入依赖的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


示例9: when_using_a_tree_processor_a_toc_should_still_be_created_when_rendering_to_html

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
/**
 * See https://github.com/asciidoctor/asciidoctorj/issues/497.
 */
@Test
public void when_using_a_tree_processor_a_toc_should_still_be_created_when_rendering_to_html() {

    JavaExtensionRegistry javaExtensionRegistry = this.asciidoctor.javaExtensionRegistry();

    javaExtensionRegistry.treeprocessor(TouchEverythingTreeprocessor.class);

    String content = asciidoctor.renderFile(
        classpath.getResource("sample-with-sections.ad"),
        options().toFile(false)
            .backend("html")
            .attributes(AttributesBuilder.attributes().tableOfContents(true))
            .get());
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:18,代码来源:WhenJavaExtensionIsRegistered.java


示例10: when_using_a_tree_processor_a_toc_should_still_be_created_when_rendering_to_docbook

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
@Test
public void when_using_a_tree_processor_a_toc_should_still_be_created_when_rendering_to_docbook() {

    JavaExtensionRegistry javaExtensionRegistry = this.asciidoctor.javaExtensionRegistry();

    javaExtensionRegistry.treeprocessor(TouchEverythingTreeprocessor.class);

    String content = asciidoctor.renderFile(
        classpath.getResource("sample-with-sections.ad"),
        options().toFile(false)
            .backend("docbook")
            .attributes(AttributesBuilder.attributes().tableOfContents(true))
            .get());
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:15,代码来源:WhenJavaExtensionIsRegistered.java


示例11: api_parameters_should_be_transformed_to_cli_command

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
@Test
public void api_parameters_should_be_transformed_to_cli_command() {

    AttributesBuilder attributesBuilder = AttributesBuilder.attributes()
            .attribute("myAtribute", "myValue").sectionNumbers(true)
            .copyCss(false);

    OptionsBuilder optionsBuilder = OptionsBuilder.options()
            .backend("docbook").templateDirs(new File("a"), new File("b"))
            .safe(SafeMode.UNSAFE).attributes(attributesBuilder.get());

    String command = AsciidoctorUtils.toAsciidoctorCommand(
            optionsBuilder.asMap(), "file.adoc");

    String currentDirectory = new File( "" ).getAbsolutePath() + File.separator;

    String parametersString = command.substring(command.indexOf(" "), command.length());
    
    String[] parameters = parametersString.split(" ");
    
    AsciidoctorCliOptions asciidoctorCliOptions = new AsciidoctorCliOptions();
    new JCommander(asciidoctorCliOptions,
            parameters);
    
    assertThat(asciidoctorCliOptions.getTemplateDir(), containsInAnyOrder(currentDirectory+"a", currentDirectory+"b"));
    assertThat(asciidoctorCliOptions.getSafeMode(), is(SafeMode.UNSAFE));
    assertThat(asciidoctorCliOptions.getBackend(), is("docbook"));
    assertThat(asciidoctorCliOptions.getParameters(), containsInAnyOrder("file.adoc"));
    
    assertThat(asciidoctorCliOptions.getAttributes(), hasEntry("myAtribute", (Object)"myValue"));
    assertThat(asciidoctorCliOptions.getAttributes(), hasKey("numbered"));
    assertThat(asciidoctorCliOptions.getAttributes(), hasKey("copycss!"));
    
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:35,代码来源:WhenAsciidoctorAPICallIsCalled.java


示例12: getDefaultOptions

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
private Map<String, Object> getDefaultOptions() {
  Attributes attrs = AttributesBuilder.attributes().showTitle(true)
    .sourceHighlighter("coderay").attribute("coderay-css", "style")
    .attribute("env", "idea").attribute("env-idea").get();

  if (imagesPath != null) {
    final AsciiDocApplicationSettings settings = AsciiDocApplicationSettings.getInstance();
    if (settings.getAsciiDocPreviewSettings().getHtmlPanelProviderInfo().getClassName().equals(JavaFxHtmlPanelProvider.class.getName())) {
      attrs.setAttribute("outdir", imagesPath.toAbsolutePath().normalize().toString());
    }
  }
  OptionsBuilder opts = OptionsBuilder.options().safe(SafeMode.UNSAFE).backend("html5").headerFooter(false).attributes(attrs).option("sourcemap", "true")
    .baseDir(baseDir);
  return opts.asMap();
}
 
开发者ID:asciidoctor,项目名称:asciidoctor-intellij-plugin,代码行数:16,代码来源:AsciiDoc.java


示例13: attributes

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
private AttributesBuilder attributes() {
  return AttributesBuilder.attributes()
    .backend("html");
}
 
开发者ID:adrobisch,项目名称:raml-converter,代码行数:5,代码来源:RamlAsciiDoc.java


示例14: options

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
private OptionsBuilder options(AttributesBuilder attributesBuilder) {
  return OptionsBuilder.options()
    .attributes(attributesBuilder);
}
 
开发者ID:adrobisch,项目名称:raml-converter,代码行数:5,代码来源:RamlAsciiDoc.java


示例15: parse

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
public Options parse() {
    OptionsBuilder optionsBuilder = OptionsBuilder.options();
    AttributesBuilder attributesBuilder = AttributesBuilder.attributes();

    optionsBuilder.backend(this.backend).safe(this.safeMode).eruby(this.eruby);

    if (isDoctypeOption()) {
        optionsBuilder.docType(this.doctype);
    }

    if (isOutFileOption() && !isOutputStdout()) {
        optionsBuilder.toFile(new File(this.outFile));
    }

    if (isOutFileOption() && isOutputStdout()) {
        optionsBuilder.toFile(false);
    }

    if (this.safe) {
        optionsBuilder.safe(SafeMode.SAFE);
    }

    if (this.noHeaderFooter) {
        optionsBuilder.headerFooter(false);
    }

    if (this.sectionNumbers) {
        attributesBuilder.sectionNumbers(this.sectionNumbers);
    }

    if (this.compact) {
        optionsBuilder.compact(this.compact);
    }

    if (isBaseDirOption()) {
        optionsBuilder.baseDir(new File(this.baseDir));
    }

    if (isTemplateEngineOption()) {
        optionsBuilder.templateEngine(this.templateEngine);
    }

    if (isTemplateDirOption()) {
        for (String templateDir : this.templateDir) {
            optionsBuilder.templateDir(new File(templateDir));
        }
    }

    if (isDestinationDirOption() && !isOutputStdout()) {
        optionsBuilder.toDir(new File(this.destinationDir));
    }

    if (isInPlaceRequired()) {
        optionsBuilder.inPlace(true);
    }

    if (this.verbose) {
        optionsBuilder.option(MONITOR_OPTION_NAME, new HashMap<Object, Object>());
    }

    attributesBuilder.attributes(getAttributes());
    optionsBuilder.attributes(attributesBuilder.get());
    return optionsBuilder.get();

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


示例16: coderay_gem_should_be_preloaded

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
@Test
public void coderay_gem_should_be_preloaded() {

    Map<String, Object> options = OptionsBuilder.options()
            .attributes(AttributesBuilder.attributes().sourceHighlighter("coderay").get()).asMap();

    JRubyAsciidoctor asciidoctor = (JRubyAsciidoctor) JRubyAsciidoctor.create();

    asciidoctor.rubyGemsPreloader.preloadRequiredLibraries(options);
    RubyBoolean evalScriptlet = (RubyBoolean) asciidoctor.rubyRuntime.evalScriptlet("require 'coderay'");
    assertThat(evalScriptlet.isFalse(), is(true));

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


示例17: not_coderay_gem_should_not_be_preloaded

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
@Test
public void not_coderay_gem_should_not_be_preloaded() {

    Map<String, Object> options = OptionsBuilder.options()
            .attributes(AttributesBuilder.attributes().sourceHighlighter("pygments").get()).asMap();

    JRubyAsciidoctor asciidoctor = (JRubyAsciidoctor) JRubyAsciidoctor.create();

    asciidoctor.rubyGemsPreloader.preloadRequiredLibraries(options);
    RubyBoolean evalScriptlet = (RubyBoolean) asciidoctor.rubyRuntime.evalScriptlet("require 'coderay'");
    assertThat(evalScriptlet.isTrue(), is(true));

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


示例18: data_uri_gem_should_be_preloaded

import org.asciidoctor.AttributesBuilder; //导入依赖的package包/类
@Test
public void data_uri_gem_should_be_preloaded() {

    Map<String, Object> options = OptionsBuilder.options()
            .attributes(AttributesBuilder.attributes().dataUri(true).get()).asMap();

    JRubyAsciidoctor asciidoctor = (JRubyAsciidoctor) JRubyAsciidoctor.create();

    asciidoctor.rubyGemsPreloader.preloadRequiredLibraries(options);
    RubyBoolean evalScriptlet = (RubyBoolean) asciidoctor.rubyRuntime.evalScriptlet("require 'base64'");
    assertThat(evalScriptlet.isFalse(), is(true));

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java StoredObject类代码示例发布时间:2022-05-22
下一篇:
Java Script类代码示例发布时间: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