This is an abstract base DITA-OT Plug-in to extend HTML processing and allow
additional plug-ins to add an extra CSS stylesheet to the <header>
of each HTML page. By default the plug-in does
nothing appart from creating a temporary file extend.css.file
- it is designed to be extended so other plugins can add
CSS to the blank file.
It offers three extension-points for further CSS processing.
Table of Contents
The DITA-OT Extended CSS plug-in has been tested against DITA-OT 3.x. It is recommended that you upgrade to the latest version.
The DITA-OT Extended CSS plug-in is an extension for the DITA Open Toolkit.
-
Full installation instructions for downloading DITA-OT can be found here.
- Download the
dita-ot-4.2.zip
package from the project website at dita-ot.org/download - Extract the contents of the package to the directory where you want to install DITA-OT.
- Optional: Add the absolute path for the
bin
directory to the PATH system variable.
This defines the necessary environment variable to run the
dita
command from the command line. - Download the
curl -LO https://github.com/dita-ot/dita-ot/releases/download/4.2/dita-ot-4.2.zip
unzip -q dita-ot-4.2.zip
rm dita-ot-4.2.zip
- Run the plug-in installation commands:
dita install https://github.com/jason-fox/jason.fox.extend.css/archive/master.zip
The dita
command line tool requires no additional configuration.
Run any HTML dita transform e.g.:
PATH_TO_DITA_OT/bin/dita -f html5 -o out -i document.ditamap
Each HTML output file will include an additional line in the <head>
<head>
...
<link rel="stylesheet" type="text/css" href="common-extended.css">
</head>
The file common-extended.css
will include any CSS added via the extension points described below.
CSS rules are always position dependent - the rule defined last in a file will supercede previous definitions. This plug-in is offers three extension points where CSS can be appended to a file so that CSS rules can be added in order.
-
extend.css.process.pre
- Runs an additional Ant target before the extended css processing stage. -
extend.css.process
- Runs an additional Ant target as part of the extended css processing stage. -
extend.css.process.post
- Runs an additional Ant target after the extended css processing.
The following plugin.xml
will invoke an extension point and append additional CSS to extend.css.file
which is copied
to the output
<plugin id="com.example.extended.css">
<feature extension="ant.import" file="build.xml"/>
<require plugin="fox.jason.extend.css"/>
<feature extension="extend.css.process" value="example.css.copy"/>
</plugin>
<project name="com.example.extended.css">
<target name="example.css.copy">
<loadfile property="extra.css" srcFile="/path/to/css"/>
<echo append="true" message="${line.separator}${extra.css}" file="${extend.css.file}"/>
</target>
</project>
Working examples can be found in the DITA-OT Swagger plug-in and DITA-OT Prism-JS plug-in repositories.
Apache 2.0 © 2019 - 2024 Jason Fox