Purpose
The Substitution library is created as an alternative of existing template engines. It is used for generation of static files. It doesn't depend on template format, so it can be used with txt, markdown and other text formats.
How does it work
Let's assume that there are two folders, source and target. The source folder contains the template named template.txt, see the following example TODO Kyrylo Semenko.
The template.text file contains a placeholder that looks like
{{ { "className": "com.credibledoc.substitution.example.HelloWorldContentGenerator" } }}
The placeholder defines className. The class generates the placeholder content. The content is placed to the template.txt. The file is saved to the target folder.
The described behavior can be drawn as a diagram:
&&beginPlaceholder { "className": "com.credibledoc.substitution.doc.module.substitution.launching.LaunchingUmlReportService", "description": "Simple diagram of a substitution behavior.", "parameters": {"sourceFileRelativePath": "substitution/substitution-reporting/log/substitution-reporting.log"} } &&endPlaceholder
Content substitution modules
The tool contains three modules
The substitution-core module doesn't depend on the substitution-reporting and substitution-generators modules.
&&beginPlaceholder {
"className": "com.credibledoc.substitution.content.generator.dependency.PackageDependenciesContentGenerator",
"description": "UML diagram with dependencies of the `substitution-core` module on classes from the `substitution-reporting` module.",
"parameters": {
"sourceRelativePathsPipeSeparated": "substitution/substitution-reporting/src/main/java",
"dependantPackage": "com.credibledoc.substitution.core",
"dependenciesPackagesPipeSeparated": "com.credibledoc.substitution.reporting|com.credibledoc.substitution.content.generator",
"ignoreInnerPackages": "true",
"targetFormat": "HTML_EMBEDDED"
}
} &&endPlaceholder
The substitution-reporting module depends on the substitution-core module, see the following dependencies diagram. &&beginPlaceholder { "className": "com.credibledoc.substitution.content.generator.dependency.PackageDependenciesContentGenerator", "description": "UML diagram with dependencies of the `substitution-reporting` module on classes from the `substitution-core` module.", "parameters": { "sourceRelativePathsPipeSeparated": "substitution/substitution-reporting/src/main/java|substitution/substitution-core/src/main/java", "dependantPackage": "com.credibledoc.substitution.reporting", "dependenciesPackagesPipeSeparated": "com.credibledoc.substitution.core", "ignoreInnerPackages": "true", "targetFormat": "HTML_EMBEDDED" } } &&endPlaceholder
And the substitution-generators module depends on the substitution-core and substitution-reporting modules, see the following dependencies diagram.
&&beginPlaceholder {
"className": "com.credibledoc.substitution.content.generator.dependency.PackageDependenciesContentGenerator",
"description": "UML diagram with dependencies of the `substitution-generators` module on classes from the `substitution-core` and 'substitution-reporting' modules.",
"parameters": {
"sourceRelativePathsPipeSeparated": "substitution/substitution-reporting/src/main/java",
"dependantPackage": "com.credibledoc.substitution.content",
"dependenciesPackagesPipeSeparated": "com.credibledoc.substitution.core",
"ignoreInnerPackages": "true",
"targetFormat": "HTML_EMBEDDED"
}
} &&endPlaceholder