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

Java SafeMode类代码示例

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

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



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

示例1: parameters

import org.asciidoctor.SafeMode; //导入依赖的package包/类
/**
    * Create the Map in order to configure the converter.
    * @param optsBuilder
 * @param converter
 * @param outputFilename
    * @return
    */
private Map<String, Object> parameters(OptionsBuilder optsBuilder, Converter converter,
									   String outputFilename){
       OptionsBuilder opts = optsBuilder
			.backend(converter.toString())
			.safe(SafeMode.UNSAFE).headerFooter(true);
               //.inPlace(true);
       if (outputFilename != null) {
		opts.toFile(new File(outputDir + outputFilename + converter.getFilenameExtension()));
	}
	//For now the PDF converter can only write to a file
	else if (outputFilename == null && converter == Converter.pdf) {
		opts.toFile(new File(outputDir + "temp.pdf"));
	} else {
		opts.toFile(false);
       }

       return  opts.asMap();
   }
 
开发者ID:adoc-editor,项目名称:editor-backend,代码行数:26,代码来源:AsciidoctorProcessor.java


示例2: generateDocumentation

import org.asciidoctor.SafeMode; //导入依赖的package包/类
private void generateDocumentation(DocumentAttributes documentAttributes, File adocFile, Asciidoctor asciidoctor) {
    
    OptionsBuilder ob;
    ob = OptionsBuilder.options().backend(documentAttributes.getBackend());
    ob.safe(SafeMode.UNSAFE);

    if (allowUriRead) {
        Attributes attr = new Attributes();
        attr.setAllowUriRead(true);
        ob.attributes(attr);
    }

    
    if ("pdf".equals(documentAttributes.getBackend())) {
        asciidoctor.unregisterAllExtensions();
    }
    asciidoctor.convertFile(adocFile, ob);
    //remove auxiliary files
    if ("pdf".equals(documentAttributes.getBackend())) {
        FileUtil.removeFile(adocFile.getParent() + "/" + outputFileName + "-theme.yml");

    }

    getLog().info("Generated documentation at: " + adocFile.getParent());
}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:26,代码来源:CukedoctorMojo.java


示例3: createOptions

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


示例4: test

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


示例5: a_docinfoprocessor_should_be_executed_and_add_meta_in_footer

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void a_docinfoprocessor_should_be_executed_and_add_meta_in_footer() {
    JavaExtensionRegistry javaExtensionRegistry = this.asciidoctor.javaExtensionRegistry();

    Map<String, Object> options = new HashMap<String, Object>();
    options.put("location", ":footer");
    MetaRobotsDocinfoProcessor metaRobotsDocinfoProcessor = new MetaRobotsDocinfoProcessor(options);

    javaExtensionRegistry.docinfoProcessor(metaRobotsDocinfoProcessor);

    String content = asciidoctor.renderFile(
            classpath.getResource("simple.adoc"),
            options().headerFooter(true).safe(SafeMode.SERVER).toFile(false).get());

    Document doc = Jsoup.parse(content, "UTF-8");

    Element footer = doc.getElementById("footer");
    // Since Asciidoctor 1.5.3 the docinfo in the footer is a sibling to the footer element
    assertTrue("robots".equals(footer.nextElementSibling().attr("name")));
}
 
开发者ID:asciidoctor,项目名称:asciidoctorj,代码行数:21,代码来源:WhenJavaExtensionIsRegistered.java


示例6: extensions_should_be_correctly_added_using_extension_registry

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


示例7: generateDocumentation

import org.asciidoctor.SafeMode; //导入依赖的package包/类
protected synchronized void generateDocumentation(List<Feature> features, DocumentAttributes attrs, String outputPath, Asciidoctor asciidoctor) {
    asciidoctor.unregisterAllExtensions();
    if (!attrs.getBackend().equalsIgnoreCase("pdf")) {
        new CukedoctorExtensionRegistry().register(asciidoctor);
    }
    CukedoctorConverter converter = Cukedoctor.instance(features, attrs);
    String doc = converter.renderDocumentation();
    File adocFile = FileUtil.saveFile(outputPath + "/documentation.adoc", doc);
    asciidoctor.convertFile(adocFile, OptionsBuilder.options().backend(attrs.getBackend()).safe(SafeMode.UNSAFE).asMap());
}
 
开发者ID:jenkinsci,项目名称:cucumber-living-documentation-plugin,代码行数:11,代码来源:CukedoctorPublisher.java


示例8: should_convert_adoc_to_html

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


示例9: shouldAddCustomCssToRenderedHtml

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldAddCustomCssToRenderedHtml(){
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    String customCssPath = Paths.get("").toAbsolutePath() + "/target/cukedoctor.css";
    FileUtil.copyFileFromClassPath("/cukedoctor-test.css", customCssPath);
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertThat(sampleHtml).isNotEmpty().
            containsOnlyOnce("<style> body #toctitle {    color: green;}body.book {    background: #444;}</style>");

}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:14,代码来源:StyleExtensionTest.java


示例10: shouldDisableStyleExtension

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldDisableStyleExtension(){
    System.setProperty(STYLE_DISABLE_EXT_KEY,"anyValue");
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertThat(sampleHtml).isNotEmpty().
            doesNotContain(".sidebarblock, .sectionbody, .content{overflow:auto!important;}");
}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:12,代码来源:StyleExtensionTest.java


