Building output using the dita command
You can generate output using the dita command-line tool. Build parameters can be specified on the command line or with .properties files.
Procedure
dita --input=input-file --format=format [options]
where:
- input-file is the DITA map or DITA file that you want to process.
-
format is the output format (transformation type). This argument corresponds to the common parameter transtype. Use the same values as for the transtype build parameter, for example html5 or pdf.
You can create plug-ins to add new output formats; by default, the following values are available:- dita
- eclipsehelp
- html5
- htmlhelp
- markdown, markdown_gitbook, and markdown_github
- xhtml
Tip:See DITA-OT transformations (output formats) for sample command line syntax and more information on each transformation. - [options] include the following optional build parameters:
- --debug
- -d
- Debug logging prints considerably more additional information. The debug log includes all information from the verbose log, plus details on Java classes, additional Ant properties and overrides, pre-processing filters, parameters, and stages, and the complete build sequence. Debug logging requires additional resources and can slow down the build process, so it should only be enabled when further details are required to diagnose problems.
- --filter=files
-
Specifies filter file(s) used to include, exclude, or flag content. Relative paths are resolved against the current directory and internally converted to absolute paths.
Note:To specify multiple filter files, use the system path separator character to delimit individual file paths (semicolon โ
;
โ on Windows, and colon โ:
โ on macOS and Linux) and wrap the value in quotes:--filter="filter1.ditaval;filter2.ditaval;filter3.ditaval"
As of DITA-OT 3.6, the --filter option can also be passed multiple times:
--filter=filter1.ditaval --filter=filter2.ditaval --filter=filter3.ditaval
DITAVAL files are evaluated in the order specified, so conditions specified in the first file take precedence over matching conditions specified in later files, just as conditions at the start of a DITAVAL document take precedence over matching conditions later in the same document.
- --help
- -h
- Print a list of available arguments, options, and subcommands.
- --logfile=file
- -l file
- Write logging messages to a file.
Note:If processing is successful, nothing is written to the log, so the file will be empty if there are no errors or warnings. To include informational messages in the log, add the --verbose option (or -v).
- --no-color
- By default, DITA-OT prints certain log messages to the console in color. In terminal environments that do
not support colored output, the ANSI color escape codes will be shown instead. To deactivate colored output,
pass the --no-color option to the dita command, or set the
TERM=dumb
orNO_COLOR
environment variables. - --output=dir
- -o dir
-
Specifies the path of the output directory; the path can be absolute or relative to the current directory.
This option corresponds to the common parameter output.dir.
By default, the output is written to the out subdirectory of the current directory.
- --parameter=value
- -Dparameter=value
- Specify a value for a DITA-OT or Ant build parameter.
- --propertyfile=file
- Use build parameters defined in the referenced .properties file.
- --repeat=N
- Repeat the transformation N number of times.
- --resource=file
- -r file
- Specifies resource files.
- --temp=dir
- -t dir
- Specifies the location of the temporary directory.
- --theme=file
- Publish PDF output with a theme configuration file.
- --verbose
- -v
- Verbose logging prints additional information to the console, including directory settings, effective values for Ant properties, input/output files, and informational messages to assist in troubleshooting.
If processing is successful, nothing is printed in the terminal window. The built output is written to the specified output directory (by default, in the out subdirectory of the current directory).
Example
For example, from dita-ot-dir/docsrc/samples, run:
dita --input=sequence.ditamap --format=html5 \
--output=output/sequence \
--args.input.dir=/absolute/path/to/dita-ot-dir/docsrc/samples \
--propertyfile=properties/sequence-html5.properties
This builds sequence.ditamap to HTML5 output in output/sequence using the following additional parameters specified in the properties/sequence-html5.properties file:
# Directory that contains the custom .css file:
args.cssroot = ${args.input.dir}/css/
# Custom .css file used to style output:
args.css = style.css
# Copy the custom .css file to the output directory:
args.copycss = yes
# Location of the copied .css file relative to the output:
args.csspath = branding
# Generate a full navigation TOC in topic pages:
nav-toc = full
What to do next
Usually, you will want to specify a set of reusable build parameters in a .properties file.