示例#1
0
 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();
     options.setOption(name, guessTypeByContent(optionsSubset.getString(name)));
   }
   options.setBaseDir(context.getFile().getParentFile().getAbsolutePath());
   options.setSafe(UNSAFE);
   return options;
 }
 @Override
 public boolean matches(Object input) {
   Options options = (Options) input;
   return !inline
       || (options.map().get(Options.DOCTYPE).equals(AsciidoctorRenderer.INLINE_DOCTYPE));
 }