示例11: shouldAddFooterToRenderedHtml

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldAddFooterToRenderedHtml(){
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    System.setProperty("cukedoctor.stopwatch",String.valueOf(System.currentTimeMillis()));
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertThat(sampleHtml.replaceAll("\n","").replace("\t","")).isNotEmpty().
            containsOnlyOnce("Generated by    <a href=\"https://github.com/rmpestano/cukedoctor\" target=\"_blank\"> Cukedoctor").
        containsOnlyOnce("Execution time: ");

}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:14,代码来源:FooterExtensionTest.java


示例12: shouldNotAddFooterToRenderedHtmlWhenExtensionDisabled

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldNotAddFooterToRenderedHtmlWhenExtensionDisabled(){
    System.setProperty(FOOTER_DISABLE_EXT_KEY,"anyValue");
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    System.setProperty("cukedoctor.stopwatch",String.valueOf(System.currentTimeMillis()));
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertThat(sampleHtml.replaceAll("\n","").replace("\t","")).isNotEmpty().
        doesNotContain("Generated by    <a href=\"https://github.com/rmpestano/cukedoctor\" target=\"_blank\"> Cukedoctor").
        doesNotContain("Execution time: ");
}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:14,代码来源:FooterExtensionTest.java


示例13: shouldAddSearchInputToRenderedHtml

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldAddSearchInputToRenderedHtml(){
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertNotNull(sampleHtml);
    assertThat(sampleHtml.replaceAll(" ","").replaceAll("\n", "").replaceAll("\t","")).
            containsOnlyOnce(removeSpecialChars("<span class=\"fa fa-minus-square fa-fw\" style=\"cursor:pointer;float:right;margin-top:-30px\"  title=\"Minimize\" onclick=\"hideFeatureScenarios('Sample-test');document.getElementById('hidden-Sample-test').style.display = 'inline';this.style.display = 'none'\">  </span>") +
                    removeSpecialChars("<span id=\"hidden-Sample-test\" class=\"fa fa-plus-square fa-fw\" style=\"cursor:pointer;float:right;display:none;margin-top:-30px\" title=\"Maximize feature\" onclick=\"showFeatureScenarios('Sample-test');this.style.display = 'none'\">  </span>"));

}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:14,代码来源:MinMaxExtensionTest.java


示例14: shouldNotAddMinMaxMacroToRenderedHtmlWhenExtensionDisabled

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldNotAddMinMaxMacroToRenderedHtmlWhenExtensionDisabled(){
    System.setProperty(MINMAX_DISABLE_EXT_KEY,"anyValue");
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertNotNull(sampleHtml);
    assertThat(sampleHtml).
        doesNotContain(removeSpecialChars("title=\"Maximize feature\""));

}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:14,代码来源:MinMaxExtensionTest.java


示例15: shouldAddThemesToRenderedHtml

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldAddThemesToRenderedHtml(){
    System.clearProperty(THEME_DISABLE_EXT_KEY);
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertThat(sampleHtml).isNotEmpty().
            containsOnlyOnce("<div name=\"themes\" id=\"themes\"");

}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:13,代码来源:ThemeExtensionTest.java


示例16: shouldNotAddThemeToRenderedHtmlWhenExtensionDisabled

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldNotAddThemeToRenderedHtmlWhenExtensionDisabled(){
    System.setProperty(THEME_DISABLE_EXT_KEY,"anyValue");
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertThat(sampleHtml).isNotEmpty().
        doesNotContain("<div name=\"themes\" id=\"themes\"");
}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:12,代码来源:ThemeExtensionTest.java


示例17: shouldAddScriptsToRenderedHtml

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldAddScriptsToRenderedHtml(){
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertThat(sampleHtml).isNotEmpty().
            containsOnlyOnce("searchFeature(criteria)").
            containsOnlyOnce("function showFeatureScenarios(featureId)").
            containsOnlyOnce("function themefy()");

}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:14,代码来源:ScriptsExtensionTest.java


示例18: shouldDisableThemeExtension

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldDisableThemeExtension(){
    System.setProperty(THEME_DISABLE_EXT_KEY,"anyValue");
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertThat(sampleHtml).isNotEmpty().
            containsOnlyOnce("searchFeature(criteria)").
            containsOnlyOnce("function showFeatureScenarios(featureId)").
            doesNotContain("function themefy()");
}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:14,代码来源:ScriptsExtensionTest.java


示例19: shouldDisableFilterExtension

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldDisableFilterExtension(){
    System.setProperty(FILTER_DISABLE_EXT_KEY,"anything");
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertThat(sampleHtml).isNotEmpty().
            doesNotContain("searchFeature(criteria)").
            containsOnlyOnce("function showFeatureScenarios(featureId)").
            containsOnlyOnce("function themefy()");
}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:14,代码来源:ScriptsExtensionTest.java


示例20: shouldDisableMinMaxExtension

import org.asciidoctor.SafeMode; //导入依赖的package包/类
@Test
public void shouldDisableMinMaxExtension(){
    System.setProperty(MINMAX_DISABLE_EXT_KEY,"any");
    File sampleAdoc = loadTestFile("sample.adoc");
    assertThat(sampleAdoc).exists();
    asciidoctor.convertFile(sampleAdoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).asMap());

    String sampleHtml = readFileContent(loadTestFile("sample.html"));
    assertThat(sampleHtml).isNotEmpty().
            containsOnlyOnce("searchFeature(criteria)").
            doesNotContain("function showFeatureScenarios(featureId)").
            containsOnlyOnce("function themefy()");
}
 
开发者ID:rmpestano,项目名称:cukedoctor,代码行数:14,代码来源:ScriptsExtensionTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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