123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677 |
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <!-- This file is generated by Nim. -->
- <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>packages/docutils/rstgen</title>
- <!-- Google fonts -->
- <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
- <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
- <!-- Favicon -->
- <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
- <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
- <!-- CSS -->
- <link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
- <!-- JS -->
- <script type="text/javascript" src="dochack.js?v=2.3.1"></script>
- </head>
- <body>
- <div class="document" id="documentId">
- <div class="container">
- <h1 class="title">packages/docutils/rstgen</h1>
- <div class="row">
- <div class="three columns">
- <div class="theme-select-wrapper">
- <label for="theme-select">Theme: </label>
- <select id="theme-select" onchange="setTheme(this.value)">
- <option value="auto">🌗 Match OS</option>
- <option value="dark">🌑 Dark</option>
- <option value="light">🌕 Light</option>
- </select>
- </div>
- <div id="global-links">
- <ul class="simple-boot">
- <li><a href="manual.html">Manual</a></li>
- <li><a href="lib.html">Standard library</a></li>
- <li> <a id="indexLink" href="theindex.html">Index</a></li>
- <li><a href="compiler/theindex.html">Compiler docs</a></li>
- <li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
- <li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
- </ul>
- </div>
- <div id="searchInputDiv">
- Search: <input type="search" id="searchInput"
- oninput="search()" />
- </div>
-
- <ul class="simple simple-toc" id="toc-list">
- <li>
- <a class="reference reference-toplevel" href="#6" id="56">Imports</a>
- </li>
- <li>
- <details open>
- <summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
- <ul class="simple simple-toc-section">
- <li><a class="reference" href="#EscapeMode" title="EscapeMode = enum
- emText, emOption, emUrl">EscapeMode</a></li>
- <li><a class="reference" href="#IndexedDocs" title="IndexedDocs = Table[IndexEntry, seq[IndexEntry]]">IndexedDocs</a></li>
- <li><a class="reference" href="#MetaEnum" title="MetaEnum = enum
- metaNone, metaTitleRaw, metaTitle, metaSubtitle, metaAuthor, metaVersion">MetaEnum</a></li>
- <li><a class="reference" href="#OutputTarget" title="OutputTarget = enum
- outHtml, outLatex">OutputTarget</a></li>
- <li><a class="reference" href="#RstGenerator" title="RstGenerator = object of RootObj
- target*: OutputTarget
- config*: StringTableRef
- splitAfter*: int
- listingCounter*: int
- tocPart*: seq[PRstNode]
- hasToc*: bool
- findFile*: FindFileHandler
- msgHandler*: MsgHandler
- outDir*: string ## output directory, initialized by docgen.nim
- destFile*: string ## output (HTML) file, initialized by docgen.nim
- filenames*: RstFileTable
- filename*: string ## source Nim or Rst file
- meta*: array[MetaEnum, string]
- ## \
- ## Stores the empty string or the last headline/overline found in the rst
- ## document, so it can be used as a prettier name for term index generation.
- ## \
- ## Keeps count of same text index terms to generate different identifiers
- ## for hyperlinks. See renderIndexTerm proc for details.
- id*: int ## A counter useful for generating IDs.
- onTestSnippet*: proc (d: var RstGenerator; filename, cmd: string; status: int;
- content: string) {.gcsafe.}
- escMode*: EscapeMode">RstGenerator</a></li>
- </ul>
- </details>
- </li>
- <li>
- <details open>
- <summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
- <ul class="simple simple-toc-section">
- <li><a class="reference" href="#IndexExt" title="IndexExt = ".idx"">IndexExt</a></li>
- </ul>
- </details>
- </li>
- <li>
- <details open>
- <summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
- <ul class="simple simple-toc-section">
- <ul class="simple nested-toc-section">defaultConfig
- <li><a class="reference" href="#defaultConfig" title="defaultConfig(): StringTableRef">defaultConfig(): StringTableRef</a></li>
- </ul>
- <ul class="simple nested-toc-section">esc
- <li><a class="reference" href="#esc%2COutputTarget%2Cstring%2Cint" title="esc(target: OutputTarget; s: string; splitAfter = -1; escMode = emText): string">esc(target: OutputTarget; s: string; splitAfter = -1; escMode = emText): string</a></li>
- </ul>
- <ul class="simple nested-toc-section">escChar
- <li><a class="reference" href="#escChar%2COutputTarget%2Cstring%2Cchar%2CEscapeMode" title="escChar(target: OutputTarget; dest: var string; c: char; escMode: EscapeMode)">escChar(target: OutputTarget; dest: var string; c: char; escMode: EscapeMode)</a></li>
- </ul>
- <ul class="simple nested-toc-section">formatNamedVars
- <li><a class="reference" href="#formatNamedVars%2Cstring%2CopenArray%5Bstring%5D%2CopenArray%5Bstring%5D" title="formatNamedVars(frmt: string; varnames: openArray[string];
- varvalues: openArray[string]): string">formatNamedVars(frmt: string; varnames: openArray[string];
- varvalues: openArray[string]): string</a></li>
- </ul>
- <ul class="simple nested-toc-section">initRstGenerator
- <li><a class="reference" href="#initRstGenerator%2CRstGenerator%2COutputTarget%2CStringTableRef%2Cstring%2CFindFileHandler%2CMsgHandler" title="initRstGenerator(g: var RstGenerator; target: OutputTarget;
- config: StringTableRef; filename: string;
- findFile: FindFileHandler = nil; msgHandler: MsgHandler = nil;
- filenames = default(RstFileTable); hasToc = false)">initRstGenerator(g: var RstGenerator; target: OutputTarget;
- config: StringTableRef; filename: string;
- findFile: FindFileHandler = nil; msgHandler: MsgHandler = nil;
- filenames = default(RstFileTable); hasToc = false)</a></li>
- </ul>
- <ul class="simple nested-toc-section">mergeIndexes
- <li><a class="reference" href="#mergeIndexes%2Cstring" title="mergeIndexes(dir: string): string">mergeIndexes(dir: string): string</a></li>
- </ul>
- <ul class="simple nested-toc-section">nextSplitPoint
- <li><a class="reference" href="#nextSplitPoint%2Cstring%2Cint" title="nextSplitPoint(s: string; start: int): int">nextSplitPoint(s: string; start: int): int</a></li>
- </ul>
- <ul class="simple nested-toc-section">prettyLink
- <li><a class="reference" href="#prettyLink%2Cstring" title="prettyLink(file: string): string">prettyLink(file: string): string</a></li>
- </ul>
- <ul class="simple nested-toc-section">readIndexDir
- <li><a class="reference" href="#readIndexDir%2Cstring" title="readIndexDir(dir: string): tuple[modules: seq[string], symbols: seq[IndexEntry],
- docs: IndexedDocs]">readIndexDir(dir: string): tuple[modules: seq[string], symbols: seq[IndexEntry],
- docs: IndexedDocs]</a></li>
- </ul>
- <ul class="simple nested-toc-section">renderCodeLang
- <li><a class="reference" href="#renderCodeLang%2Cstring%2CSourceLanguage%2Cstring%2COutputTarget" title="renderCodeLang(result: var string; lang: SourceLanguage; code: string;
- target: OutputTarget)">renderCodeLang(result: var string; lang: SourceLanguage; code: string;
- target: OutputTarget)</a></li>
- </ul>
- <ul class="simple nested-toc-section">renderIndexTerm
- <li><a class="reference" href="#renderIndexTerm%2CPDoc%2CPRstNode%2Cstring" title="renderIndexTerm(d: PDoc; n: PRstNode; result: var string)">renderIndexTerm(d: PDoc; n: PRstNode; result: var string)</a></li>
- </ul>
- <ul class="simple nested-toc-section">renderNimCode
- <li><a class="reference" href="#renderNimCode%2Cstring%2Cstring%2COutputTarget" title="renderNimCode(result: var string; code: string; target: OutputTarget)">renderNimCode(result: var string; code: string; target: OutputTarget)</a></li>
- </ul>
- <ul class="simple nested-toc-section">renderRstToOut
- <li><a class="reference" href="#renderRstToOut%2CRstGenerator%2CPRstNode%2Cstring" title="renderRstToOut(d: var RstGenerator; n: PRstNode; result: var string)">renderRstToOut(d: var RstGenerator; n: PRstNode; result: var string)</a></li>
- </ul>
- <ul class="simple nested-toc-section">renderTocEntries
- <li><a class="reference" href="#renderTocEntries%2CRstGenerator%2Cint%2Cint%2Cstring" title="renderTocEntries(d: var RstGenerator; j: var int; lvl: int; result: var string)">renderTocEntries(d: var RstGenerator; j: var int; lvl: int; result: var string)</a></li>
- </ul>
- <ul class="simple nested-toc-section">rstToHtml
- <li><a class="reference" href="#rstToHtml%2Cstring%2CRstParseOptions%2CStringTableRef%2CMsgHandler" title="rstToHtml(s: string; options: RstParseOptions; config: StringTableRef;
- msgHandler: MsgHandler = rst.defaultMsgHandler): string">rstToHtml(s: string; options: RstParseOptions; config: StringTableRef;
- msgHandler: MsgHandler = rst.defaultMsgHandler): string</a></li>
- </ul>
- <ul class="simple nested-toc-section">rstToLatex
- <li><a class="reference" href="#rstToLatex%2Cstring%2CRstParseOptions" title="rstToLatex(rstSource: string; options: RstParseOptions): string">rstToLatex(rstSource: string; options: RstParseOptions): string</a></li>
- </ul>
- <ul class="simple nested-toc-section">setIndexTerm
- <li><a class="reference" href="#setIndexTerm%2CRstGenerator%2CIndexEntryKind%2Cstring%2Cstring%2Cstring%2Cstring%2Cstring%2Cint" title="setIndexTerm(d: var RstGenerator; k: IndexEntryKind; htmlFile, id, term: string;
- linkTitle, linkDesc = ""; line = 0)">setIndexTerm(d: var RstGenerator; k: IndexEntryKind; htmlFile, id, term: string;
- linkTitle, linkDesc = ""; line = 0)</a></li>
- </ul>
- <ul class="simple nested-toc-section">traverseForIndex
- <li><a class="reference" href="#traverseForIndex%2CPDoc%2CPRstNode" title="traverseForIndex(d: PDoc; n: PRstNode)">traverseForIndex(d: PDoc; n: PRstNode)</a></li>
- </ul>
- <ul class="simple nested-toc-section">writeIndexFile
- <li><a class="reference" href="#writeIndexFile%2CRstGenerator%2Cstring" title="writeIndexFile(g: var RstGenerator; outfile: string)">writeIndexFile(g: var RstGenerator; outfile: string)</a></li>
- </ul>
- </ul>
- </details>
- </li>
- </ul>
- </div>
- <div class="nine columns" id="content">
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L1" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
- <div id="tocRoot"></div>
-
- <p class="module-desc"><p>This module implements a generator of HTML/Latex from <span id="restructuredtext_1">reStructuredText</span> (see <a class="reference external" href="https://docutils.sourceforge.net/rst.html">https://docutils.sourceforge.net/rst.html</a> for information on this markup syntax) and is used by the compiler's <a class="reference external" href="docgen.html">docgen tools</a>.</p>
- <p>You can generate HTML output through the convenience proc <tt class="docutils literal"><span class="pre">rstToHtml</span></tt>, which provided an input string with rst markup returns a string with the generated HTML. The final output is meant to be embedded inside a full document you provide yourself, so it won't contain the usual <tt class="docutils literal"><span class="pre"><header></span></tt> or <tt class="docutils literal"><span class="pre"><body></span></tt> parts.</p>
- <p>You can also create a <tt class="docutils literal"><span class="pre">RstGenerator</span></tt> structure and populate it with the other lower level methods to finally build complete documents. This requires many options and tweaking, but you are not limited to snippets and can generate <a class="reference external" href="https://en.wikipedia.org/wiki/LaTeX">LaTeX documents</a> too.</p>
- <p><a class="reference external" href="https://docutils.sourceforge.io/docs/user/config.htm">Docutils configuration files</a> are not supported. Instead HTML generation can be tweaked by editing file <tt class="docutils literal"><span class="pre">config/nimdoc.cfg</span></tt>.</p>
- <p>There are stylistic difference between how this module renders some elements and how original Python Docutils does:</p>
- <ul class="simple"><li>Backreferences to TOC in section headings are not generated. In HTML each section is also a link that points to the section itself: this is done for user to be able to copy the link into clipboard.</li>
- <li>The same goes for footnotes/citations links: they point to themselves. No backreferences are generated since finding all references of a footnote can be done by simply searching for <tt class="docutils literal"><span class="pre">[footnoteName]</span></tt>.</li>
- </ul>
- </p>
- <div class="section" id="6">
- <h1><a class="toc-backref" href="#6">Imports</a></h1>
- <dl class="item">
- <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="os.html">os</a>, <a class="reference external" href="hashes.html">hashes</a>, <a class="reference external" href="strtabs.html">strtabs</a>, <a class="reference external" href="tables.html">tables</a>, <a class="reference external" href="sequtils.html">sequtils</a>, <a class="reference external" href="algorithm.html">algorithm</a>, <a class="reference external" href="parseutils.html">parseutils</a>, <a class="reference external" href="strbasics.html">strbasics</a>, <a class="reference external" href="rstast.html">rstast</a>, <a class="reference external" href="rst.html">rst</a>, <a class="reference external" href="rstidx.html">rstidx</a>, <a class="reference external" href="highlite.html">highlite</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="syncio.html">syncio</a>, <a class="reference external" href="formatfloat.html">formatfloat</a>, <a class="reference external" href="since.html">since</a>
- </dl>
- </div>
- <div class="section" id="7">
- <h1><a class="toc-backref" href="#7">Types</a></h1>
- <dl class="item">
- <div id="EscapeMode">
- <dt><pre><a href="rstgen.html#EscapeMode"><span class="Identifier">EscapeMode</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
- <span class="Identifier">emText</span><span class="Other">,</span> <span class="Identifier">emOption</span><span class="Other">,</span> <span class="Identifier">emUrl</span></pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L65" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L65" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="IndexedDocs">
- <dt><pre><a href="rstgen.html#IndexedDocs"><span class="Identifier">IndexedDocs</span></a> <span class="Other">=</span> <a href="tables.html#Table"><span class="Identifier">Table</span></a><span class="Other">[</span><a href="rstidx.html#IndexEntry"><span class="Identifier">IndexEntry</span></a><span class="Other">,</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="rstidx.html#IndexEntry"><span class="Identifier">IndexEntry</span></a><span class="Other">]</span><span class="Other">]</span></pre></dt>
- <dd>
-
- <p>
- Contains the index sequences for doc types.</p>
- <p>The key is a <em>fake</em> IndexEntry which will contain the title of the document in the <tt class="docutils literal"><span class="pre"><span class="Identifier">keyword</span></span></tt> field and <tt class="docutils literal"><span class="pre"><span class="Identifier">link</span></span></tt> will contain the html filename for the document. <tt class="docutils literal"><span class="pre"><span class="Identifier">linkTitle</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">linkDesc</span></span></tt> will be empty.</p>
- <p>The value indexed by this IndexEntry is a sequence with the real index entries found in the <tt class="docutils literal"><span class="pre">.idx</span></tt> file.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L394" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L394" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="MetaEnum">
- <dt><pre><a href="rstgen.html#MetaEnum"><span class="Identifier">MetaEnum</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
- <span class="Identifier">metaNone</span><span class="Other">,</span> <span class="Identifier">metaTitleRaw</span><span class="Other">,</span> <span class="Identifier">metaTitle</span><span class="Other">,</span> <span class="Identifier">metaSubtitle</span><span class="Other">,</span> <span class="Identifier">metaAuthor</span><span class="Other">,</span> <span class="Identifier">metaVersion</span></pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L62" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L62" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="OutputTarget">
- <dt><pre><a href="rstgen.html#OutputTarget"><span class="Identifier">OutputTarget</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
- <span class="Identifier">outHtml</span><span class="Other">,</span> <span class="Identifier">outLatex</span></pre></dt>
- <dd>
-
- which document type to generate
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L58" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L58" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="RstGenerator">
- <dt><pre><a href="rstgen.html#RstGenerator"><span class="Identifier">RstGenerator</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="system.html#RootObj"><span class="Identifier">RootObj</span></a>
- <span class="Identifier">target</span><span class="Operator">*</span><span class="Other">:</span> <a href="rstgen.html#OutputTarget"><span class="Identifier">OutputTarget</span></a>
- <span class="Identifier">config</span><span class="Operator">*</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a>
- <span class="Identifier">splitAfter</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a>
- <span class="Identifier">listingCounter</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a>
- <span class="Identifier">tocPart</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="rstast.html#PRstNode"><span class="Identifier">PRstNode</span></a><span class="Other">]</span>
- <span class="Identifier">hasToc</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a>
- <span class="Identifier">findFile</span><span class="Operator">*</span><span class="Other">:</span> <a href="rst.html#FindFileHandler"><span class="Identifier">FindFileHandler</span></a>
- <span class="Identifier">msgHandler</span><span class="Operator">*</span><span class="Other">:</span> <a href="rst.html#MsgHandler"><span class="Identifier">MsgHandler</span></a>
- <span class="Identifier">outDir</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## output directory, initialized by docgen.nim</span>
- <span class="Identifier">destFile</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## output (HTML) file, initialized by docgen.nim</span>
- <span class="Identifier">filenames</span><span class="Operator">*</span><span class="Other">:</span> <a href="rst.html#RstFileTable"><span class="Identifier">RstFileTable</span></a>
- <span class="Identifier">filename</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## source Nim or Rst file</span>
- <span class="Identifier">meta</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#array"><span class="Identifier">array</span></a><span class="Other">[</span><span class="Identifier">MetaEnum</span><span class="Other">,</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span>
- <span class="Comment">## \</span>
- <span class="Comment">## Stores the empty string or the last headline/overline found in the rst</span>
- <span class="Comment">## document, so it can be used as a prettier name for term index generation.</span>
- <span class="Comment">## \</span>
- <span class="Comment">## Keeps count of same text index terms to generate different identifiers</span>
- <span class="Comment">## for hyperlinks. See renderIndexTerm proc for details.</span>
- <span class="Identifier">id</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> <span class="Comment">## A counter useful for generating IDs.</span>
- <span class="Identifier">onTestSnippet</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="rstgen.html#RstGenerator"><span class="Identifier">RstGenerator</span></a><span class="Other">;</span> <span class="Identifier">filename</span><span class="Other">,</span> <span class="Identifier">cmd</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">status</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">;</span>
- <span class="Identifier">content</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}
- <span class="Identifier">escMode</span><span class="Operator">*</span><span class="Other">:</span> <a href="rstgen.html#EscapeMode"><span class="Identifier">EscapeMode</span></a></pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L69" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L69" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </dl>
- </div>
- <div class="section" id="10">
- <h1><a class="toc-backref" href="#10">Consts</a></h1>
- <dl class="item">
- <div id="IndexExt">
- <dt><pre><a href="rstgen.html#IndexExt"><span class="Identifier">IndexExt</span></a> <span class="Other">=</span> <span class="StringLit">".idx"</span></pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L55" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L55" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </dl>
- </div>
- <div class="section" id="12">
- <h1><a class="toc-backref" href="#12">Procs</a></h1>
- <dl class="item">
- <div id="defaultConfig-procs-all">
- <div id="defaultConfig">
- <dt><pre><span class="Keyword">proc</span> <a href="#defaultConfig"><span class="Identifier">defaultConfig</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Returns a default configuration for embedded HTML generation.</p>
- <p>The returned <tt class="docutils literal"><span class="pre">StringTableRef</span></tt> contains the parameters used by the HTML engine to build the final output. For information on what these parameters are and their purpose, please look up the file <tt class="docutils literal"><span class="pre">config/nimdoc.cfg</span></tt> bundled with the compiler.</p>
- <p>The only difference between the contents of that file and the values provided by this proc is the <tt class="docutils literal"><span class="pre">doc.file</span></tt> variable. The <tt class="docutils literal"><span class="pre">doc.file</span></tt> variable of the configuration file contains HTML to build standalone pages, while this proc returns just the content for procs like <tt class="docutils literal"><span class="pre">rstToHtml</span></tt> to generate the bare minimum HTML.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L1445" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L1445" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="esc-procs-all">
- <div id="esc,OutputTarget,string,int">
- <dt><pre><span class="Keyword">proc</span> <a href="#esc%2COutputTarget%2Cstring%2Cint"><span class="Identifier">esc</span></a><span class="Other">(</span><span class="Identifier">target</span><span class="Other">:</span> <a href="rstgen.html#OutputTarget"><span class="Identifier">OutputTarget</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">splitAfter</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">;</span> <span class="Identifier">escMode</span> <span class="Other">=</span> <span class="Identifier">emText</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- Escapes the HTML.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L252" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L252" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="escChar-procs-all">
- <div id="escChar,OutputTarget,string,char,EscapeMode">
- <dt><pre><span class="Keyword">proc</span> <a href="#escChar%2COutputTarget%2Cstring%2Cchar%2CEscapeMode"><span class="Identifier">escChar</span></a><span class="Other">(</span><span class="Identifier">target</span><span class="Other">:</span> <a href="rstgen.html#OutputTarget"><span class="Identifier">OutputTarget</span></a><span class="Other">;</span> <span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">c</span><span class="Other">:</span> <a href="system.html#char"><span class="Identifier">char</span></a><span class="Other">;</span>
- <span class="Identifier">escMode</span><span class="Other">:</span> <a href="rstgen.html#EscapeMode"><span class="Identifier">EscapeMode</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L229" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L229" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="formatNamedVars-procs-all">
- <div id="formatNamedVars,string,openArray[string],openArray[string]">
- <dt><pre><span class="Keyword">proc</span> <a href="#formatNamedVars%2Cstring%2CopenArray%5Bstring%5D%2CopenArray%5Bstring%5D"><span class="Identifier">formatNamedVars</span></a><span class="Other">(</span><span class="Identifier">frmt</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">varnames</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">;</span>
- <span class="Identifier">varvalues</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L1384" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L1384" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="initRstGenerator-procs-all">
- <div id="initRstGenerator,RstGenerator,OutputTarget,StringTableRef,string,FindFileHandler,MsgHandler">
- <dt><pre><span class="Keyword">proc</span> <a href="#initRstGenerator%2CRstGenerator%2COutputTarget%2CStringTableRef%2Cstring%2CFindFileHandler%2CMsgHandler"><span class="Identifier">initRstGenerator</span></a><span class="Other">(</span><span class="Identifier">g</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="rstgen.html#RstGenerator"><span class="Identifier">RstGenerator</span></a><span class="Other">;</span> <span class="Identifier">target</span><span class="Other">:</span> <a href="rstgen.html#OutputTarget"><span class="Identifier">OutputTarget</span></a><span class="Other">;</span>
- <span class="Identifier">config</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span> <span class="Identifier">filename</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span>
- <span class="Identifier">findFile</span><span class="Other">:</span> <a href="rst.html#FindFileHandler"><span class="Identifier">FindFileHandler</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
- <span class="Identifier">msgHandler</span><span class="Other">:</span> <a href="rst.html#MsgHandler"><span class="Identifier">MsgHandler</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
- <span class="Identifier">filenames</span> <span class="Other">=</span> <span class="Identifier">default</span><span class="Other">(</span><a href="rst.html#RstFileTable"><span class="Identifier">RstFileTable</span></a><span class="Other">)</span><span class="Other">;</span> <span class="Identifier">hasToc</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Initializes a <tt class="docutils literal"><span class="pre">RstGenerator</span></tt>.</p>
- <p>You need to call this before using a <tt class="docutils literal"><span class="pre">RstGenerator</span></tt> with any other procs in this module. Pass a non <tt class="docutils literal"><span class="pre">nil</span></tt> <tt class="docutils literal"><span class="pre">StringTableRef</span></tt> value as <tt class="docutils literal"><span class="pre"><span class="Identifier">config</span></span></tt> with parameters used by the HTML output generator. If you don't know what to use, pass the results of the <tt class="docutils literal"><span class="pre"><span class="Identifier">defaultConfig</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator"><</span><span class="Comment">#defaultConfig>_</span></span></tt> proc.</p>
- <p>The <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt> parameter will be used for error reporting and creating index hyperlinks to the file, but you can pass an empty string here if you are parsing a stream in memory. If <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt> ends with the <tt class="docutils literal"><span class="pre">.nim</span></tt> extension, the title for the document will be set by default to <tt class="docutils literal"><span class="pre">Module filename</span></tt>. This default title can be overridden by the embedded rst, but it helps to prettify the generated index if no title is found.</p>
- <p>The <tt class="docutils literal"><span class="pre">RstParseOptions</span></tt>, <tt class="docutils literal"><span class="pre">FindFileHandler</span></tt> and <tt class="docutils literal"><span class="pre">MsgHandler</span></tt> types are defined in the <a class="reference external" href="rst.html">packages/docutils/rst module</a>. <tt class="docutils literal"><span class="pre">options</span></tt> selects the behaviour of the rst parser.</p>
- <p><tt class="docutils literal"><span class="pre">findFile</span></tt> is a proc used by the rst <tt class="docutils literal"><span class="pre">include</span></tt> directive among others. The purpose of this proc is to mangle or filter paths. It receives paths specified in the rst document and has to return a valid path to existing files or the empty string otherwise. If you pass <tt class="docutils literal"><span class="pre">nil</span></tt>, a default proc will be used which given a path returns the input path only if the file exists. One use for this proc is to transform relative paths found in the document to absolute path, useful if the rst file and the resources it references are not in the same directory as the current working directory.</p>
- <p>The <tt class="docutils literal"><span class="pre">msgHandler</span></tt> is a proc used for user error reporting. It will be called with the filename, line, col, and type of any error found during parsing. If you pass <tt class="docutils literal"><span class="pre">nil</span></tt>, a default message handler will be used which writes the messages to the standard output.</p>
- <p>Example:</p>
- <p><pre class="listing"><span class="Keyword">import</span> <span class="Identifier">packages</span><span class="Operator">/</span><span class="Identifier">docutils</span><span class="Operator">/</span><span class="Identifier">rstgen</span>
- <span class="Keyword">var</span> <span class="Identifier">gen</span><span class="Punctuation">:</span> <span class="Identifier">RstGenerator</span>
- <span class="Identifier">gen</span><span class="Operator">.</span><span class="Identifier">initRstGenerator</span><span class="Punctuation">(</span><span class="Identifier">outHtml</span><span class="Punctuation">,</span> <span class="Identifier">defaultConfig</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="StringLit">"filename"</span><span class="Punctuation">,</span> <span class="Punctuation">{</span><span class="Punctuation">}</span><span class="Punctuation">)</span></pre></p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L116" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L116" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="mergeIndexes-procs-all">
- <div id="mergeIndexes,string">
- <dt><pre><span class="Keyword">proc</span> <a href="#mergeIndexes%2Cstring"><span class="Identifier">mergeIndexes</span></a><span class="Other">(</span><span class="Identifier">dir</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Merges all index files in <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> and returns the generated index as HTML.</p>
- <p>This proc will first scan <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> for index files with the <tt class="docutils literal"><span class="pre">.idx</span></tt> extension previously created by commands like <tt class="docutils literal"><span class="pre">nim doc|rst2html</span></tt> which use the <tt class="docutils literal"><span class="pre">--index:on</span></tt> switch. These index files are the result of calls to <a class="reference external" href="#setIndexTerm,RstGenerator,string,string,string,string,string">setIndexTerm()</a> and <a class="reference external" href="#writeIndexFile,RstGenerator,string">writeIndexFile()</a>, so they are simple tab separated files.</p>
- <p>As convention this proc will split index files into two categories: documentation and API. API indices will be all joined together into a single big sorted index, making the bulk of the final index. This is good for API documentation because many symbols are repeated in different modules. On the other hand, documentation indices are essentially table of contents plus a few special markers. These documents will be rendered in a separate section which tries to maintain the order and hierarchy of the symbols in the index file.</p>
- <p>To differentiate between a documentation and API file a convention is used: indices which contain one entry without the HTML hash character (#) will be considered <tt class="docutils literal"><span class="pre"><span class="Identifier">documentation</span></span></tt>, since this hash-less entry is the explicit title of the document. Indices without this explicit entry will be considered <tt class="docutils literal"><span class="pre"><span class="Identifier">generated</span> <span class="Identifier">API</span></span></tt> extracted out of a source <tt class="docutils literal"><span class="pre">.nim</span></tt> file.</p>
- <p>Returns the merged and sorted indices into a single HTML block which can be further embedded into nimdoc templates.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L624" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L624" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="nextSplitPoint-procs-all">
- <div id="nextSplitPoint,string,int">
- <dt><pre><span class="Keyword">proc</span> <a href="#nextSplitPoint%2Cstring%2Cint"><span class="Identifier">nextSplitPoint</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">start</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L240" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L240" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="prettyLink-procs-all">
- <div id="prettyLink,string">
- <dt><pre><span class="Keyword">proc</span> <a href="#prettyLink%2Cstring"><span class="Identifier">prettyLink</span></a><span class="Other">(</span><span class="Identifier">file</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L107" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L107" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="readIndexDir-procs-all">
- <div id="readIndexDir,string">
- <dt><pre><span class="Keyword">proc</span> <a href="#readIndexDir%2Cstring"><span class="Identifier">readIndexDir</span></a><span class="Other">(</span><span class="Identifier">dir</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">modules</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">symbols</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="rstidx.html#IndexEntry"><span class="Identifier">IndexEntry</span></a><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">docs</span><span class="Other">:</span> <a href="rstgen.html#IndexedDocs"><span class="Identifier">IndexedDocs</span></a><span class="Other">]</span> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Walks <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> reading <tt class="docutils literal"><span class="pre">.idx</span></tt> files converting them in IndexEntry items.</p>
- <p>Returns the list of found module names, the list of free symbol entries and the different documentation indexes. The list of modules is sorted. See the documentation of <tt class="docutils literal"><span class="pre">mergeIndexes</span></tt> for details.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L577" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L577" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="renderCodeLang-procs-all">
- <div id="renderCodeLang,string,SourceLanguage,string,OutputTarget">
- <dt><pre><span class="Keyword">proc</span> <a href="#renderCodeLang%2Cstring%2CSourceLanguage%2Cstring%2COutputTarget"><span class="Identifier">renderCodeLang</span></a><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">lang</span><span class="Other">:</span> <a href="highlite.html#SourceLanguage"><span class="Identifier">SourceLanguage</span></a><span class="Other">;</span> <span class="Identifier">code</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span>
- <span class="Identifier">target</span><span class="Other">:</span> <a href="rstgen.html#OutputTarget"><span class="Identifier">OutputTarget</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L919" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L919" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="renderIndexTerm-procs-all">
- <div id="renderIndexTerm,PDoc,PRstNode,string">
- <dt><pre><span class="Keyword">proc</span> <a href="#renderIndexTerm%2CPDoc%2CPRstNode%2Cstring"><span class="Identifier">renderIndexTerm</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <span class="Identifier">PDoc</span><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="rstast.html#PRstNode"><span class="Identifier">PRstNode</span></a><span class="Other">;</span> <span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Renders the string decorated within `foobar`:idx: markers.</p>
- <p>Additionally adds the enclosed text to the index as a term. Since we are interested in different instances of the same term to have different entries, a table is used to keep track of the amount of times a term has previously appeared to give a different identifier value for each.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L372" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L372" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="renderNimCode-procs-all">
- <div id="renderNimCode,string,string,OutputTarget">
- <dt><pre><span class="Keyword">proc</span> <a href="#renderNimCode%2Cstring%2Cstring%2COutputTarget"><span class="Identifier">renderNimCode</span></a><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">code</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">target</span><span class="Other">:</span> <a href="rstgen.html#OutputTarget"><span class="Identifier">OutputTarget</span></a><span class="Other">)</span> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L935" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L935" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="renderRstToOut-procs-all">
- <div id="renderRstToOut,RstGenerator,PRstNode,string">
- <dt><pre><span class="Keyword">proc</span> <a href="#renderRstToOut%2CRstGenerator%2CPRstNode%2Cstring"><span class="Identifier">renderRstToOut</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="rstgen.html#RstGenerator"><span class="Identifier">RstGenerator</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="rstast.html#PRstNode"><span class="Identifier">PRstNode</span></a><span class="Other">;</span> <span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Writes into <tt class="docutils literal"><span class="pre">result</span></tt> the rst ast <tt class="docutils literal"><span class="pre">n</span></tt> using the <tt class="docutils literal"><span class="pre">d</span></tt> configuration.</p>
- <p>Before using this proc you need to initialise a <tt class="docutils literal"><span class="pre">RstGenerator</span></tt> with <tt class="docutils literal"><span class="pre">initRstGenerator</span></tt> and parse a rst file with <tt class="docutils literal"><span class="pre">rstParse</span></tt> from the <a class="reference external" href="rst.html">packages/docutils/rst module</a>. Example:</p>
- <p><pre class="listing"><span class="Comment"># ...configure gen and rst vars...</span>
- <span class="Keyword">var</span> <span class="Identifier">generatedHtml</span> <span class="Operator">=</span> <span class="StringLit">""</span>
- <span class="Identifier">renderRstToOut</span><span class="Punctuation">(</span><span class="Identifier">gen</span><span class="Punctuation">,</span> <span class="Identifier">rst</span><span class="Punctuation">,</span> <span class="Identifier">generatedHtml</span><span class="Punctuation">)</span>
- <span class="Identifier">echo</span> <span class="Identifier">generatedHtml</span></pre></p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L287" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L287" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="renderTocEntries-procs-all">
- <div id="renderTocEntries,RstGenerator,int,int,string">
- <dt><pre><span class="Keyword">proc</span> <a href="#renderTocEntries%2CRstGenerator%2Cint%2Cint%2Cstring"><span class="Identifier">renderTocEntries</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="rstgen.html#RstGenerator"><span class="Identifier">RstGenerator</span></a><span class="Other">;</span> <span class="Identifier">j</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">;</span> <span class="Identifier">lvl</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">;</span>
- <span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
-
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L732" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L732" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="rstToHtml-procs-all">
- <div id="rstToHtml,string,RstParseOptions,StringTableRef,MsgHandler">
- <dt><pre><span class="Keyword">proc</span> <a href="#rstToHtml%2Cstring%2CRstParseOptions%2CStringTableRef%2CMsgHandler"><span class="Identifier">rstToHtml</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">options</span><span class="Other">:</span> <a href="rst.html#RstParseOptions"><span class="Identifier">RstParseOptions</span></a><span class="Other">;</span> <span class="Identifier">config</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span>
- <span class="Identifier">msgHandler</span><span class="Other">:</span> <a href="rst.html#MsgHandler"><span class="Identifier">MsgHandler</span></a> <span class="Other">=</span> <span class="Identifier">rst</span><span class="Other">.</span><span class="Identifier">defaultMsgHandler</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span>
- <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Converts an input rst string into embeddable HTML.</p>
- <p>This convenience proc parses any input string using rst markup (it doesn't have to be a full document!) and returns an embeddable piece of HTML. The proc is meant to be used in <em>online</em> environments without access to a meaningful filesystem, and therefore rst <tt class="docutils literal"><span class="pre">include</span></tt> like directives won't work. For an explanation of the <tt class="docutils literal"><span class="pre">config</span></tt> parameter see the <tt class="docutils literal"><span class="pre">initRstGenerator</span></tt> proc. Example:</p>
- <p><pre class="listing"><span class="Keyword">import</span> <span class="Identifier">packages</span><span class="Operator">/</span><span class="Identifier">docutils</span><span class="Operator">/</span><span class="Identifier">rstgen</span><span class="Punctuation">,</span> <span class="Identifier">strtabs</span>
- <span class="Identifier">echo</span> <span class="Identifier">rstToHtml</span><span class="Punctuation">(</span><span class="StringLit">"*Hello* **world**!"</span><span class="Punctuation">,</span> <span class="Punctuation">{</span><span class="Punctuation">}</span><span class="Punctuation">,</span>
- <span class="Identifier">newStringTable</span><span class="Punctuation">(</span><span class="Identifier">modeStyleInsensitive</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
- <span class="Comment"># --> <em>Hello</em> <strong>world</strong>!</span></pre></p>
- <p>If you need to allow the rst <tt class="docutils literal"><span class="pre">include</span></tt> directive or tweak the generated output you have to create your own <tt class="docutils literal"><span class="pre">RstGenerator</span></tt> with <tt class="docutils literal"><span class="pre">initRstGenerator</span></tt> and related procs.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L1513" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L1513" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="rstToLatex-procs-all">
- <div id="rstToLatex,string,RstParseOptions">
- <dt><pre><span class="Keyword">proc</span> <a href="#rstToLatex%2Cstring%2CRstParseOptions"><span class="Identifier">rstToLatex</span></a><span class="Other">(</span><span class="Identifier">rstSource</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">options</span><span class="Other">:</span> <a href="rst.html#RstParseOptions"><span class="Identifier">RstParseOptions</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span>
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- Convenience proc for <tt class="docutils literal"><span class="pre"><span class="Identifier">renderRstToOut</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">initRstGenerator</span></span></tt>.
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">rstToLatex</span><span class="Punctuation">(</span><span class="StringLit">"*Hello* **world**"</span><span class="Punctuation">,</span> <span class="Punctuation">{</span><span class="Punctuation">}</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="LongStringLit">"""\emph{Hello} \textbf{world}"""</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L1555" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L1555" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="setIndexTerm-procs-all">
- <div id="setIndexTerm,RstGenerator,IndexEntryKind,string,string,string,string,string,int">
- <dt><pre><span class="Keyword">proc</span> <a href="#setIndexTerm%2CRstGenerator%2CIndexEntryKind%2Cstring%2Cstring%2Cstring%2Cstring%2Cstring%2Cint"><span class="Identifier">setIndexTerm</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="rstgen.html#RstGenerator"><span class="Identifier">RstGenerator</span></a><span class="Other">;</span> <span class="Identifier">k</span><span class="Other">:</span> <a href="rstidx.html#IndexEntryKind"><span class="Identifier">IndexEntryKind</span></a><span class="Other">;</span>
- <span class="Identifier">htmlFile</span><span class="Other">,</span> <span class="Identifier">id</span><span class="Other">,</span> <span class="Identifier">term</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">linkTitle</span><span class="Other">,</span> <span class="Identifier">linkDesc</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">;</span> <span class="Identifier">line</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span> {.
- <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Adds a <tt class="docutils literal"><span class="pre"><span class="Identifier">term</span></span></tt> to the index using the specified hyperlink identifier.</p>
- <p>A new entry will be added to the index using the format <tt class="docutils literal"><span class="pre">term<tab>file#id</span></tt>. The file part will come from the <tt class="docutils literal"><span class="pre"><span class="Identifier">htmlFile</span></span></tt> parameter.</p>
- <p>The <tt class="docutils literal"><span class="pre"><span class="Identifier">id</span></span></tt> will be appended with a hash character only if its length is not zero, otherwise no specific anchor will be generated. In general you should only pass an empty <tt class="docutils literal"><span class="pre"><span class="Identifier">id</span></span></tt> value for the title of standalone rst documents (they are special for the <a class="reference external" href="#mergeIndexes,string">mergeIndexes()</a> proc, see <a class="reference external" href="docgen.html#index-idx-file-format">Index (idx) file format</a> for more information). Unlike other index terms, title entries are inserted at the beginning of the accumulated buffer to maintain a logical order of entries.</p>
- <p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">linkTitle</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">linkDesc</span></span></tt> are not the empty string, two additional columns with their contents will be added.</p>
- <p>The index won't be written to disk unless you call <a class="reference external" href="#writeIndexFile,RstGenerator,string">writeIndexFile()</a>. The purpose of the index is documented in the <a class="reference external" href="docgen.html#related-options-index-switch">docgen tools guide</a>.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L325" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L325" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="traverseForIndex-procs-all">
- <div id="traverseForIndex,PDoc,PRstNode">
- <dt><pre><span class="Keyword">proc</span> <a href="#traverseForIndex%2CPDoc%2CPRstNode"><span class="Identifier">traverseForIndex</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <span class="Identifier">PDoc</span><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="rstast.html#PRstNode"><span class="Identifier">PRstNode</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- A version of <a class="reference internal nimdoc" title="proc renderRstToOut(d: var RstGenerator; n: PRstNode; result: var string)" href="#renderRstToOut,RstGenerator,PRstNode,string">renderRstToOut</a> that only fills entries for <tt class="docutils literal"><span class="pre">.idx</span></tt> files.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L1108" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L1108" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="writeIndexFile-procs-all">
- <div id="writeIndexFile,RstGenerator,string">
- <dt><pre><span class="Keyword">proc</span> <a href="#writeIndexFile%2CRstGenerator%2Cstring"><span class="Identifier">writeIndexFile</span></a><span class="Other">(</span><span class="Identifier">g</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="rstgen.html#RstGenerator"><span class="Identifier">RstGenerator</span></a><span class="Other">;</span> <span class="Identifier">outfile</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
- <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
- <dd>
-
- <p>Writes the current index buffer to the specified output file.</p>
- <p>You previously need to add entries to the index with the <a class="reference external" href="#setIndexTerm,RstGenerator,string,string,string,string,string">setIndexTerm()</a> proc. If the index is empty the file won't be created.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/rstgen.nim#L186" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/rstgen.nim#L186" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- </dl>
- </div>
- </div>
- </div>
- <div class="twelve-columns footer">
- <span class="nim-sprite"></span>
- <br>
- <small style="color: var(--hint);">Made with Nim. Generated: 2024-12-25 13:27:44 UTC</small>
- </div>
- </div>
- </div>
- <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
-
- </body>
- </html>
|