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 ) ; } }
Compiles Asciidoc files from the internal and external assets to HTML .