本文整理汇总了Java中org.asciidoctor.OptionsBuilder.safe方法的典型用法代码示例。如果您正苦于以下问题:Java OptionsBuilder.safe方法的具体用法?Java OptionsBuilder.safe怎么用?Java OptionsBuilder.safe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.asciidoctor.OptionsBuilder
的用法示例。
在下文中一共展示了OptionsBuilder.safe方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateDocumentation
import org.asciidoctor.OptionsBuilder; //导入方法依赖的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());
}
示例2: execute
import org.asciidoctor.OptionsBuilder; //导入方法依赖的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;
}
示例3: parse
import org.asciidoctor.OptionsBuilder; //导入方法依赖的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();
}