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_missing_should_drop_line_should_drop_line_with_reference_to_missing_attribute_if_attribute_missing_attribute_is_drop_line() { Attributes attributes = attributes().attributeMissing("drop-line").get(); Options options = options().attributes(attributes).get(); String renderContent = asciidoctor.convert("This is\n" + "blah blah {foobarbaz}\n" + "all there is.", options); assertThat(renderContent, not(containsString("{foobarbaz}"))); }