protected void setAttributesOnBuilder(AttributesBuilder attributesBuilder) throws MojoExecutionException { if (sourceHighlighter != null) { attributesBuilder.sourceHighlighter(sourceHighlighter); } if (embedAssets) { attributesBuilder.linkCss(false); attributesBuilder.dataUri(true); } if (imagesDir != null) { attributesBuilder.imagesDir(imagesDir); } if ("skip".equals(attributeMissing) || "drop".equals(attributeMissing) || "drop-line".equals(attributeMissing)) { attributesBuilder.attributeMissing(attributeMissing); } else { throw new MojoExecutionException(attributeMissing + " is not valid. Must be one of 'skip', 'drop' or 'drop-line'"); } if ("drop".equals(attributeUndefined) || "drop-line".equals(attributeUndefined)) { attributesBuilder.attributeUndefined(attributeUndefined); } else { throw new MojoExecutionException(attributeUndefined + " is not valid. Must be one of 'drop' or 'drop-line'"); } AsciidoctorHelper.addAttributes(attributes, attributesBuilder); if (!attributesChain.isEmpty()) { getLog().info("Attributes: " + attributesChain); attributesBuilder.arguments(attributesChain); } }
AttributesBuilder.attributes().attributeMissing("skip").attributeUndefined("drop"); if (attributes == null) { configureDefaultsAttributes(workDir, log, backend, attrs, emptyMap());
@Test public void attribute_undefined_should_not_drop_line_with_attribute_unassignment_if_attribute_undefined_is_drop() { Attributes attributes = attributes().attributeUndefined("drop").get(); Options options = options().attributes(attributes).get(); String renderContent = asciidoctor.convert(":foo:\n\n{set:foo!}\n{foo}yes", options); Document doc = Jsoup.parse(renderContent, "UTF-8"); Element paragraph = doc.getElementsByTag("p").first(); assertThat(paragraph.text(), is("{foo}yes")); }