Skip to content

Generate DITAVAL based on installed plug-ins #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>