using-dita-properties-file.dita 3.5 KB

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