Class AsciiDocCompiler
java.lang.Object
pro.verron.asciidoc.compiler.AsciiDocCompiler
Facade utilities to parse AsciiDoc and compile it to different targets.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidsaveSvgAsImage(String svg, Path path) Saves the given SVG document as a PNG image file.static voidsaveSvgAsImage(String svg, Path path, int dpi, Color background) Saves the given SVG document as a PNG image file with specific DPI and background color.static StringtoAsciidoc(org.docx4j.openpackaging.packages.WordprocessingMLPackage pkg) Compiles a WordprocessingMLPackage into the textual AsciiDoc representation used by tests.static StringtoAsciidoc(org.docx4j.openpackaging.packages.WordprocessingMLPackage pkg, boolean skipComments) Converts the given WordprocessingMLPackage into its textual AsciiDoc representation.static StringtoAsciidoc(AsciiDocModel model) Converts the given AsciiDoc model into its textual AsciiDoc representation.static StringtoAsciidoc(AsciiDocModel model, boolean skipComments) Converts the given AsciiDoc model into its textual AsciiDoc representation.static org.docx4j.openpackaging.packages.WordprocessingMLPackageCompiles the AsciiDoc source text directly to a WordprocessingMLPackage.static org.docx4j.openpackaging.packages.WordprocessingMLPackagetoDocx(AsciiDocModel model) Compiles the parsed model to a WordprocessingMLPackage.static StringCompiles the AsciiDoc source text directly to HTML.static StringtoHtml(AsciiDocModel model) Compiles the parsed model to HTML.static voidSaves the AsciiDoc source text directly to a PNG image file.static AsciiDocModelParses AsciiDoc source text into anAsciiDocModel.static AsciiDocModeltoModel(org.docx4j.openpackaging.packages.WordprocessingMLPackage pkg) Parses a Word document into anAsciiDocModel.static StringtoSvg(InputStream input) Reads AsciiDoc source from an input stream and compiles it to SVG.static StringCompiles the AsciiDoc source text directly to an SVG document.static StringtoSvg(AsciiDocModel model) Compiles the parsed model to an SVG document.
-
Method Details
-
toDocx
Compiles the AsciiDoc source text directly to a WordprocessingMLPackage.- Parameters:
asciidoc- source text- Returns:
- package with rendered content
-
toDocx
Compiles the parsed model to a WordprocessingMLPackage.- Parameters:
model- parsed model- Returns:
- package with rendered content
-
toModel
Parses AsciiDoc source text into anAsciiDocModel.- Parameters:
asciidoc- source text- Returns:
- parsed model
-
toSvg
Compiles the parsed model to an SVG document.- Parameters:
model- parsed model- Returns:
- SVG representation
-
toHtml
-
toHtml
Compiles the parsed model to HTML.- Parameters:
model- parsed model- Returns:
- HTML representation
-
toAsciidoc
Compiles a WordprocessingMLPackage into the textual AsciiDoc representation used by tests. This mirrors the legacy Stringifier output to preserve expectations.- Parameters:
pkg- a Word document package- Returns:
- textual representation
-
toAsciidoc
public static String toAsciidoc(org.docx4j.openpackaging.packages.WordprocessingMLPackage pkg, boolean skipComments) Converts the given WordprocessingMLPackage into its textual AsciiDoc representation.- Parameters:
pkg- a Word document packageskipComments- whether to omit comments from the output- Returns:
- the textual AsciiDoc representation of the Word document package
-
toModel
Parses a Word document into anAsciiDocModel.- Parameters:
pkg- a Word document package- Returns:
- parsed model
-
toAsciidoc
Converts the given AsciiDoc model into its textual AsciiDoc representation.- Parameters:
model- the parsed AsciiDoc model to be convertedskipComments- whether to omit comments from the output- Returns:
- the textual AsciiDoc representation of the model
-
toAsciidoc
Converts the given AsciiDoc model into its textual AsciiDoc representation.- Parameters:
model- the parsed AsciiDoc model to be converted- Returns:
- the textual AsciiDoc representation of the model
-
toSvg
Reads AsciiDoc source from an input stream and compiles it to SVG.- Parameters:
input- source stream- Returns:
- SVG representation
-
toSvg
-
toImage
-
saveSvgAsImage
-
saveSvgAsImage
Saves the given SVG document as a PNG image file with specific DPI and background color.- Parameters:
svg- SVG sourcepath- path to save the imagedpi- dots per inchbackground- background color (null for transparent)
-