本文整理汇总了Java中org.asciidoctor.Asciidoctor.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Java Asciidoctor.shutdown方法的具体用法?Java Asciidoctor.shutdown怎么用?Java Asciidoctor.shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.asciidoctor.Asciidoctor
的用法示例。
在下文中一共展示了Asciidoctor.shutdown方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.asciidoctor.Asciidoctor; //导入方法依赖的package包/类
private Runnable run(final List<Feature> features, final DocumentAttributes attrs, final String outputPath) {
return new Runnable() {
@Override
public void run() {
Asciidoctor asciidoctor = null;
try {
asciidoctor = Asciidoctor.Factory.create(CukedoctorPublisher.class.getClassLoader());
generateDocumentation(features, attrs, outputPath, asciidoctor);
} catch (Exception e) {
logger.println(String.format("Unexpected error on documentation generation, message %s, cause %s", e.getMessage(), e.getCause()));
e.printStackTrace();
} finally {
if (asciidoctor != null) {
asciidoctor.shutdown();
}
}
}
};
}
示例2: runAll
import org.asciidoctor.Asciidoctor; //导入方法依赖的package包/类
/**
* generates html and pdf documentation 'inlined' otherwise if we execute them in separated threads
* only the last thread content is rendered (cause they work on the same adoc file)
*
* @return
*/
private Runnable runAll(final List<Feature> features, final DocumentAttributes attrs, final String outputPath) {
return new Runnable() {
@Override
public void run() {
Asciidoctor asciidoctor = null;
try {
/*
* this throws: ERROR: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- jruby/java
* asciidoctor = Asciidoctor.Factory.create();
*/
asciidoctor = Asciidoctor.Factory.create(CukedoctorPublisher.class.getClassLoader());
attrs.backend("html5");
generateDocumentation(features, attrs, outputPath, asciidoctor);
attrs.backend("pdf");
generateDocumentation(features, attrs, outputPath, asciidoctor);
} catch (Exception e) {
logger.println(String.format("Unexpected error on documentation generation, message %s, cause %s", e.getMessage(), e.getCause()));
e.printStackTrace();
} finally {
if (asciidoctor != null) {
asciidoctor.shutdown();
}
}
}
};
}
示例3: get
import org.asciidoctor.Asciidoctor; //导入方法依赖的package包/类
@GET
@Produces(MediaType.TEXT_HTML)
public String get() {
Asciidoctor asciidoctor = Asciidoctor.Factory.create();
try {
return asciidoctor.render("Hello World\n-----------", Collections.emptyMap());
} finally {
asciidoctor.shutdown();
}
}
示例4: execute
import org.asciidoctor.Asciidoctor; //导入方法依赖的package包/类
public String execute(List<Feature> features, DocumentAttributes attrs, String outputName) {
if (title == null) {
title = "Living Documentation";
}
if (attrs == null) {
attrs = new DocumentAttributes().docTitle(title);
}
if (!hasText(attrs.getBackend())) {
attrs.backend("html5");
}
if (outputName == null) {
outputName = title.replaceAll(" ", "_");
}
if (hideFeaturesSection != null) {
System.setProperty("HIDE_FEATURES_SECTION", Boolean.toString(hideFeaturesSection));
}
if (hideSummarySection != null) {
System.setProperty("HIDE_SUMMARY_SECTION", Boolean.toString(hideSummarySection));
}
if (hideScenarioKeyword != null) {
System.setProperty("HIDE_SCENARIO_KEYWORD", Boolean.toString(hideScenarioKeyword));
}
if (hideStepTime != null) {
System.setProperty("HIDE_STEP_TIME", Boolean.toString(hideStepTime));
}
if (hideTags != null) {
System.setProperty("HIDE_TAGS", Boolean.toString(hideTags));
}
CukedoctorConverter converter = Cukedoctor.instance(features, attrs);
String doc = converter.renderDocumentation();
File adocFile = FileUtil.saveFile(outputName, doc);
Asciidoctor asciidoctor = Asciidoctor.Factory.create();
if (attrs.getBackend().equalsIgnoreCase("pdf")) {
asciidoctor.unregisterAllExtensions();
}
OptionsBuilder ob;
ob = OptionsBuilder.options().backend(attrs.getBackend());
ob.safe(SafeMode.UNSAFE);
if (allowUriRead != null && allowUriRead) {
Attributes attr = new Attributes();
attr.setAllowUriRead(true);
ob.attributes(attr);
}
asciidoctor.convertFile(adocFile, ob.asMap());
asciidoctor.shutdown();
return doc;
}