本文整理了Java中org.asciidoctor.Options.setSafe()
方法的一些代码示例,展示了Options.setSafe()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Options.setSafe()
方法的具体详情如下:
包路径:org.asciidoctor.Options
类名称:Options
方法名:setSafe
[英]Safe method calls safeMode.getLevel() to put the required level.
[中]Safe方法调用safeMode。getLevel()来设置所需的级别。
代码示例来源:origin: jbake-org/jbake
private Options getAsciiDocOptionsAndAttributes(ParserContext context) {
JBakeConfiguration config = context.getConfig();
List<String> asciidoctorAttributes = config.getAsciidoctorAttributes();
final AttributesBuilder attributes = attributes(asciidoctorAttributes.toArray(new String[asciidoctorAttributes.size()]));
if (config.getExportAsciidoctorAttributes()) {
final String prefix = config.getAttributesExportPrefixForAsciidoctor();
for (final Iterator<String> it = config.getKeys(); it.hasNext(); ) {
final String key = it.next();
if (!key.startsWith("asciidoctor")) {
attributes.attribute(prefix + key.replace(".", "_"), config.get(key));
}
}
}
final List<String> optionsSubset = config.getAsciidoctorOptionKeys();
final Options options = options().attributes(attributes.get()).get();
for (final String optionKey : optionsSubset) {
Object optionValue = config.getAsciidoctorOption(optionKey);
if (optionKey.equals(Options.TEMPLATE_DIRS)) {
List<String> dirs = getAsList(optionValue);
if (!dirs.isEmpty()) {
options.setTemplateDirs(String.valueOf(dirs));
}
} else {
options.setOption(optionKey, optionValue);
}
}
options.setBaseDir(context.getFile().getParentFile().getAbsolutePath());
options.setSafe(UNSAFE);
return options;
}
代码示例来源:origin: org.asciidoctor/asciidoctor-java-integration
/**
* Sets the safe mode.
* @param safeMode to run asciidoctor.
* @return this instance.
*/
public OptionsBuilder safe(SafeMode safeMode) {
this.options.setSafe(safeMode);
return this;
}
代码示例来源:origin: org.asciidoctor/asciidoctorj-api
/**
* Sets the safe mode.
*
* @param safeMode
* to run asciidoctor.
* @return this instance.
*/
public OptionsBuilder safe(SafeMode safeMode) {
this.options.setSafe(safeMode);
return this;
}
代码示例来源:origin: asciidoctor/asciidoctorj
/**
* Sets the safe mode.
*
* @param safeMode
* to run asciidoctor.
* @return this instance.
*/
public OptionsBuilder safe(SafeMode safeMode) {
this.options.setSafe(safeMode);
return this;
}
代码示例来源:origin: de.elnarion.util/docconverter-adoc2adoc
private List<InputStream> convertToInputStreams(List<File> source)
throws IOException {
List<InputStream> inputStreams = new ArrayList<>();
Asciidoctor asciidoctor = Factory.create();
ExtensionGroup group = asciidoctor.createGroup();
Preprocessor preprocessor = new Preprocessor();
group.preprocessor(preprocessor);
Options options = new Options();
options.setToFile(false);
options.setSafe(SafeMode.UNSAFE);
group.register();
for (File file : source) {
inputStreams.add(processSingleFile(file, asciidoctor, group, preprocessor, options));
}
return inputStreams;
}
代码示例来源:origin: org.jbake/jbake-core
private Options getAsciiDocOptionsAndAttributes(ParserContext context) {
JBakeConfiguration config = context.getConfig();
List<String> asciidoctorAttributes = config.getAsciidoctorAttributes();
final AttributesBuilder attributes = attributes(asciidoctorAttributes.toArray(new String[asciidoctorAttributes.size()]));
if (config.getExportAsciidoctorAttributes()) {
final String prefix = config.getAttributesExportPrefixForAsciidoctor();
for (final Iterator<String> it = config.getKeys(); it.hasNext(); ) {
final String key = it.next();
if (!key.startsWith("asciidoctor")) {
attributes.attribute(prefix + key.replace(".", "_"), config.get(key));
}
}
}
final List<String> optionsSubset = config.getAsciidoctorOptionKeys();
final Options options = options().attributes(attributes.get()).get();
for (final String optionKey : optionsSubset) {
Object optionValue = config.getAsciidoctorOption(optionKey);
if (optionKey.equals(Options.TEMPLATE_DIRS)) {
List<String> dirs = getAsList(optionValue);
if (!dirs.isEmpty()) {
options.setTemplateDirs(String.valueOf(dirs));
}
} else {
options.setOption(optionKey, optionValue);
}
}
options.setBaseDir(context.getFile().getParentFile().getAbsolutePath());
options.setSafe(UNSAFE);
return options;
}
代码示例来源:origin: com.qwazr/qwazr-library-asciidoctor
options.setDocType(doctype);
if (safe != null)
options.setSafe(safe);
if (header_footer != null)
options.setHeaderFooter(header_footer);
内容来源于网络,如有侵权,请联系作者删除!