using-dita-command.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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="You can generate output using the DITA Open Toolkit dita command-line tool. Build parameters can be specified on the command line or with .properties files."><meta name="DC.Format" content="XHTML"><meta name="DC.Identifier" content="using-command-line-tool"><link rel="stylesheet" type="text/css" href="../css/commonltr.css"><link rel="stylesheet" type="text/css" href="../css/dita-ot-doc.css"><title>Building output using the dita command</title></head><body id="using-command-line-tool"><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">Building output using the <span class="keyword cmdname">dita</span> command</h1>
  8. <div class="body taskbody"><p class="shortdesc">You can generate output using the DITA Open Toolkit <span class="keyword cmdname">dita</span> command-line tool. Build
  9. parameters can be specified on the command line or with <span class="ph filepath">.properties</span> files.</p>
  10. <section class="section context"><div class="tasklabel"><h2 class="sectiontitle tasklabel">About this task</h2></div>The DITA-OT client is a command-line tool with no graphical user interface.</section>
  11. <div class="tasklabel"><h2 class="sectiontitle tasklabel">Procedure</h2></div><ol class="ol steps"><li class="li step stepexpand">
  12. <span class="ph cmd">Open a terminal window by typing the following in the search bar:</span>
  13. <div class="itemgroup info">
  14. <ul class="ul">
  15. <li class="li">On OS X and Linux, type <kbd class="ph userinput">Terminal</kbd>.</li>
  16. <li class="li">On Windows, type <kbd class="ph userinput">Command Prompt</kbd>.</li>
  17. </ul>
  18. </div>
  19. </li><li class="li step stepexpand">
  20. <span class="ph cmd">At the command-line prompt, enter the following command:</span>
  21. <div class="itemgroup info"><pre class="pre codeblock"><code><span class="ph filepath"><var class="keyword varname">dita-ot-dir</var>/bin/<span class="keyword cmdname">dita</span></span> <span class="keyword option">-input</span>&nbsp;<var class="keyword varname">input-file</var> <span class="keyword option">-format</span>&nbsp;<var class="keyword varname">format</var> <var class="keyword varname">options</var></code></pre>
  22. <p class="p">where:</p>
  23. <ul class="ul">
  24. <li class="li"><span class="ph filepath"><var class="keyword varname">dita-ot-dir</var></span> is the DITA-OT installation directory.</li><li class="li"><var class="keyword varname">input-file</var> is the DITA map or DITA file that you want to process.</li><li class="li"><var class="keyword varname">format</var> is the output format (transformation type). Use the
  25. same values available for the <span class="keyword parmname">transtype</span> build parameter, for example,
  26. <code class="ph codeph">html5</code> or <code class="ph codeph">pdf</code>.</li>
  27. <li class="li"><var class="keyword varname">options</var> include the following optional build parameters:<dl class="dl parml">
  28. <dt class="dt pt dlterm"><span class="keyword parmname">-o</span>, <span class="keyword parmname">-output</span>
  29. <var class="keyword varname">dir</var></dt>
  30. <dd class="dd pd" id="using-command-line-tool__d21e286">Specifies the path of the output directory; the path can be
  31. absolute or relative to the current directory. By default, the output is written to the
  32. <span class="ph filepath">out</span> subdirectory of the current directory.</dd>
  33. <dt class="dt pt dlterm"><span class="keyword parmname">-filter</span>
  34. <var class="keyword varname">file</var></dt>
  35. <dd class="dd pd">Specifies a filter file to be used to include, exclude, or flag content.</dd>
  36. <dt class="dt pt dlterm"><span class="keyword parmname">-t</span>, <span class="keyword parmname">-temp</span>
  37. <var class="keyword varname">dir</var></dt>
  38. <dd class="dd pd">Specifies the location of the temporary directory.</dd>
  39. <dt class="dt pt dlterm"><span class="keyword parmname">-v</span>, <span class="keyword parmname">-verbose</span></dt>
  40. <dd class="dd pd">Verbose logging.</dd>
  41. <dt class="dt pt dlterm"><span class="keyword parmname">-d</span>, <span class="keyword parmname">-debug</span></dt>
  42. <dd class="dd pd">Debug logging.</dd>
  43. <dt class="dt pt dlterm"><span class="keyword parmname">-l</span>, <span class="keyword parmname">-logfile</span>
  44. <var class="keyword varname">file</var></dt>
  45. <dd class="dd pd">Write logging messages to a file.</dd>
  46. <dt class="dt pt dlterm"><span class="keyword parmname">-D</span><var class="keyword varname">parameter</var>=<var class="keyword varname">value</var></dt>
  47. <dd class="dd pd">Specify a value for a DITA-OT or Ant build parameter. <p class="p">Parameters not implemented by
  48. the specified transformation type or referenced in a <span class="ph filepath">.properties</span>
  49. file are ignored.</p><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
  50. files is not consistent, set <span class="keyword option">args.input.dir</span> with the <span class="keyword cmdname">dita</span> command and
  51. reference its value with <code class="ph codeph">${args.input.dir}</code> in your <span class="ph filepath">.properties</span>
  52. file.</div></dd>
  53. <dt class="dt pt dlterm"><span class="keyword parmname">-propertyfile</span>
  54. <var class="keyword varname">file</var></dt>
  55. <dd class="dd pd">Use build parameters defined in the referenced <span class="ph filepath">.properties</span> file.
  56. <p class="p">Build parameters specified on the command line override those set in the
  57. <span class="ph filepath">.properties</span> file.</p></dd>
  58. </dl></li>
  59. </ul></div>
  60. <div class="itemgroup stepresult">
  61. <p class="p">If processing is successful, nothing is printed in the terminal window. The built output is written to the
  62. specified output directory (by default, in the <span class="ph filepath">out</span> subdirectory of the current
  63. directory).</p>
  64. <div class="note tip note_tip" id="using-command-line-tool__d8e151"><span class="note__title tiptitle">Tip:</span> Add the absolute path for <span class="ph filepath"><var class="keyword varname">dita-ot-dir</var></span><span class="ph filepath">/bin</span> to the <var class="keyword varname">PATH</var> environment variable to run the
  65. <span class="keyword cmdname">dita</span> command from any location on the file system without typing the path.</div>
  66. </div>
  67. </li></ol>
  68. <div class="example"><div class="tasklabel"><h2 class="sectiontitle tasklabel">Example</h2></div>
  69. <p class="p">Run from <span class="ph filepath"><var class="keyword varname">dita-ot-dir</var>/docsrc/samples</span>, the following command generates
  70. HTML5 output for the <span class="ph filepath">sequence.ditamap</span> file:</p>
  71. <pre class="pre codeblock"><code><span class="ph filepath"><var class="keyword varname">dita-ot-dir</var>/bin/<span class="keyword cmdname">dita</span></span> <span class="keyword option">-input</span> sequence.ditamap <span class="keyword option">-format</span> html5</code></pre>
  72. </div>
  73. <div class="example"><div class="tasklabel"><h2 class="sectiontitle tasklabel">Example</h2></div>
  74. <p class="p">For example, from <span class="ph filepath"><var class="keyword varname">dita-ot-dir</var>/docsrc/samples</span>, run:</p>
  75. <pre class="pre codeblock"><code>dita <span class="keyword option">-input</span> sequence.ditamap <span class="keyword option">-format</span> html5 \
  76. <span class="keyword option">-output</span> output/sequence \
  77. <span class="keyword option">-D</span>args.input.dir=<span class="ph filepath"><var class="keyword varname">dita-ot-dir</var>/docsrc/samples</span> \
  78. <span class="keyword option">-propertyfile</span> properties/sequence-html5.properties</code></pre>
  79. <p class="p">This builds <span class="ph filepath">sequence.ditamap</span> to HTML5 output in <span class="ph filepath">output/sequence</span> using
  80. the additional parameters specified in the <span class="ph filepath">properties/sequence-html5.properties</span> file:</p>
  81. <pre class="pre codeblock"><code>args.gen.task.lbl = NO
  82. args.cssroot = ${args.input.dir}/css/
  83. args.css = style.css
  84. args.copycss = yes
  85. args.csspath = branding
  86. nav-toc = full
  87. args.xhtml.toc = toc</code></pre>
  88. </div>
  89. <section class="section postreq"><div class="tasklabel"><h2 class="sectiontitle tasklabel">What to do next</h2></div>
  90. <p class="p">Most builds require you to specify more options than are described in this topic.</p>
  91. <p class="p">Usually, you will want to specify a set of reusable build parameters in a
  92. <span class="ph filepath">.properties</span> file.</p>
  93. </section>
  94. </div>
  95. </article></main></body></html>