AsciiDocCompiler.java

1
package pro.verron.officestamper.asciidoc;
2
3
import javafx.scene.Scene;
4
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
5
6
/// Facade utilities to parse AsciiDoc and compile it to different targets.
7
public final class AsciiDocCompiler {
8
9
    static {
10
        System.setProperty("jruby.compat.version", "RUBY1_9");
11
        System.setProperty("jruby.compile.mode", "OFF");
12
    }
13
    private AsciiDocCompiler() {
14
15
    }
16
17
    /// Compiles the AsciiDoc source text directly to a WordprocessingMLPackage.
18
    ///
19
    /// @param asciidoc source text
20
    ///
21
    /// @return package with rendered content
22
    public static WordprocessingMLPackage toDocx(String asciidoc) {
23 1 1. toDocx : replaced return value with null for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toDocx → NO_COVERAGE
        return toDocx(toAsciiModel(asciidoc));
24
    }
25
26
    /// Compiles the parsed model to a WordprocessingMLPackage.
27
    ///
28
    /// @param model parsed model
29
    ///
30
    /// @return package with rendered content
31
    public static WordprocessingMLPackage toDocx(AsciiDocModel model) {
32 1 1. toDocx : replaced return value with null for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toDocx → NO_COVERAGE
        return AsciiDocToDocx.compileToPackage(model);
33
    }
34
35
    /// Parses AsciiDoc source text into an [AsciiDocModel].
36
    ///
37
    /// @param asciidoc source text
38
    ///
39
    /// @return parsed model
40
    public static AsciiDocModel toAsciiModel(String asciidoc) {
41 1 1. toAsciiModel : replaced return value with null for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toAsciiModel → NO_COVERAGE
        return AsciiDocParser.parse(asciidoc);
42
    }
43
44
    /// Compiles the AsciiDoc source text directly to a JavaFX Scene.
45
    ///
46
    /// @param asciidoc source text
47
    ///
48
    /// @return scene with rendered content
49
    public static Scene toScene(String asciidoc) {
50 1 1. toScene : replaced return value with null for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toScene → NO_COVERAGE
        return toScene(toAsciiModel(asciidoc));
51
    }
52
53
    /// Compiles the parsed model to a JavaFX Scene.
54
    ///
55
    /// @param model parsed model
56
    ///
57
    /// @return scene with rendered content
58
    public static Scene toScene(AsciiDocModel model) {
59 1 1. toScene : replaced return value with null for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toScene → NO_COVERAGE
        return AsciiDocToFx.compileToScene(model);
60
    }
61
62
    /// Compiles a WordprocessingMLPackage into the textual AsciiDoc representation used by tests. This mirrors the
63
    /// legacy Stringifier output to preserve expectations.
64
    ///
65
    /// @param pkg a Word document package
66
    ///
67
    /// @return textual representation
68
    public static String toAsciiDoc(WordprocessingMLPackage pkg) {
69 1 1. toAsciiDoc : replaced return value with "" for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toAsciiDoc → NO_COVERAGE
        return DocxToAsciiDoc.compile(pkg, AsciiDocDialect.COMPAT);
70
    }
71
72
    /// Compiles a WordprocessingMLPackage into AsciiDoc using the specified dialect.
73
    ///
74
    /// @param pkg a Word document package
75
    /// @param dialect output dialect (compat or adoc)
76
    ///
77
    /// @return textual representation
78
    public static String toAsciiDoc(WordprocessingMLPackage pkg, AsciiDocDialect dialect) {
79 1 1. toAsciiDoc : replaced return value with "" for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toAsciiDoc → NO_COVERAGE
        return DocxToAsciiDoc.compile(pkg, dialect);
80
    }
81
}

Mutations

23

1.1
Location : toDocx
Killed by : none
replaced return value with null for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toDocx → NO_COVERAGE

32

1.1
Location : toDocx
Killed by : none
replaced return value with null for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toDocx → NO_COVERAGE

41

1.1
Location : toAsciiModel
Killed by : none
replaced return value with null for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toAsciiModel → NO_COVERAGE

50

1.1
Location : toScene
Killed by : none
replaced return value with null for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toScene → NO_COVERAGE

59

1.1
Location : toScene
Killed by : none
replaced return value with null for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toScene → NO_COVERAGE

69

1.1
Location : toAsciiDoc
Killed by : none
replaced return value with "" for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toAsciiDoc → NO_COVERAGE

79

1.1
Location : toAsciiDoc
Killed by : none
replaced return value with "" for pro/verron/officestamper/asciidoc/AsciiDocCompiler::toAsciiDoc → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.22.0