nimdoc.cfg 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. # This is the config file for the documentation generator.
  2. # (c) 2016 Andreas Rumpf
  3. # Feel free to edit the templates as you need. If you modify this file, it
  4. # might be worth updating the hardcoded values in packages/docutils/rstgen.nim
  5. split.item.toc = "20"
  6. # too long entries in the table of contents wrap around
  7. # after this number of characters
  8. doc.section = """
  9. <div class="section" id="$sectionID">
  10. <h1><a class="toc-backref" href="#$sectionID">$sectionTitle</a></h1>
  11. <dl class="item">
  12. $content
  13. </dl>
  14. </div>
  15. """
  16. # Just a single item in the TOC (e.g. imports, exports)
  17. doc.section.toc_item = """
  18. <li>
  19. <a class="reference reference-toplevel" href="#$sectionID" id="$sectionTitleID">$sectionTitle</a>
  20. </li>
  21. """
  22. # This is a section (e.g. procs, types) in the TOC which gets turned into a drop down
  23. doc.section.toc = """
  24. <li>
  25. <details open>
  26. <summary><a class="reference reference-toplevel" href="#$sectionID" id="$sectionTitleID">$sectionTitle</a></summary>
  27. <ul class="simple simple-toc-section">
  28. $content
  29. </ul>
  30. </details>
  31. </li>
  32. """
  33. doc.section.toc2 = """
  34. <ul class="simple nested-toc-section">$plainName
  35. $content
  36. </ul>
  37. """
  38. # Chunk of HTML emitted for each entry in the HTML table of contents.
  39. # Available variables are:
  40. # * $desc: the actual docstring of the item.
  41. # * $header: the full version of name, including types, pragmas, tags, etc.
  42. # * $header_plain: like header but without HTML (and without pragmas, tags, etc.),
  43. # for attribute embedding.
  44. # * $itemID: numerical unique entry of the item in the HTML.
  45. # * $itemSym: short symbolic name of the item for easier hyperlinking.
  46. # * $itemSymEnc: quoted version for URLs or attributes.
  47. # * $itemSymOrID: the symbolic name or the ID if that is not unique.
  48. # * $itemSymOrIDEnc: quoted version for URLs or attributes.
  49. # * $name: reduced name of the item.
  50. # * $uniqueName: name with parameters for routine types or $name for others.
  51. # * $seeSrc: generated HTML from doc.item.seesrc (if some switches are used).
  52. doc.item = """
  53. <div id="$itemSymOrID">
  54. <dt><pre>$header</pre></dt>
  55. <dd>
  56. $deprecationMsg
  57. $desc
  58. $seeSrc
  59. </dd>
  60. </div>
  61. """
  62. # A wrapper of a few overloaded `doc.item`s with the same basic name
  63. # * $header_plain - see above
  64. # * $overloadGroupName - the anchor for this whole group
  65. # * $content - string containing `doc.item`s themselves
  66. doc.item2 = """
  67. <div id="$overloadGroupName">
  68. $content
  69. </div>
  70. """
  71. # Chunk of HTML emitted for each entry in the HTML table of contents.
  72. # See doc.item for available substitution variables.
  73. # This is used for TOC items which are not overloadable (e.g. types).
  74. # `$header_plain` would be too verbose here, so we use $name.
  75. doc.item.toc = """
  76. <li><a class="reference" href="#$itemSymOrIDEnc" title="$header_plain">$name</a></li>
  77. """
  78. # This is used for TOC items which are grouped by the same name (e.g. procs).
  79. doc.item.tocTable = """
  80. <li><a class="reference" href="#$itemSymOrIDEnc" title="$header_plain">$header_plain</a></li>
  81. """
  82. # HTML rendered for doc.item's seeSrc variable. Note that this will render to
  83. # the empty string if you don't pass anything through --git.url. Available
  84. # substitutaion variables here are:
  85. # * $commit: branch/commit to use in source link.
  86. # * $devel: branch to use in edit link.
  87. # * $path: relative path to the file being processed.
  88. # * $line: line of the item in the original source file.
  89. # * $url: whatever you did pass through the --git.url switch (which also
  90. # gets variables path/line replaced!)
  91. doc.item.seesrc = """
  92. <a href="${url}/tree/${commit}/${path}#L${line}" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  93. <a href="${url}/edit/${devel}/${path}#L${line}" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  94. """
  95. doc.deprecationmsg = """
  96. <div class="deprecation-message">
  97. <b>$label</b> $message
  98. </div>
  99. """
  100. doc.toc = """
  101. <ul class="simple simple-toc" id="toc-list">
  102. $content
  103. </ul>
  104. """
  105. doc.body_toc_groupsection = """
  106. <div class="search-groupby">
  107. Group by:
  108. <select onchange="groupBy(this.value)">
  109. <option value="section">Section</option>
  110. <option value="type">Type</option>
  111. </select>
  112. </div>
  113. """
  114. @if boot:
  115. # This is enabled with the "boot" directive to generate
  116. # the compiler documentation.
  117. # As a user, tweak the block below instead.
  118. # You can add your own global-links entries
  119. doc.body_toc_group = """
  120. <div class="row">
  121. <div class="three columns">
  122. <div class="theme-select-wrapper">
  123. <label for="theme-select">Theme:&nbsp;</label>
  124. <select id="theme-select" onchange="setTheme(this.value)">
  125. <option value="auto">🌗 Match OS</option>
  126. <option value="dark">🌑 Dark</option>
  127. <option value="light">🌕 Light</option>
  128. </select>
  129. </div>
  130. <div id="global-links">
  131. <ul class="simple-boot">
  132. <li><a href="manual.html">Manual</a></li>
  133. <li><a href="lib.html">Standard library</a></li>
  134. <li> <a id="indexLink" href="$theindexhref">Index</a></li>
  135. <li><a href="compiler/$theindexhref">Compiler docs</a></li>
  136. <li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
  137. <li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
  138. </ul>
  139. </div>
  140. <div id="searchInputDiv">
  141. Search: <input type="search" id="searchInput"
  142. oninput="search()" />
  143. </div>
  144. $body_toc_groupsection
  145. $tableofcontents
  146. </div>
  147. <div class="nine columns" id="content">
  148. $seeSrc
  149. <div id="tocRoot"></div>
  150. $deprecationMsg
  151. <p class="module-desc">$moduledesc</p>
  152. $content
  153. </div>
  154. </div>
  155. """
  156. @else
  157. # keep in sink with other `doc.body_toc_group` or better, refactor
  158. doc.body_toc_group = """
  159. <div class="row">
  160. <div class="three columns">
  161. <div class="theme-select-wrapper">
  162. <label for="theme-select">Theme:&nbsp;</label>
  163. <select id="theme-select" onchange="setTheme(this.value)">
  164. <option value="auto">🌗 Match OS</option>
  165. <option value="dark">🌑 Dark</option>
  166. <option value="light">🌕 Light</option>
  167. </select>
  168. </div>
  169. <div id="global-links">
  170. <ul class="simple">
  171. <li><a id="indexLink" href="$theindexhref">Index</a></li>
  172. </ul>
  173. </div>
  174. <div id="searchInputDiv">
  175. Search: <input type="search" id="searchInput" oninput="search()"/>
  176. </div>
  177. <div>
  178. Group by:
  179. <select onchange="groupBy(this.value)">
  180. <option value="section">Section</option>
  181. <option value="type">Type</option>
  182. </select>
  183. </div>
  184. $tableofcontents
  185. </div>
  186. <div class="nine columns" id="content">
  187. $seeSrc
  188. <div id="tocRoot"></div>
  189. $deprecationMsg
  190. <p class="module-desc">$moduledesc</p>
  191. $content
  192. </div>
  193. </div>
  194. """
  195. @end
  196. doc.body_toc %= "${doc.body_toc_group}" # should only be used for boot
  197. doc.body_no_toc = """
  198. $moduledesc
  199. $content
  200. """
  201. # $1 - number of listing in document, $2 - language (e.g. langNim), $3 - anchor
  202. doc.listing_start = "<pre$3 class=\"listing\">"
  203. doc.listing_end = "</pre>"
  204. # * $analytics: Google analytics location, includes <script> tags
  205. doc.file = """<?xml version="1.0" encoding="utf-8" ?>
  206. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  207. <!-- This file is generated by Nim. -->
  208. <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  209. <head>
  210. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  211. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  212. <title>$title</title>
  213. <!-- Favicon -->
  214. <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=="/>
  215. <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=">
  216. <!-- CSS -->
  217. <link rel="stylesheet" type="text/css" href="${nimdoccss}?v=$nimVersion">
  218. <!-- JS -->
  219. <script type="text/javascript" src="${dochackjs}?v=$nimVersion"></script>
  220. </head>
  221. <body>
  222. <div class="document" id="documentId">
  223. <div class="container">
  224. <h1 class="title">$title</h1>$subtitle
  225. $content
  226. <div class="twelve-columns footer">
  227. <span class="nim-sprite"></span>
  228. <br>
  229. <small style="color: var(--hint);">Made with Nim. Generated: $date $time UTC</small>
  230. </div>
  231. </div>
  232. </div>
  233. $analytics
  234. <!-- Google fonts -->
  235. <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
  236. <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
  237. </body>
  238. </html>
  239. """