using-project-files.dita 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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="ID">
  5. <title>Publishing with project files</title>
  6. <titlealts>
  7. <navtitle>Using a project file</navtitle>
  8. </titlealts>
  9. <shortdesc><ph id="projects-desc">DITA-OT 3.4 introduces new project files to define publication projects with
  10. multiple deliverables. Projects specify a context, output folder, and publication for each deliverable. A
  11. re-usable context groups source files and filters, and a publication defines an output format with transformation
  12. parameters. You can pass a project file to the <cmdname>dita</cmdname> command to publish multiple deliverables at
  13. once.</ph></shortdesc>
  14. <prolog>
  15. <metadata>
  16. <keywords>
  17. <indexterm><cmdname>dita</cmdname> command
  18. <indexterm>project files</indexterm></indexterm>
  19. <indexterm>project files
  20. <indexterm>using</indexterm></indexterm>
  21. </keywords>
  22. </metadata>
  23. </prolog>
  24. <taskbody>
  25. <section>
  26. <title>About project files</title>
  27. <p id="projects-formats">Project files may be defined in one of three formats: XML,
  28. <xref keyref="json"/>, or
  29. <xref keyref="yaml"/>. The XML format can be validated with a RELAX NG schema provided in the
  30. <filepath>resources</filepath> folder of the DITA-OT installation (<filepath>project.rnc</filepath>).</p>
  31. <note>The XML project file format is the normative version provided for interoperability with existing XML-based
  32. toolchains. The JSON and YAML versions are alternative compact formats that are easier to read and write, but
  33. otherwise equivalent to the XML syntax.</note>
  34. <p id="projects-advantages">Whereas <filepath>.properties</filepath> files can only be used to set parameters,
  35. project files go further, allowing you to define multiple deliverables with separate input files and output
  36. folders and formats for each publication. A project file can also refer to other project files, so you can
  37. re-use common configuration structures across projects.</p>
  38. <p id="projects-relpaths">Another advantage of project files over <filepath>.properties</filepath> files is that
  39. they allow you to specify paths relative to the project file, even for parameters that require absolute paths,
  40. such as:
  41. <ul>
  42. <li><codeph>args.cssroot</codeph></li>
  43. <li><codeph>args.ftr</codeph></li>
  44. <li><codeph>args.hdf</codeph></li>
  45. <li><codeph>args.hdr</codeph></li>
  46. </ul>
  47. </p>
  48. <p id="projects-structure">Though the exact syntax differs slightly, the basic structure of project files is
  49. similar in all supported formats.</p>
  50. <ul compact="yes">
  51. <li>
  52. <p>You can link to other project files with <codeph>include(s)</codeph></p></li>
  53. <li>
  54. <p>Projects can define multiple <codeph>deliverables</codeph>, which consist of:
  55. <ul>
  56. <li>
  57. <p>a publication <codeph>context</codeph> that may include:
  58. <ul>
  59. <li>an <codeph>id</codeph> used to refer to this context from other projects</li>
  60. <li>a series of <codeph>input</codeph> files (DITA maps)</li>
  61. <li>a <codeph>profile</codeph> with a series of DITAVAL files used to filter the content</li>
  62. </ul>
  63. </p>
  64. </li>
  65. <li>
  66. <p>an <codeph>output</codeph> location (relative to the CLI <parmname>--output</parmname>
  67. directory)</p></li>
  68. <li>a <codeph>publication</codeph> that defines:
  69. <ul compact="yes">
  70. <li>an output format via <codeph>transtype</codeph>, and</li>
  71. <li>a series of parameters to set for this transformation type, specified via <codeph>name</codeph>
  72. and either <codeph>href</codeph>, <codeph>path</codeph>, or <codeph>value</codeph></li>
  73. </ul>
  74. </li>
  75. </ul>
  76. </p></li>
  77. </ul>
  78. <note type="tip">
  79. <ul>
  80. <li>Use <codeph>href</codeph> for web addresses and other resources that should resolve to an absolute
  81. URI.</li>
  82. <li>Use <codeph>path</codeph> for parameters that require an absolute value, like
  83. <parmname>args.cssroot</parmname>. Paths may be defined relative to the project file, but are always
  84. expanded to an absolute system path.</li>
  85. <li>Use <codeph>value</codeph> to define strings and relative values for properties like
  86. <parmname>args.csspath</parmname>, which is used to describe a relative path in the output folder.</li>
  87. </ul>
  88. </note>
  89. </section>
  90. <steps>
  91. <step>
  92. <cmd>Create a project file to define the deliverables in your publication project.</cmd>
  93. <stepxmp>
  94. <p>For example:</p>
  95. <fig>
  96. <title>Sample project file for PDF output: <filepath conkeyref="conref-task/samples-dir"
  97. /><filepath>/project-files/pdf.xml</filepath></title>
  98. <codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace"><coderef href="../samples/project-files/pdf.xml"/></codeblock>
  99. </fig>
  100. </stepxmp>
  101. </step>
  102. <step>
  103. <cmd>Pass your project file to the <cmdname>dita</cmdname> command to build output.</cmd>
  104. <stepxmp>
  105. <codeblock><cmdname>dita</cmdname> <parmname>--project</parmname>=<varname>pdf.xml</varname></codeblock>
  106. </stepxmp>
  107. </step>
  108. <step importance="optional">
  109. <cmd>If needed, pass additional arguments to the <cmdname>dita</cmdname> command to override specific build
  110. parameters. </cmd>
  111. <stepxmp>
  112. <p>For example, to build output once with <xmlelement>draft</xmlelement> and
  113. <xmlelement>required-cleanup</xmlelement> content:</p>
  114. <codeblock><cmdname>dita</cmdname> <parmname>--project</parmname>=<varname>pdf.xml</varname> <parmname>--args.draft</parmname>=<option>yes</option></codeblock>
  115. </stepxmp>
  116. </step>
  117. <step importance="optional">
  118. <cmd>If your project contains multiple deliverables, you can pass the <parmname>--deliverable</parmname> option
  119. to generate output for a single deliverable ID.</cmd>
  120. <stepxmp>
  121. <codeblock><cmdname>dita</cmdname> <parmname>--project</parmname>=<varname>all.xml</varname> <parmname>--deliverable</parmname>=<option>htmlhelp</option></codeblock>
  122. </stepxmp>
  123. </step>
  124. </steps>
  125. </taskbody>
  126. </task>