using-dita-properties-file.dita 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA General Task//EN" "generalTask.dtd">
  3. <!-- This file is part of the DITA Open Toolkit project. See the accompanying LICENSE file for applicable license. -->
  4. <task id="using-dita-properties-file">
  5. <title>Setting build parameters with <filepath>.properties</filepath> files</title>
  6. <titlealts>
  7. <navtitle>Using a properties file</navtitle>
  8. </titlealts>
  9. <shortdesc>Usually, DITA builds require setting a number of parameters that do not change frequently. You can
  10. reference a set of build parameters defined in a <filepath>.properties</filepath> file when building output with the
  11. <cmdname>dita</cmdname> command. If needed, you can override any parameter by specifying it explicitly as an
  12. argument to the <cmdname>dita</cmdname> command.</shortdesc>
  13. <taskbody>
  14. <section>
  15. <title>About <filepath>.properties</filepath> files</title>
  16. <p>A <filepath>.properties</filepath> file is a text file that enumerates one or more name-value pairs, one per
  17. line, in the format <codeph>name = value</codeph>. The <filepath>.properties</filepath> filename extension is
  18. customarily used, but is not required.</p>
  19. <ul compact="yes">
  20. <li>Lines beginning with the <codeph>#</codeph> character are comments.</li>
  21. <li>Properties specified as arguments of the <cmdname>dita</cmdname> command override those set in
  22. <filepath>.properties</filepath> files. <note type="restriction">For this reason,
  23. <parmname>args.input</parmname> and <parmname>transtype</parmname> can't be set in the
  24. <filepath>.properties</filepath> file.</note></li>
  25. <li>If you specify the same property more than once, the last instance is used.</li>
  26. <li>Properties not used by the selected transformation type are ignored.</li>
  27. <li>Properties can reference other property values defined elsewhere in the <filepath>.properties</filepath>
  28. file or passed by the <cmdname>dita</cmdname> command. Use the Ant
  29. <codeph>${<varname>property.name</varname>}</codeph> syntax.</li>
  30. <li>You can set properties not only for the default DITA-OT transformation types, but also for custom plugins.
  31. </li>
  32. </ul>
  33. </section>
  34. <steps>
  35. <step>
  36. <cmd>Create your <filepath>.properties</filepath> file.</cmd>
  37. <info>
  38. <note conref="../resources/conref-task.dita#ID/template-properties"/>
  39. </info>
  40. <stepxmp>For
  41. example:<codeblock><coderef href="../samples/properties/sequence-html5.properties"/></codeblock></stepxmp>
  42. </step>
  43. <step>
  44. <cmd>Reference your <filepath>.properties</filepath> file with the <cmdname>dita</cmdname> command when building
  45. your output.</cmd>
  46. <stepxmp>
  47. <codeblock><cmdname>dita</cmdname> <parmname>--input</parmname>=<varname>my.ditamap</varname> <parmname>--format</parmname>=<option>html5</option> <parmname>--propertyfile</parmname>=<varname>my.properties</varname></codeblock>
  48. </stepxmp>
  49. <info/>
  50. </step>
  51. <step>
  52. <cmd>If needed, pass additional arguments to the <cmdname>dita</cmdname> command to override specific build
  53. parameters. </cmd>
  54. <stepxmp>
  55. <p>For example, to build output once with <xmlelement>draft</xmlelement> and
  56. <xmlelement>required-cleanup</xmlelement> content:</p>
  57. <codeblock><cmdname>dita</cmdname> <parmname>--input</parmname>=<varname>my.ditamap</varname> <parmname>--format</parmname>=<option>html5</option> <parmname>--propertyfile</parmname>=<varname>my.properties</varname> \
  58. <parmname>--args.draft</parmname>=<option>yes</option></codeblock>
  59. </stepxmp>
  60. <info>
  61. <note conref="../resources/conref-task.dita#ID/pass-input-dir"/>
  62. </info>
  63. </step>
  64. </steps>
  65. </taskbody>
  66. </task>