extended-functionality.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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="reference"><meta name="description" content="DITA-OT provides additional code reference processing support beyond that which is mandated by the DITA specification. These extensions can be used to define character encodings or line ranges for use in code blocks."><meta name="DC.Relation" scheme="URI" content="../user-guide/DITA_spec-support.html"><meta name="DC.Format" content="XHTML"><meta name="DC.Identifier" content="extended-functionality"><link rel="stylesheet" type="text/css" href="../css/commonltr.css"><link rel="stylesheet" type="text/css" href="../css/dita-ot-doc.css"><title>Extended functionality</title></head><body id="extended-functionality"><header role="banner"><div class="header">
  4. <p>DITA Open Toolkit</p>
  5. <hr>
  6. </div></header><nav role="toc"><ul><li><a href="../index.html">DITA Open Toolkit 2.3</a></li><li><a href="../release-notes/index.html">Release Notes</a></li><li><a href="../getting-started/index.html">Getting Started</a></li><li><a href="../user-guide/index.html">User Guide</a><ul><li><a href="../user-guide/transforming-dita-content.html">Publishing DITA content</a></li><li><a href="../user-guide/AvailableTransforms.html">Output formats</a></li><li><a href="../user-guide/DITA_spec-support.html">DITA specification support</a><ul><li><a href="../user-guide/DITA_v1-2-support.html">DITA 1.2 support</a></li><li><a href="../user-guide/DITA_v1-3-support.html">DITA 1.3 support</a></li><li><a href="../user-guide/implementation-dependent-features.html">Feature implementation</a></li><li class="active"><a href="../user-guide/extended-functionality.html">Extended functionality</a></li></ul></li><li><a href="../user-guide/DITA-globalization.html">Globalizing DITA content</a></li><li><a href="../user-guide/troubleshooting-overview.html">Troubleshooting</a></li></ul></li><li><a href="../parameters/index.html">Parameter Reference</a></li><li><a href="../dev_ref/index.html">Developer Reference</a></li><li><a href="../user-guide/dita-and-dita-ot-resources.html">DITA Resources</a></li></ul></nav><main role="main"><article role="article" aria-labelledby="ariaid-title1">
  7. <h1 class="title topictitle1" id="ariaid-title1">Extended functionality</h1>
  8. <p class="shortdesc">DITA-OT provides additional code reference processing support beyond that which is mandated by the DITA
  9. specification. These extensions can be used to define character encodings or line ranges for use in code
  10. blocks.</p>
  11. <nav role="navigation" class="related-links"><div class="familylinks"><div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../user-guide/DITA_spec-support.html" title="DITA Open Toolkit 2.3 supports all versions of the OASIS DITA specification, including 1.0, 1.1, 1.2, and 1.3.">DITA specification support</a></div></div></nav><article class="topic reference nested1" aria-labelledby="ariaid-title2" id="extended-functionality__code-reference">
  12. <h2 class="title topictitle2" id="ariaid-title2">Code reference processing</h2>
  13. <div class="body refbody">
  14. <section class="section" id="code-reference__coderef-charset"><h3 class="title sectiontitle">Character set definition</h3>
  15. <p class="p">DITA-OT supports defining the code reference target file encoding using the <code class="keyword markupname xmlatt">@format</code>
  16. attribute. The supported format is:</p>
  17. <pre class="pre codeblock"><code>format (";" space* "charset=" charset)?</code></pre>
  18. <p class="p">If a character set is not defined, the system default character set will be used. If the character set is not
  19. recognized or supported, the <span class="keyword msgnum">DOTJ052E</span> error is thrown and the system default character set is
  20. used as a fall-back.</p>
  21. </section>
  22. <div class="example">
  23. <pre class="pre codeblock"><code>&lt;coderef href="unicode.txt" format="txt; charset=UTF-8"/&gt;</code></pre>
  24. </div>
  25. <section class="section"><h3 class="title sectiontitle">Line range extraction</h3>
  26. <p class="p">Code references can be limited to extract only a specified line range by defining the
  27. <code class="ph codeph">line-range</code> pointer in the URI fragment. The format is:</p>
  28. <pre class="pre codeblock"><code>uri ("#line-range(" start ("," end)? ")" )?</code></pre>
  29. <p class="p">Start and end line numbers start from 1 and are inclusive. If the end range is omitted, the range ends on the
  30. last line of the file.</p>
  31. </section>
  32. <div class="example">
  33. <pre class="pre codeblock"><code>&lt;coderef href="Parser.scala#line-range(5, 10)" format="scala"/&gt;</code></pre>
  34. <p class="p">Only lines from 5 to 10 will be included in the output.</p>
  35. </div>
  36. <section class="section"><h3 class="title sectiontitle">RFC 5147</h3>
  37. <p class="p">DITA-OT implements line position and range from <a class="xref" href="http://tools.ietf.org/html/rfc5147" target="_blank">RFC 5147</a>. The format for line range is:</p>
  38. <pre class="pre codeblock"><code>uri ("#line=" start? "," end? )?</code></pre>
  39. <p class="p">Start and end line numbers start from 0 and are inclusive and exclusive, respectively. If the start range is
  40. omitted, the range starts from the first line; if the end range is omitted, the range ends on the last line of
  41. the file. The format for line position is:</p>
  42. <pre class="pre codeblock"><code>uri ("#line=" position )?</code></pre>
  43. <p class="p">Position line number starts from 0.</p>
  44. </section>
  45. <div class="example">
  46. <pre class="pre codeblock"><code>&lt;coderef href="Parser.scala#line=4,10" format="scala"/&gt;</code></pre>
  47. <p class="p">Only lines from 5 to 10 will be included in the output.</p>
  48. </div>
  49. </div>
  50. </article>
  51. </article></main></body></html>