Skip to content

Commit

Permalink
Generate plug-in DITAVAL
Browse files Browse the repository at this point in the history
Signed-off-by: Jarno Elovirta <[email protected]>
  • Loading branch information
jelovirt committed Jul 2, 2020
1 parent aeacd2d commit 802c5b9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ samples/properties/template.properties

## Autogenerated files created by the build process
platform.ditaval
plugins.ditaval
error-messages.xml
extension-points/all-extension-points.dita
extension-points/extension-points-in-*.dita
Expand Down
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ String ditaHome = getPropertyOrDefault('ditaHome', projectDir.getParent())
String ditaHomeSrc = getPropertyOrDefault('ditaHomeSrc', ditaHome)
String configDir = "${ditaHomeSrc}/config"
String ditavalFile = "${projectDir}/platform.ditaval"
String pluginsDitavalFile = "${projectDir}/plugins.ditaval"
Boolean toolkitBuild = file("${projectDir}/../lib/dost.jar").exists()
String samplesDir = toolkitBuild ? "${ditaHome}/docsrc/samples" : "${projectDir}/samples"
String outputDir = getPropertyOrDefault('outputDir', toolkitBuild ? "${ditaHome}/doc" : "${projectDir}/out")
Expand Down Expand Up @@ -67,13 +68,19 @@ task generatePlatformFilter {
}
}

task generatePluginDitaval(type: SaxonXsltTask) {
input "${configDir}/plugins.xml"
output pluginsDitavalFile
stylesheet "${projectDir}/resources/plugins-ditaval.xsl"
}

task generatePropertiesTemplate(type: SaxonXsltTask) {
input "${configDir}/plugins.xml"
output "${samplesDir}/properties/template.properties"
stylesheet "${projectDir}/resources/properties-file.xsl"
}

task autoGenerate(dependsOn: [messages, params, extensionPoints, generatePlatformFilter, generatePropertiesTemplate]) {
task autoGenerate(dependsOn: [messages, params, extensionPoints, generatePlatformFilter, generatePluginDitaval, generatePropertiesTemplate]) {
description 'Run tasks that generate content from resource files and the build environment.'
}

Expand All @@ -92,6 +99,7 @@ task html(type: DitaOtTask, dependsOn: autoGenerate) {
output outputDir
transtype 'html5'
filter "${projectDir}/resources/html.ditaval"
filter pluginsDitavalFile

properties {
property(file: "${projectDir}/samples/properties/docs-build-html5.properties")
Expand All @@ -103,6 +111,7 @@ task htmlhelp(type: DitaOtTask, dependsOn: autoGenerate) {
output outputDir
transtype 'htmlhelp'
filter ditavalFile
filter pluginsDitavalFile

properties {
property(file: "${projectDir}/samples/properties/docs-build-htmlhelp.properties")
Expand Down Expand Up @@ -142,6 +151,7 @@ task site(type: DitaOtTask) {
input file("${projectDir}/site.ditamap")
output getPropertyOrDefault('outputDir', "${buildDir}/site")
filter "${projectDir}/resources/site.ditaval"
// filter pluginsDitavalFile

transtype 'org.dita-ot.html'

Expand Down
14 changes: 14 additions & 0 deletions resources/plugins-ditaval.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">

<xsl:template match="/">
<val>
<xsl:for-each select="plugins/plugin">
<prop action="include" att="plugin" val="{@id}"/>
</xsl:for-each>
<prop action="exclude" att="plugin"/>
</val>
</xsl:template>

</xsl:stylesheet>

0 comments on commit 802c5b9

Please sign in to comment.