@Test public void testInitializationWithFilteredInternalAndExternalFilesUsingRegularExtensions() throws MojoExecutionException, IOException { AsciidocMojo mojo = new AsciidocMojo(); mojo.basedir = basedir; mojo.buildDirectory = new File(mojo.basedir, "target"); mojo.doctype = "article"; mojo.backend = "html5"; FileUtils.copyFile(new File("src/test/resources/hello.ad"), new File(basedir, "src/main/resources/assets/doc/hello.ad")); FileUtils.copyFile(new File("src/test/resources/hello.ad"), new File(basedir, "target/classes/assets/doc/hello.ad")); FileUtils.copyFile(new File("src/test/resources/hello.ad"), new File(basedir, "src/main/assets/doc/hello.asciidoc")); FileUtils.copyFile(new File("src/test/resources/hello.ad"), new File(basedir, "target/wisdom/assets/doc/hello.asciidoc")); mojo.execute(); final File internal = new File(mojo.getInternalAssetOutputDirectory(), "doc/hello.html"); final File external = new File(mojo.getExternalAssetsOutputDirectory(), "doc/hello.html"); assertThat(internal).isFile(); assertThat(external).isFile(); assertThat(FileUtils.readFileToString(internal)).contains("<h1>Hello, " + "Wisdom!</h1>").contains("href=\"http: assertThat(FileUtils.readFileToString(external)).contains("<h1>Hello, " + "Wisdom!</h1>").contains("href=\"http: }
public void execute() throws MojoExecutionException { if (! watch) { removeFromWatching(); } if (extensions == null || extensions.isEmpty()) { extensions = ImmutableList.of("ad", "asciidoc", "adoc"); } if (instance == null) { instance = getAsciidoctorInstance(); } final OptionsBuilder optionsBuilderExternals = OptionsBuilder.options().compact(compact) .safe(SafeMode.UNSAFE).eruby(eruby).backend(backend).docType(doctype).headerFooter(headerFooter).inPlace(true); final OptionsBuilder optionsBuilderInternals = OptionsBuilder.options().compact(compact) .safe(SafeMode.UNSAFE).eruby(eruby).backend(backend).docType(doctype).headerFooter(headerFooter).inPlace(true); if (templateEngine != null) { optionsBuilderExternals.templateEngine(templateEngine); optionsBuilderInternals.templateEngine(templateEngine); } if (templateDir != null) { optionsBuilderExternals.templateDir(templateDir); optionsBuilderInternals.templateDir(templateDir); } if (sourceHighlighter != null) { attributes.put("source-highlighter", sourceHighlighter); } if (embedAssets) { attributes.put("linkcss!", true); attributes.put("data-uri", true); } if (imagesDir != null) { attributes.put("imagesdir", imagesDir); } if (stylesheet != null) { attributes.put(Attributes.STYLESHEET_NAME, stylesheet); attributes.put(Attributes.LINK_CSS, true); } if (stylesheetDir != null) { attributes.put(Attributes.STYLES_DIR, stylesheetDir); } optionsBuilderExternals.attributes(attributes); optionsBuilderInternals.attributes(attributes); IOFileFilter filter = null; if (includes != null && includes.length != 0) { filter = new WildcardFileFilter(includes); if (excludes != null && excludes.length != 0) { filter = new AndFileFilter(filter, new NotFileFilter(new WildcardFileFilter(excludes))); } } try { for (File file : getResources(extensions)) { if (filter == null || filter.accept(file)) { renderFile(optionsBuilderExternals.asMap(), file); } } } catch (IOException e) { throw new MojoExecutionException("Error while compiling AsciiDoc file", e); } }
AsciidocMojo extends AbstractWisdomWatcherMojo implements Constants { public void execute() throws MojoExecutionException { if (! watch) { removeFromWatching(); } if (extensions == null || extensions.isEmpty()) { extensions = ImmutableList.of("ad", "asciidoc", "adoc"); } if (instance == null) { instance = getAsciidoctorInstance(); } final OptionsBuilder optionsBuilderExternals = OptionsBuilder.options().compact(compact) .safe(SafeMode.UNSAFE).eruby(eruby).backend(backend).docType(doctype).headerFooter(headerFooter).inPlace(true); final OptionsBuilder optionsBuilderInternals = OptionsBuilder.options().compact(compact) .safe(SafeMode.UNSAFE).eruby(eruby).backend(backend).docType(doctype).headerFooter(headerFooter).inPlace(true); if (templateEngine != null) { optionsBuilderExternals.templateEngine(templateEngine); optionsBuilderInternals.templateEngine(templateEngine); } if (templateDir != null) { optionsBuilderExternals.templateDir(templateDir); optionsBuilderInternals.templateDir(templateDir); } if (sourceHighlighter != null) { attributes.put("source-highlighter", sourceHighlighter); } if (embedAssets) { attributes.put("linkcss!", true); attributes.put("data-uri", true); } if (imagesDir != null) { attributes.put("imagesdir", imagesDir); } if (stylesheet != null) { attributes.put(Attributes.STYLESHEET_NAME, stylesheet); attributes.put(Attributes.LINK_CSS, true); } if (stylesheetDir != null) { attributes.put(Attributes.STYLES_DIR, stylesheetDir); } optionsBuilderExternals.attributes(attributes); optionsBuilderInternals.attributes(attributes); IOFileFilter filter = null; if (includes != null && includes.length != 0) { filter = new WildcardFileFilter(includes); if (excludes != null && excludes.length != 0) { filter = new AndFileFilter(filter, new NotFileFilter(new WildcardFileFilter(excludes))); } } try { for (File file : getResources(extensions)) { if (filter == null || filter.accept(file)) { renderFile(optionsBuilderExternals.asMap(), file); } } } catch (IOException e) { throw new MojoExecutionException("Error while compiling AsciiDoc file", e); } } }
AsciidocMojo extends AbstractWisdomWatcherMojo implements Constants { public void execute() throws MojoExecutionException { if (! watch) { removeFromWatching(); } if (extensions == null || extensions.isEmpty()) { extensions = ImmutableList.of("ad", "asciidoc", "adoc"); } if (instance == null) { instance = getAsciidoctorInstance(); } final OptionsBuilder optionsBuilderExternals = OptionsBuilder.options().compact(compact) .safe(SafeMode.UNSAFE).eruby(eruby).backend(backend).docType(doctype).headerFooter(headerFooter).inPlace(true); final OptionsBuilder optionsBuilderInternals = OptionsBuilder.options().compact(compact) .safe(SafeMode.UNSAFE).eruby(eruby).backend(backend).docType(doctype).headerFooter(headerFooter).inPlace(true); if (templateEngine != null) { optionsBuilderExternals.templateEngine(templateEngine); optionsBuilderInternals.templateEngine(templateEngine); } if (templateDir != null) { optionsBuilderExternals.templateDir(templateDir); optionsBuilderInternals.templateDir(templateDir); } if (sourceHighlighter != null) { attributes.put("source-highlighter", sourceHighlighter); } if (embedAssets) { attributes.put("linkcss!", true); attributes.put("data-uri", true); } if (imagesDir != null) { attributes.put("imagesdir", imagesDir); } if (stylesheet != null) { attributes.put(Attributes.STYLESHEET_NAME, stylesheet); attributes.put(Attributes.LINK_CSS, true); } if (stylesheetDir != null) { attributes.put(Attributes.STYLES_DIR, stylesheetDir); } optionsBuilderExternals.attributes(attributes); optionsBuilderInternals.attributes(attributes); IOFileFilter filter = null; if (includes != null && includes.length != 0) { filter = new WildcardFileFilter(includes); if (excludes != null && excludes.length != 0) { filter = new AndFileFilter(filter, new NotFileFilter(new WildcardFileFilter(excludes))); } } try { for (File file : getResources(extensions)) { if (filter == null || filter.accept(file)) { renderFile(optionsBuilderExternals.asMap(), file); } } } catch (IOException e) { throw new MojoExecutionException("Error while compiling AsciiDoc file", e); } }  }
AsciidocMojo extends AbstractWisdomWatcherMojo implements Constants { public void execute() throws MojoExecutionException { if (! watch) { removeFromWatching(); } if (extensions == null || extensions.isEmpty()) { extensions = ImmutableList.of("ad", "asciidoc", "adoc"); } if (instance == null) { instance = getAsciidoctorInstance(); } final OptionsBuilder optionsBuilderExternals = OptionsBuilder.options().compact(compact) .safe(SafeMode.UNSAFE).eruby(eruby).backend(backend).docType(doctype).headerFooter(headerFooter).inPlace(true); final OptionsBuilder optionsBuilderInternals = OptionsBuilder.options().compact(compact) .safe(SafeMode.UNSAFE).eruby(eruby).backend(backend).docType(doctype).headerFooter(headerFooter).inPlace(true); if (templateEngine != null) { optionsBuilderExternals.templateEngine(templateEngine); optionsBuilderInternals.templateEngine(templateEngine); } if (templateDir != null) { optionsBuilderExternals.templateDir(templateDir); optionsBuilderInternals.templateDir(templateDir); } if (sourceHighlighter != null) { attributes.put("source-highlighter", sourceHighlighter); } if (embedAssets) { attributes.put("linkcss!", true); attributes.put("data-uri", true); } if (imagesDir != null) { attributes.put("imagesdir", imagesDir); } if (stylesheet != null) { attributes.put(Attributes.STYLESHEET_NAME, stylesheet); attributes.put(Attributes.LINK_CSS, true); } if (stylesheetDir != null) { attributes.put(Attributes.STYLES_DIR, stylesheetDir); } optionsBuilderExternals.attributes(attributes); optionsBuilderInternals.attributes(attributes); IOFileFilter filter = null; if (includes != null && includes.length != 0) { filter = new WildcardFileFilter(includes); if (excludes != null && excludes.length != 0) { filter = new AndFileFilter(filter, new NotFileFilter(new WildcardFileFilter(excludes))); } } try { for (File file : getResources(extensions)) { if (filter == null || filter.accept(file)) { renderFile(optionsBuilderExternals.asMap(), file); } } } catch (IOException e) { throw new MojoExecutionException("Error while compiling AsciiDoc file", e); } }  void execute(); @Override boolean accept(File file); @Override boolean fileCreated(File file); @Override boolean fileUpdated(File file); @Override boolean fileDeleted(File file); }
AsciidocMojo extends AbstractWisdomWatcherMojo implements Constants { public void execute() throws MojoExecutionException { if (! watch) { removeFromWatching(); } if (extensions == null || extensions.isEmpty()) { extensions = ImmutableList.of("ad", "asciidoc", "adoc"); } if (instance == null) { instance = getAsciidoctorInstance(); } final OptionsBuilder optionsBuilderExternals = OptionsBuilder.options().compact(compact) .safe(SafeMode.UNSAFE).eruby(eruby).backend(backend).docType(doctype).headerFooter(headerFooter).inPlace(true); final OptionsBuilder optionsBuilderInternals = OptionsBuilder.options().compact(compact) .safe(SafeMode.UNSAFE).eruby(eruby).backend(backend).docType(doctype).headerFooter(headerFooter).inPlace(true); if (templateEngine != null) { optionsBuilderExternals.templateEngine(templateEngine); optionsBuilderInternals.templateEngine(templateEngine); } if (templateDir != null) { optionsBuilderExternals.templateDir(templateDir); optionsBuilderInternals.templateDir(templateDir); } if (sourceHighlighter != null) { attributes.put("source-highlighter", sourceHighlighter); } if (embedAssets) { attributes.put("linkcss!", true); attributes.put("data-uri", true); } if (imagesDir != null) { attributes.put("imagesdir", imagesDir); } if (stylesheet != null) { attributes.put(Attributes.STYLESHEET_NAME, stylesheet); attributes.put(Attributes.LINK_CSS, true); } if (stylesheetDir != null) { attributes.put(Attributes.STYLES_DIR, stylesheetDir); } optionsBuilderExternals.attributes(attributes); optionsBuilderInternals.attributes(attributes); IOFileFilter filter = null; if (includes != null && includes.length != 0) { filter = new WildcardFileFilter(includes); if (excludes != null && excludes.length != 0) { filter = new AndFileFilter(filter, new NotFileFilter(new WildcardFileFilter(excludes))); } } try { for (File file : getResources(extensions)) { if (filter == null || filter.accept(file)) { renderFile(optionsBuilderExternals.asMap(), file); } } } catch (IOException e) { throw new MojoExecutionException("Error while compiling AsciiDoc file", e); } }  void execute(); @Override boolean accept(File file); @Override boolean fileCreated(File file); @Override boolean fileUpdated(File file); @Override boolean fileDeleted(File file);  }