using-dita-properties-file.html 6.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!DOCTYPE html
  2. SYSTEM "about:legacy-compat">
  3. <html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2016"><meta name="DC.rights.owner" content="(C) Copyright 2016"><meta name="DC.Type" content="task"><meta name="description" content="Usually, DITA builds require setting a number of parameters that do not change frequently. You can reference a set of build parameters defined in a .properties file when building output with the dita command. If needed, you can override any parameter by specifying it explicitly as an argument to the dita command."><meta name="DC.Format" content="XHTML"><meta name="DC.Identifier" content="using-dita-properties-file"><link rel="stylesheet" type="text/css" href="../css/commonltr.css"><link rel="stylesheet" type="text/css" href="../css/dita-ot-doc.css"><title>Setting build parameters with .properties files</title></head><body id="using-dita-properties-file"><header role="banner"><div class="header">
  4. <p>DITA Open Toolkit</p>
  5. <hr>
  6. </div></header><nav role="toc"><ul></ul></nav><main role="main"><article role="article" aria-labelledby="ariaid-title1">
  7. <h1 class="title topictitle1" id="ariaid-title1">Setting build parameters with <span class="ph filepath">.properties</span> files</h1>
  8. <div class="body taskbody"><p class="shortdesc">Usually, DITA builds require setting a number of parameters that do not change frequently. You can
  9. reference a set of build parameters defined in a <span class="ph filepath">.properties</span> file when building output with the
  10. <span class="keyword cmdname">dita</span> command. If needed, you can override any parameter by specifying it explicitly as an
  11. argument to the <span class="keyword cmdname">dita</span> command.</p>
  12. <section class="section"><h2 class="title sectiontitle">About <span class="ph filepath">.properties</span> files</h2>
  13. <p class="p">A <span class="ph filepath">.properties</span> file is a text file that enumerates one or more name-value pairs, one per
  14. line, in the format <code class="ph codeph">name = value</code>. The <span class="ph filepath">.properties</span> filename extension is
  15. customarily used, but is not required.</p>
  16. <ul class="ul" compact>
  17. <li class="li">Lines beginning with the <code class="ph codeph">#</code> character are comments.</li>
  18. <li class="li">Properties specified as arguments of the <span class="keyword cmdname">dita</span> command override those set in
  19. <span class="ph filepath">.properties</span> files. <div class="note restriction note_restriction"><span class="note__title restrictiontitle">Restriction:</span> For this reason,
  20. <span class="keyword parmname">args.input</span> and <span class="keyword parmname">transtype</span> can't be set in the
  21. <span class="ph filepath">.properties</span> file.</div></li>
  22. <li class="li">If you specify the same property more than once, the last instance is used.</li>
  23. <li class="li">Properties not used by the selected transformation type are ignored.</li>
  24. <li class="li">Properties can reference other property values defined elsewhere in the <span class="ph filepath">.properties</span>
  25. file or passed by the <span class="keyword cmdname">dita</span> command. Use the Ant
  26. <code class="ph codeph">${<var class="keyword varname">property.name</var>}</code> syntax.</li>
  27. <li class="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. <div class="tasklabel"><h2 class="sectiontitle tasklabel">Procedure</h2></div><ol class="ol steps"><li class="li step stepexpand">
  32. <span class="ph cmd">Create your <span class="ph filepath">.properties</span> file.</span>
  33. <div class="itemgroup info">
  34. <div class="note tip note_tip"><span class="note__title tiptitle">Tip:</span> Copy <span class="ph filepath"><var class="keyword varname">dita-ot-dir</var>/docsrc/samples</span><span class="ph filepath">/properties/template.properties</span>; this template describes each of the properties you can
  35. set.</div>
  36. </div>
  37. <div class="itemgroup stepxmp">For
  38. example:<pre class="pre codeblock"><code>args.gen.task.lbl = NO
  39. args.cssroot = ${args.input.dir}/css/
  40. args.css = style.css
  41. args.copycss = yes
  42. args.csspath = branding
  43. nav-toc = full
  44. args.xhtml.toc = toc</code></pre></div>
  45. </li><li class="li step stepexpand">
  46. <span class="ph cmd">Reference your <span class="ph filepath">.properties</span> file with the <span class="keyword cmdname">dita</span> command when building
  47. your output.</span>
  48. <div class="itemgroup stepxmp">
  49. <pre class="pre codeblock"><code>dita -i <var class="keyword varname">my.ditamap</var> -f html5 -propertyfile <var class="keyword varname">my.properties</var></code></pre>
  50. </div>
  51. <div class="itemgroup info"></div>
  52. </li><li class="li step stepexpand">
  53. <span class="ph cmd">If needed, pass additional arguments to the <span class="keyword cmdname">dita</span> command to override specific build
  54. parameters. </span>
  55. <div class="itemgroup stepxmp">
  56. <p class="p">For example, to build output once with <code class="keyword markupname xmlelement">&lt;draft&gt;</code> and
  57. <code class="keyword markupname xmlelement">&lt;required-cleanup&gt;</code> content:</p>
  58. <pre class="pre codeblock"><code>dita -i <var class="keyword varname">my.ditamap</var> -f html5 -propertyfile <var class="keyword varname">my.properties</var> -Dargs.draft=yes</code></pre>
  59. </div>
  60. <div class="itemgroup info">
  61. <div class="note tip note_tip"><span class="note__title tiptitle">Tip:</span> If you are building in different environments where the location of the input
  62. files is not consistent, set <span class="keyword option">args.input.dir</span> with the <span class="keyword cmdname">dita</span> command and
  63. reference its value with <code class="ph codeph">${args.input.dir}</code> in your <span class="ph filepath">.properties</span>
  64. file.</div>
  65. </div>
  66. </li></ol>
  67. </div>
  68. </article></main></body></html>