@Override protected void doParse(RuleSource source, RuleSetBuilder ruleSetBuilder) throws RuleException { String content; try (InputStream stream = source.getInputStream()) { content = IOUtils.toString(stream); } catch (IOException e) { throw new RuleException("Cannot parse AsciiDoc document from " + source.getId(), e); } OptionsBuilder optionsBuilder = options().mkDirs(true).safe(SafeMode.UNSAFE).baseDir(tempDir) .attributes(attributes().attribute(AsciidoctorFactory.ATTRIBUTE_IMAGES_OUT_DIR, tempDir.getAbsolutePath()).experimental(true)); getAsciidoctor().load(content, optionsBuilder.asMap()); extractRules(source, singletonList(treeprocessor.getDocument()), ruleSetBuilder); }
@Test public void experimental_flag_should_enable_experimental_features_like_keyboard_shortcuts() { Attributes attributes = attributes().experimental(true).get(); Options options = options().attributes(attributes).get(); String content = asciidoctor.convert("kbd:[F11]", options); Document doc = Jsoup.parse(content); Elements image = doc.select("kbd"); assertThat(image.text(), is("F11")); }