htmlparser.html 82 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <!-- This file is generated by Nim. -->
  4. <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>src/htmlparser</title>
  9. <!-- Google fonts -->
  10. <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
  11. <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
  12. <!-- Favicon -->
  13. <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=="/>
  14. <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=">
  15. <!-- CSS -->
  16. <link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
  17. <!-- JS -->
  18. <script type="text/javascript" src="dochack.js?v=2.3.1"></script>
  19. </head>
  20. <body>
  21. <div class="document" id="documentId">
  22. <div class="container">
  23. <h1 class="title">src/htmlparser</h1>
  24. <div class="row">
  25. <div class="three columns">
  26. <div class="theme-select-wrapper">
  27. <label for="theme-select">Theme:&nbsp;</label>
  28. <select id="theme-select" onchange="setTheme(this.value)">
  29. <option value="auto">🌗 Match OS</option>
  30. <option value="dark">🌑 Dark</option>
  31. <option value="light">🌕 Light</option>
  32. </select>
  33. </div>
  34. <div id="global-links">
  35. <ul class="simple-boot">
  36. <li><a href="manual.html">Manual</a></li>
  37. <li><a href="lib.html">Standard library</a></li>
  38. <li> <a id="indexLink" href="theindex.html">Index</a></li>
  39. <li><a href="compiler/theindex.html">Compiler docs</a></li>
  40. <li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
  41. <li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
  42. </ul>
  43. </div>
  44. <div id="searchInputDiv">
  45. Search: <input type="search" id="searchInput"
  46. oninput="search()" />
  47. </div>
  48. <ul class="simple simple-toc" id="toc-list">
  49. <li><a class="reference" id="examplecolon-transforming-hyperlinks_toc" href="#examplecolon-transforming-hyperlinks">Example: Transforming hyperlinks</a></li>
  50. <li>
  51. <details open>
  52. <summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
  53. <ul class="simple simple-toc-section">
  54. <li><a class="reference" href="#HtmlTag" title="HtmlTag = enum
  55. tagUnknown, ## unknown HTML element
  56. tagA, ## the HTML `a` element
  57. tagAbbr, ## the deprecated HTML `abbr` element
  58. tagAcronym, ## the HTML `acronym` element
  59. tagAddress, ## the HTML `address` element
  60. tagApplet, ## the deprecated HTML `applet` element
  61. tagArea, ## the HTML `area` element
  62. tagArticle, ## the HTML `article` element
  63. tagAside, ## the HTML `aside` element
  64. tagAudio, ## the HTML `audio` element
  65. tagB, ## the HTML `b` element
  66. tagBase, ## the HTML `base` element
  67. tagBdi, ## the HTML `bdi` element
  68. tagBdo, ## the deprecated HTML `dbo` element
  69. tagBasefont, ## the deprecated HTML `basefont` element
  70. tagBig, ## the HTML `big` element
  71. tagBlockquote, ## the HTML `blockquote` element
  72. tagBody, ## the HTML `body` element
  73. tagBr, ## the HTML `br` element
  74. tagButton, ## the HTML `button` element
  75. tagCanvas, ## the HTML `canvas` element
  76. tagCaption, ## the HTML `caption` element
  77. tagCenter, ## the deprecated HTML `center` element
  78. tagCite, ## the HTML `cite` element
  79. tagCode, ## the HTML `code` element
  80. tagCol, ## the HTML `col` element
  81. tagColgroup, ## the HTML `colgroup` element
  82. tagCommand, ## the HTML `command` element
  83. tagDatalist, ## the HTML `datalist` element
  84. tagDd, ## the HTML `dd` element
  85. tagDel, ## the HTML `del` element
  86. tagDetails, ## the HTML `details` element
  87. tagDfn, ## the HTML `dfn` element
  88. tagDialog, ## the HTML `dialog` element
  89. tagDiv, ## the HTML `div` element
  90. tagDir, ## the deprecated HTLM `dir` element
  91. tagDl, ## the HTML `dl` element
  92. tagDt, ## the HTML `dt` element
  93. tagEm, ## the HTML `em` element
  94. tagEmbed, ## the HTML `embed` element
  95. tagFieldset, ## the HTML `fieldset` element
  96. tagFigcaption, ## the HTML `figcaption` element
  97. tagFigure, ## the HTML `figure` element
  98. tagFont, ## the deprecated HTML `font` element
  99. tagFooter, ## the HTML `footer` element
  100. tagForm, ## the HTML `form` element
  101. tagFrame, ## the HTML `frame` element
  102. tagFrameset, ## the deprecated HTML `frameset` element
  103. tagH1, ## the HTML `h1` element
  104. tagH2, ## the HTML `h2` element
  105. tagH3, ## the HTML `h3` element
  106. tagH4, ## the HTML `h4` element
  107. tagH5, ## the HTML `h5` element
  108. tagH6, ## the HTML `h6` element
  109. tagHead, ## the HTML `head` element
  110. tagHeader, ## the HTML `header` element
  111. tagHgroup, ## the HTML `hgroup` element
  112. tagHtml, ## the HTML `html` element
  113. tagHr, ## the HTML `hr` element
  114. tagI, ## the HTML `i` element
  115. tagIframe, ## the deprecated HTML `iframe` element
  116. tagImg, ## the HTML `img` element
  117. tagInput, ## the HTML `input` element
  118. tagIns, ## the HTML `ins` element
  119. tagIsindex, ## the deprecated HTML `isindex` element
  120. tagKbd, ## the HTML `kbd` element
  121. tagKeygen, ## the HTML `keygen` element
  122. tagLabel, ## the HTML `label` element
  123. tagLegend, ## the HTML `legend` element
  124. tagLi, ## the HTML `li` element
  125. tagLink, ## the HTML `link` element
  126. tagMap, ## the HTML `map` element
  127. tagMark, ## the HTML `mark` element
  128. tagMenu, ## the deprecated HTML `menu` element
  129. tagMeta, ## the HTML `meta` element
  130. tagMeter, ## the HTML `meter` element
  131. tagNav, ## the HTML `nav` element
  132. tagNobr, ## the deprecated HTML `nobr` element
  133. tagNoframes, ## the deprecated HTML `noframes` element
  134. tagNoscript, ## the HTML `noscript` element
  135. tagObject, ## the HTML `object` element
  136. tagOl, ## the HTML `ol` element
  137. tagOptgroup, ## the HTML `optgroup` element
  138. tagOption, ## the HTML `option` element
  139. tagOutput, ## the HTML `output` element
  140. tagP, ## the HTML `p` element
  141. tagParam, ## the HTML `param` element
  142. tagPre, ## the HTML `pre` element
  143. tagProgress, ## the HTML `progress` element
  144. tagQ, ## the HTML `q` element
  145. tagRp, ## the HTML `rp` element
  146. tagRt, ## the HTML `rt` element
  147. tagRuby, ## the HTML `ruby` element
  148. tagS, ## the deprecated HTML `s` element
  149. tagSamp, ## the HTML `samp` element
  150. tagScript, ## the HTML `script` element
  151. tagSection, ## the HTML `section` element
  152. tagSelect, ## the HTML `select` element
  153. tagSmall, ## the HTML `small` element
  154. tagSource, ## the HTML `source` element
  155. tagSpan, ## the HTML `span` element
  156. tagStrike, ## the deprecated HTML `strike` element
  157. tagStrong, ## the HTML `strong` element
  158. tagStyle, ## the HTML `style` element
  159. tagSub, ## the HTML `sub` element
  160. tagSummary, ## the HTML `summary` element
  161. tagSup, ## the HTML `sup` element
  162. tagTable, ## the HTML `table` element
  163. tagTbody, ## the HTML `tbody` element
  164. tagTd, ## the HTML `td` element
  165. tagTextarea, ## the HTML `textarea` element
  166. tagTfoot, ## the HTML `tfoot` element
  167. tagTh, ## the HTML `th` element
  168. tagThead, ## the HTML `thead` element
  169. tagTime, ## the HTML `time` element
  170. tagTitle, ## the HTML `title` element
  171. tagTr, ## the HTML `tr` element
  172. tagTrack, ## the HTML `track` element
  173. tagTt, ## the HTML `tt` element
  174. tagU, ## the deprecated HTML `u` element
  175. tagUl, ## the HTML `ul` element
  176. tagVar, ## the HTML `var` element
  177. tagVideo, ## the HTML `video` element
  178. tagWbr ## the HTML `wbr` element">HtmlTag</a></li>
  179. </ul>
  180. </details>
  181. </li>
  182. <li>
  183. <details open>
  184. <summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
  185. <ul class="simple simple-toc-section">
  186. <li><a class="reference" href="#BlockTags" title="BlockTags = {tagAddress, tagBlockquote, tagCenter, tagDel, tagDir, tagDiv,
  187. tagDl, tagFieldset, tagForm, tagH1, tagH2, tagH3, tagH4, tagH5,
  188. tagH6, tagHr, tagIns, tagIsindex, tagMenu, tagNoframes,
  189. tagNoscript, tagOl, tagP, tagPre, tagTable, tagUl, tagCenter,
  190. tagDir, tagIsindex, tagMenu, tagNoframes}">BlockTags</a></li>
  191. <li><a class="reference" href="#InlineTags" title="InlineTags = {tagA, tagAbbr, tagAcronym, tagApplet, tagB, tagBasefont, tagBdo,
  192. tagBig, tagBr, tagButton, tagCite, tagCode, tagDel, tagDfn, tagEm,
  193. tagFont, tagI, tagImg, tagIns, tagInput, tagIframe, tagKbd,
  194. tagLabel, tagMap, tagObject, tagQ, tagSamp, tagScript, tagSelect,
  195. tagSmall, tagSpan, tagStrong, tagSub, tagSup, tagTextarea, tagTt,
  196. tagVar, tagApplet, tagBasefont, tagFont, tagIframe, tagU, tagS,
  197. tagStrike, tagWbr}">InlineTags</a></li>
  198. <li><a class="reference" href="#SingleTags" title="SingleTags = {tagArea, tagBase, tagBasefont, tagBr, tagCol, tagFrame, tagHr,
  199. tagImg, tagIsindex, tagLink, tagMeta, tagParam, tagWbr, tagSource}">SingleTags</a></li>
  200. <li><a class="reference" href="#tagToStr" title="tagToStr = [&quot;a&quot;, &quot;abbr&quot;, &quot;acronym&quot;, &quot;address&quot;, &quot;applet&quot;, &quot;area&quot;, &quot;article&quot;,
  201. &quot;aside&quot;, &quot;audio&quot;, &quot;b&quot;, &quot;base&quot;, &quot;basefont&quot;, &quot;bdi&quot;, &quot;bdo&quot;, &quot;big&quot;,
  202. &quot;blockquote&quot;, &quot;body&quot;, &quot;br&quot;, &quot;button&quot;, &quot;canvas&quot;, &quot;caption&quot;, &quot;center&quot;,
  203. &quot;cite&quot;, &quot;code&quot;, &quot;col&quot;, &quot;colgroup&quot;, &quot;command&quot;, &quot;datalist&quot;, &quot;dd&quot;,
  204. &quot;del&quot;, &quot;details&quot;, &quot;dfn&quot;, &quot;dialog&quot;, &quot;div&quot;, &quot;dir&quot;, &quot;dl&quot;, &quot;dt&quot;, &quot;em&quot;,
  205. &quot;embed&quot;, &quot;fieldset&quot;, &quot;figcaption&quot;, &quot;figure&quot;, &quot;font&quot;, &quot;footer&quot;,
  206. &quot;form&quot;, &quot;frame&quot;, &quot;frameset&quot;, &quot;h1&quot;, &quot;h2&quot;, &quot;h3&quot;, &quot;h4&quot;, &quot;h5&quot;, &quot;h6&quot;,
  207. &quot;head&quot;, &quot;header&quot;, &quot;hgroup&quot;, &quot;html&quot;, &quot;hr&quot;, &quot;i&quot;, &quot;iframe&quot;, &quot;img&quot;,
  208. &quot;input&quot;, &quot;ins&quot;, &quot;isindex&quot;, &quot;kbd&quot;, &quot;keygen&quot;, &quot;label&quot;, &quot;legend&quot;, &quot;li&quot;,
  209. &quot;link&quot;, &quot;map&quot;, &quot;mark&quot;, &quot;menu&quot;, &quot;meta&quot;, &quot;meter&quot;, &quot;nav&quot;, &quot;nobr&quot;,
  210. &quot;noframes&quot;, &quot;noscript&quot;, &quot;object&quot;, &quot;ol&quot;, &quot;optgroup&quot;, &quot;option&quot;,
  211. &quot;output&quot;, &quot;p&quot;, &quot;param&quot;, &quot;pre&quot;, &quot;progress&quot;, &quot;q&quot;, &quot;rp&quot;, &quot;rt&quot;, &quot;ruby&quot;,
  212. &quot;s&quot;, &quot;samp&quot;, &quot;script&quot;, &quot;section&quot;, &quot;select&quot;, &quot;small&quot;, &quot;source&quot;,
  213. &quot;span&quot;, &quot;strike&quot;, &quot;strong&quot;, &quot;style&quot;, &quot;sub&quot;, &quot;summary&quot;, &quot;sup&quot;,
  214. &quot;table&quot;, &quot;tbody&quot;, &quot;td&quot;, &quot;textarea&quot;, &quot;tfoot&quot;, &quot;th&quot;, &quot;thead&quot;, &quot;time&quot;,
  215. &quot;title&quot;, &quot;tr&quot;, &quot;track&quot;, &quot;tt&quot;, &quot;u&quot;, &quot;ul&quot;, &quot;var&quot;, &quot;video&quot;, &quot;wbr&quot;]">tagToStr</a></li>
  216. </ul>
  217. </details>
  218. </li>
  219. <li>
  220. <details open>
  221. <summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
  222. <ul class="simple simple-toc-section">
  223. <ul class="simple nested-toc-section">entityToRune
  224. <li><a class="reference" href="#entityToRune%2Cstring" title="entityToRune(entity: string): Rune">entityToRune(entity: string): Rune</a></li>
  225. </ul>
  226. <ul class="simple nested-toc-section">entityToUtf8
  227. <li><a class="reference" href="#entityToUtf8%2Cstring" title="entityToUtf8(entity: string): string">entityToUtf8(entity: string): string</a></li>
  228. </ul>
  229. <ul class="simple nested-toc-section">htmlTag
  230. <li><a class="reference" href="#htmlTag%2CXmlNode" title="htmlTag(n: XmlNode): HtmlTag">htmlTag(n: XmlNode): HtmlTag</a></li>
  231. <li><a class="reference" href="#htmlTag%2Cstring" title="htmlTag(s: string): HtmlTag">htmlTag(s: string): HtmlTag</a></li>
  232. </ul>
  233. <ul class="simple nested-toc-section">loadHtml
  234. <li><a class="reference" href="#loadHtml%2Cstring" title="loadHtml(path: string): XmlNode">loadHtml(path: string): XmlNode</a></li>
  235. <li><a class="reference" href="#loadHtml%2Cstring%2Cseq%5Bstring%5D" title="loadHtml(path: string; errors: var seq[string]): XmlNode">loadHtml(path: string; errors: var seq[string]): XmlNode</a></li>
  236. </ul>
  237. <ul class="simple nested-toc-section">parseHtml
  238. <li><a class="reference" href="#parseHtml%2Cstring" title="parseHtml(html: string): XmlNode">parseHtml(html: string): XmlNode</a></li>
  239. <li><a class="reference" href="#parseHtml%2CStream" title="parseHtml(s: Stream): XmlNode">parseHtml(s: Stream): XmlNode</a></li>
  240. <li><a class="reference" href="#parseHtml%2CStream%2Cstring%2Cseq%5Bstring%5D" title="parseHtml(s: Stream; filename: string; errors: var seq[string]): XmlNode">parseHtml(s: Stream; filename: string; errors: var seq[string]): XmlNode</a></li>
  241. </ul>
  242. <ul class="simple nested-toc-section">runeToEntity
  243. <li><a class="reference" href="#runeToEntity%2CRune" title="runeToEntity(rune: Rune): string">runeToEntity(rune: Rune): string</a></li>
  244. </ul>
  245. </ul>
  246. </details>
  247. </li>
  248. </ul>
  249. </div>
  250. <div class="nine columns" id="content">
  251. <div id="tocRoot"></div>
  252. <p class="module-desc"><div class="admonition admonition-info"><span class="admonition-info-text"><b>Note:</b></span>
  253. In order to use this module, run <tt class="docutils literal"><span class="pre"><span class="Identifier">nimble</span> <span class="Identifier">install</span> <span class="Identifier">htmlparser</span></span></tt>.</div>
  254. <p><strong>NOTE</strong>: The behaviour might change in future versions as it is not clear what &quot;<em>wild</em> HTML the real world uses&quot; really implies.</p>
  255. <p>It can be used to parse a wild HTML document and output it as valid XHTML document (well, if you are lucky):</p>
  256. <p><pre class="listing"><span class="Identifier">echo</span> <span class="Identifier">loadHtml</span><span class="Punctuation">(</span><span class="StringLit">&quot;mydirty.html&quot;</span><span class="Punctuation">)</span></pre></p>
  257. <p>Every tag in the resulting tree is in lower case.</p>
  258. <p><strong>Note:</strong> The resulting <tt class="docutils literal"><span class="pre"><span class="Identifier">XmlNode</span></span></tt> already uses the <tt class="docutils literal"><span class="pre"><span class="Identifier">clientData</span></span></tt> field, so it cannot be used by clients of this library.</p>
  259. <h1><a class="toc-backref" id="examplecolon-transforming-hyperlinks" href="#examplecolon-transforming-hyperlinks">Example: Transforming hyperlinks</a></h1><p>This code demonstrates how you can iterate over all the tags in an HTML file and write back the modified version. In this case we look for hyperlinks ending with the extension <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">rst</span></span></tt> and convert them to <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">html</span></span></tt>.</p>
  260. <p><pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">xmltree</span> <span class="Comment"># To use '$' for XmlNode</span>
  261. <span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">strtabs</span> <span class="Comment"># To access XmlAttributes</span>
  262. <span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">os</span> <span class="Comment"># To use splitFile</span>
  263. <span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">strutils</span> <span class="Comment"># To use cmpIgnoreCase</span>
  264. <span class="Keyword">proc</span> <span class="Identifier">transformHyperlinks</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">=</span>
  265. <span class="Keyword">let</span> <span class="Identifier">html</span> <span class="Operator">=</span> <span class="Identifier">loadHtml</span><span class="Punctuation">(</span><span class="StringLit">&quot;input.html&quot;</span><span class="Punctuation">)</span>
  266. <span class="Keyword">for</span> <span class="Identifier">a</span> <span class="Keyword">in</span> <span class="Identifier">html</span><span class="Operator">.</span><span class="Identifier">findAll</span><span class="Punctuation">(</span><span class="StringLit">&quot;a&quot;</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
  267. <span class="Keyword">if</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">attrs</span><span class="Operator">.</span><span class="Identifier">hasKey</span> <span class="StringLit">&quot;href&quot;</span><span class="Punctuation">:</span>
  268. <span class="Keyword">let</span> <span class="Punctuation">(</span><span class="Identifier">dir</span><span class="Punctuation">,</span> <span class="Identifier">filename</span><span class="Punctuation">,</span> <span class="Identifier">ext</span><span class="Punctuation">)</span> <span class="Operator">=</span> <span class="Identifier">splitFile</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">attrs</span><span class="Punctuation">[</span><span class="StringLit">&quot;href&quot;</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
  269. <span class="Keyword">if</span> <span class="Identifier">cmpIgnoreCase</span><span class="Punctuation">(</span><span class="Identifier">ext</span><span class="Punctuation">,</span> <span class="StringLit">&quot;.rst&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span><span class="Punctuation">:</span>
  270. <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">attrs</span><span class="Punctuation">[</span><span class="StringLit">&quot;href&quot;</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Identifier">dir</span> <span class="Operator">/</span> <span class="Identifier">filename</span> <span class="Operator">&amp;</span> <span class="StringLit">&quot;.html&quot;</span>
  271. <span class="Identifier">writeFile</span><span class="Punctuation">(</span><span class="StringLit">&quot;output.html&quot;</span><span class="Punctuation">,</span> <span class="Operator">$</span><span class="Identifier">html</span><span class="Punctuation">)</span></pre></p>
  272. </p>
  273. <div class="section" id="7">
  274. <h1><a class="toc-backref" href="#7">Types</a></h1>
  275. <dl class="item">
  276. <div id="HtmlTag">
  277. <dt><pre><a href="htmlparser.html#HtmlTag"><span class="Identifier">HtmlTag</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
  278. <span class="Identifier">tagUnknown</span><span class="Other">,</span> <span class="Comment">## unknown HTML element</span>
  279. <span class="Identifier">tagA</span><span class="Other">,</span> <span class="Comment">## the HTML `a` element</span>
  280. <span class="Identifier">tagAbbr</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `abbr` element</span>
  281. <span class="Identifier">tagAcronym</span><span class="Other">,</span> <span class="Comment">## the HTML `acronym` element</span>
  282. <span class="Identifier">tagAddress</span><span class="Other">,</span> <span class="Comment">## the HTML `address` element</span>
  283. <span class="Identifier">tagApplet</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `applet` element</span>
  284. <span class="Identifier">tagArea</span><span class="Other">,</span> <span class="Comment">## the HTML `area` element</span>
  285. <span class="Identifier">tagArticle</span><span class="Other">,</span> <span class="Comment">## the HTML `article` element</span>
  286. <span class="Identifier">tagAside</span><span class="Other">,</span> <span class="Comment">## the HTML `aside` element</span>
  287. <span class="Identifier">tagAudio</span><span class="Other">,</span> <span class="Comment">## the HTML `audio` element</span>
  288. <span class="Identifier">tagB</span><span class="Other">,</span> <span class="Comment">## the HTML `b` element</span>
  289. <span class="Identifier">tagBase</span><span class="Other">,</span> <span class="Comment">## the HTML `base` element</span>
  290. <span class="Identifier">tagBdi</span><span class="Other">,</span> <span class="Comment">## the HTML `bdi` element</span>
  291. <span class="Identifier">tagBdo</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `dbo` element</span>
  292. <span class="Identifier">tagBasefont</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `basefont` element</span>
  293. <span class="Identifier">tagBig</span><span class="Other">,</span> <span class="Comment">## the HTML `big` element</span>
  294. <span class="Identifier">tagBlockquote</span><span class="Other">,</span> <span class="Comment">## the HTML `blockquote` element</span>
  295. <span class="Identifier">tagBody</span><span class="Other">,</span> <span class="Comment">## the HTML `body` element</span>
  296. <span class="Identifier">tagBr</span><span class="Other">,</span> <span class="Comment">## the HTML `br` element</span>
  297. <span class="Identifier">tagButton</span><span class="Other">,</span> <span class="Comment">## the HTML `button` element</span>
  298. <span class="Identifier">tagCanvas</span><span class="Other">,</span> <span class="Comment">## the HTML `canvas` element</span>
  299. <span class="Identifier">tagCaption</span><span class="Other">,</span> <span class="Comment">## the HTML `caption` element</span>
  300. <span class="Identifier">tagCenter</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `center` element</span>
  301. <span class="Identifier">tagCite</span><span class="Other">,</span> <span class="Comment">## the HTML `cite` element</span>
  302. <span class="Identifier">tagCode</span><span class="Other">,</span> <span class="Comment">## the HTML `code` element</span>
  303. <span class="Identifier">tagCol</span><span class="Other">,</span> <span class="Comment">## the HTML `col` element</span>
  304. <span class="Identifier">tagColgroup</span><span class="Other">,</span> <span class="Comment">## the HTML `colgroup` element</span>
  305. <span class="Identifier">tagCommand</span><span class="Other">,</span> <span class="Comment">## the HTML `command` element</span>
  306. <span class="Identifier">tagDatalist</span><span class="Other">,</span> <span class="Comment">## the HTML `datalist` element</span>
  307. <span class="Identifier">tagDd</span><span class="Other">,</span> <span class="Comment">## the HTML `dd` element</span>
  308. <span class="Identifier">tagDel</span><span class="Other">,</span> <span class="Comment">## the HTML `del` element</span>
  309. <span class="Identifier">tagDetails</span><span class="Other">,</span> <span class="Comment">## the HTML `details` element</span>
  310. <span class="Identifier">tagDfn</span><span class="Other">,</span> <span class="Comment">## the HTML `dfn` element</span>
  311. <span class="Identifier">tagDialog</span><span class="Other">,</span> <span class="Comment">## the HTML `dialog` element</span>
  312. <span class="Identifier">tagDiv</span><span class="Other">,</span> <span class="Comment">## the HTML `div` element</span>
  313. <span class="Identifier">tagDir</span><span class="Other">,</span> <span class="Comment">## the deprecated HTLM `dir` element</span>
  314. <span class="Identifier">tagDl</span><span class="Other">,</span> <span class="Comment">## the HTML `dl` element</span>
  315. <span class="Identifier">tagDt</span><span class="Other">,</span> <span class="Comment">## the HTML `dt` element</span>
  316. <span class="Identifier">tagEm</span><span class="Other">,</span> <span class="Comment">## the HTML `em` element</span>
  317. <span class="Identifier">tagEmbed</span><span class="Other">,</span> <span class="Comment">## the HTML `embed` element</span>
  318. <span class="Identifier">tagFieldset</span><span class="Other">,</span> <span class="Comment">## the HTML `fieldset` element</span>
  319. <span class="Identifier">tagFigcaption</span><span class="Other">,</span> <span class="Comment">## the HTML `figcaption` element</span>
  320. <span class="Identifier">tagFigure</span><span class="Other">,</span> <span class="Comment">## the HTML `figure` element</span>
  321. <span class="Identifier">tagFont</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `font` element</span>
  322. <span class="Identifier">tagFooter</span><span class="Other">,</span> <span class="Comment">## the HTML `footer` element</span>
  323. <span class="Identifier">tagForm</span><span class="Other">,</span> <span class="Comment">## the HTML `form` element</span>
  324. <span class="Identifier">tagFrame</span><span class="Other">,</span> <span class="Comment">## the HTML `frame` element</span>
  325. <span class="Identifier">tagFrameset</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `frameset` element</span>
  326. <span class="Identifier">tagH1</span><span class="Other">,</span> <span class="Comment">## the HTML `h1` element</span>
  327. <span class="Identifier">tagH2</span><span class="Other">,</span> <span class="Comment">## the HTML `h2` element</span>
  328. <span class="Identifier">tagH3</span><span class="Other">,</span> <span class="Comment">## the HTML `h3` element</span>
  329. <span class="Identifier">tagH4</span><span class="Other">,</span> <span class="Comment">## the HTML `h4` element</span>
  330. <span class="Identifier">tagH5</span><span class="Other">,</span> <span class="Comment">## the HTML `h5` element</span>
  331. <span class="Identifier">tagH6</span><span class="Other">,</span> <span class="Comment">## the HTML `h6` element</span>
  332. <span class="Identifier">tagHead</span><span class="Other">,</span> <span class="Comment">## the HTML `head` element</span>
  333. <span class="Identifier">tagHeader</span><span class="Other">,</span> <span class="Comment">## the HTML `header` element</span>
  334. <span class="Identifier">tagHgroup</span><span class="Other">,</span> <span class="Comment">## the HTML `hgroup` element</span>
  335. <span class="Identifier">tagHtml</span><span class="Other">,</span> <span class="Comment">## the HTML `html` element</span>
  336. <span class="Identifier">tagHr</span><span class="Other">,</span> <span class="Comment">## the HTML `hr` element</span>
  337. <span class="Identifier">tagI</span><span class="Other">,</span> <span class="Comment">## the HTML `i` element</span>
  338. <span class="Identifier">tagIframe</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `iframe` element</span>
  339. <span class="Identifier">tagImg</span><span class="Other">,</span> <span class="Comment">## the HTML `img` element</span>
  340. <span class="Identifier">tagInput</span><span class="Other">,</span> <span class="Comment">## the HTML `input` element</span>
  341. <span class="Identifier">tagIns</span><span class="Other">,</span> <span class="Comment">## the HTML `ins` element</span>
  342. <span class="Identifier">tagIsindex</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `isindex` element</span>
  343. <span class="Identifier">tagKbd</span><span class="Other">,</span> <span class="Comment">## the HTML `kbd` element</span>
  344. <span class="Identifier">tagKeygen</span><span class="Other">,</span> <span class="Comment">## the HTML `keygen` element</span>
  345. <span class="Identifier">tagLabel</span><span class="Other">,</span> <span class="Comment">## the HTML `label` element</span>
  346. <span class="Identifier">tagLegend</span><span class="Other">,</span> <span class="Comment">## the HTML `legend` element</span>
  347. <span class="Identifier">tagLi</span><span class="Other">,</span> <span class="Comment">## the HTML `li` element</span>
  348. <span class="Identifier">tagLink</span><span class="Other">,</span> <span class="Comment">## the HTML `link` element</span>
  349. <span class="Identifier">tagMap</span><span class="Other">,</span> <span class="Comment">## the HTML `map` element</span>
  350. <span class="Identifier">tagMark</span><span class="Other">,</span> <span class="Comment">## the HTML `mark` element</span>
  351. <span class="Identifier">tagMenu</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `menu` element</span>
  352. <span class="Identifier">tagMeta</span><span class="Other">,</span> <span class="Comment">## the HTML `meta` element</span>
  353. <span class="Identifier">tagMeter</span><span class="Other">,</span> <span class="Comment">## the HTML `meter` element</span>
  354. <span class="Identifier">tagNav</span><span class="Other">,</span> <span class="Comment">## the HTML `nav` element</span>
  355. <span class="Identifier">tagNobr</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `nobr` element</span>
  356. <span class="Identifier">tagNoframes</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `noframes` element</span>
  357. <span class="Identifier">tagNoscript</span><span class="Other">,</span> <span class="Comment">## the HTML `noscript` element</span>
  358. <span class="Identifier">tagObject</span><span class="Other">,</span> <span class="Comment">## the HTML `object` element</span>
  359. <span class="Identifier">tagOl</span><span class="Other">,</span> <span class="Comment">## the HTML `ol` element</span>
  360. <span class="Identifier">tagOptgroup</span><span class="Other">,</span> <span class="Comment">## the HTML `optgroup` element</span>
  361. <span class="Identifier">tagOption</span><span class="Other">,</span> <span class="Comment">## the HTML `option` element</span>
  362. <span class="Identifier">tagOutput</span><span class="Other">,</span> <span class="Comment">## the HTML `output` element</span>
  363. <span class="Identifier">tagP</span><span class="Other">,</span> <span class="Comment">## the HTML `p` element</span>
  364. <span class="Identifier">tagParam</span><span class="Other">,</span> <span class="Comment">## the HTML `param` element</span>
  365. <span class="Identifier">tagPre</span><span class="Other">,</span> <span class="Comment">## the HTML `pre` element</span>
  366. <span class="Identifier">tagProgress</span><span class="Other">,</span> <span class="Comment">## the HTML `progress` element</span>
  367. <span class="Identifier">tagQ</span><span class="Other">,</span> <span class="Comment">## the HTML `q` element</span>
  368. <span class="Identifier">tagRp</span><span class="Other">,</span> <span class="Comment">## the HTML `rp` element</span>
  369. <span class="Identifier">tagRt</span><span class="Other">,</span> <span class="Comment">## the HTML `rt` element</span>
  370. <span class="Identifier">tagRuby</span><span class="Other">,</span> <span class="Comment">## the HTML `ruby` element</span>
  371. <span class="Identifier">tagS</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `s` element</span>
  372. <span class="Identifier">tagSamp</span><span class="Other">,</span> <span class="Comment">## the HTML `samp` element</span>
  373. <span class="Identifier">tagScript</span><span class="Other">,</span> <span class="Comment">## the HTML `script` element</span>
  374. <span class="Identifier">tagSection</span><span class="Other">,</span> <span class="Comment">## the HTML `section` element</span>
  375. <span class="Identifier">tagSelect</span><span class="Other">,</span> <span class="Comment">## the HTML `select` element</span>
  376. <span class="Identifier">tagSmall</span><span class="Other">,</span> <span class="Comment">## the HTML `small` element</span>
  377. <span class="Identifier">tagSource</span><span class="Other">,</span> <span class="Comment">## the HTML `source` element</span>
  378. <span class="Identifier">tagSpan</span><span class="Other">,</span> <span class="Comment">## the HTML `span` element</span>
  379. <span class="Identifier">tagStrike</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `strike` element</span>
  380. <span class="Identifier">tagStrong</span><span class="Other">,</span> <span class="Comment">## the HTML `strong` element</span>
  381. <span class="Identifier">tagStyle</span><span class="Other">,</span> <span class="Comment">## the HTML `style` element</span>
  382. <span class="Identifier">tagSub</span><span class="Other">,</span> <span class="Comment">## the HTML `sub` element</span>
  383. <span class="Identifier">tagSummary</span><span class="Other">,</span> <span class="Comment">## the HTML `summary` element</span>
  384. <span class="Identifier">tagSup</span><span class="Other">,</span> <span class="Comment">## the HTML `sup` element</span>
  385. <span class="Identifier">tagTable</span><span class="Other">,</span> <span class="Comment">## the HTML `table` element</span>
  386. <span class="Identifier">tagTbody</span><span class="Other">,</span> <span class="Comment">## the HTML `tbody` element</span>
  387. <span class="Identifier">tagTd</span><span class="Other">,</span> <span class="Comment">## the HTML `td` element</span>
  388. <span class="Identifier">tagTextarea</span><span class="Other">,</span> <span class="Comment">## the HTML `textarea` element</span>
  389. <span class="Identifier">tagTfoot</span><span class="Other">,</span> <span class="Comment">## the HTML `tfoot` element</span>
  390. <span class="Identifier">tagTh</span><span class="Other">,</span> <span class="Comment">## the HTML `th` element</span>
  391. <span class="Identifier">tagThead</span><span class="Other">,</span> <span class="Comment">## the HTML `thead` element</span>
  392. <span class="Identifier">tagTime</span><span class="Other">,</span> <span class="Comment">## the HTML `time` element</span>
  393. <span class="Identifier">tagTitle</span><span class="Other">,</span> <span class="Comment">## the HTML `title` element</span>
  394. <span class="Identifier">tagTr</span><span class="Other">,</span> <span class="Comment">## the HTML `tr` element</span>
  395. <span class="Identifier">tagTrack</span><span class="Other">,</span> <span class="Comment">## the HTML `track` element</span>
  396. <span class="Identifier">tagTt</span><span class="Other">,</span> <span class="Comment">## the HTML `tt` element</span>
  397. <span class="Identifier">tagU</span><span class="Other">,</span> <span class="Comment">## the deprecated HTML `u` element</span>
  398. <span class="Identifier">tagUl</span><span class="Other">,</span> <span class="Comment">## the HTML `ul` element</span>
  399. <span class="Identifier">tagVar</span><span class="Other">,</span> <span class="Comment">## the HTML `var` element</span>
  400. <span class="Identifier">tagVideo</span><span class="Other">,</span> <span class="Comment">## the HTML `video` element</span>
  401. <span class="Identifier">tagWbr</span> <span class="Comment">## the HTML `wbr` element</span></pre></dt>
  402. <dd>
  403. list of all supported HTML tags; order will always be alphabetically
  404. </dd>
  405. </div>
  406. </dl>
  407. </div>
  408. <div class="section" id="10">
  409. <h1><a class="toc-backref" href="#10">Consts</a></h1>
  410. <dl class="item">
  411. <div id="BlockTags">
  412. <dt><pre><a href="htmlparser.html#BlockTags"><span class="Identifier">BlockTags</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">tagAddress</span><span class="Other">,</span> <span class="DecNumber">tagBlockquote</span><span class="Other">,</span> <span class="DecNumber">tagCenter</span><span class="Other">,</span> <span class="DecNumber">tagDel</span><span class="Other">,</span> <span class="DecNumber">tagDir</span><span class="Other">,</span> <span class="DecNumber">tagDiv</span><span class="Other">,</span>
  413. <span class="DecNumber">tagDl</span><span class="Other">,</span> <span class="DecNumber">tagFieldset</span><span class="Other">,</span> <span class="DecNumber">tagForm</span><span class="Other">,</span> <span class="DecNumber">tagH1</span><span class="Other">,</span> <span class="DecNumber">tagH2</span><span class="Other">,</span> <span class="DecNumber">tagH3</span><span class="Other">,</span> <span class="DecNumber">tagH4</span><span class="Other">,</span> <span class="DecNumber">tagH5</span><span class="Other">,</span>
  414. <span class="DecNumber">tagH6</span><span class="Other">,</span> <span class="DecNumber">tagHr</span><span class="Other">,</span> <span class="DecNumber">tagIns</span><span class="Other">,</span> <span class="DecNumber">tagIsindex</span><span class="Other">,</span> <span class="DecNumber">tagMenu</span><span class="Other">,</span> <span class="DecNumber">tagNoframes</span><span class="Other">,</span>
  415. <span class="DecNumber">tagNoscript</span><span class="Other">,</span> <span class="DecNumber">tagOl</span><span class="Other">,</span> <span class="DecNumber">tagP</span><span class="Other">,</span> <span class="DecNumber">tagPre</span><span class="Other">,</span> <span class="DecNumber">tagTable</span><span class="Other">,</span> <span class="DecNumber">tagUl</span><span class="Other">,</span> <span class="DecNumber">tagCenter</span><span class="Other">,</span>
  416. <span class="DecNumber">tagDir</span><span class="Other">,</span> <span class="DecNumber">tagIsindex</span><span class="Other">,</span> <span class="DecNumber">tagMenu</span><span class="Other">,</span> <span class="DecNumber">tagNoframes</span><span class="Other">}</span></pre></dt>
  417. <dd>
  418. </dd>
  419. </div>
  420. <div id="InlineTags">
  421. <dt><pre><a href="htmlparser.html#InlineTags"><span class="Identifier">InlineTags</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">tagA</span><span class="Other">,</span> <span class="DecNumber">tagAbbr</span><span class="Other">,</span> <span class="DecNumber">tagAcronym</span><span class="Other">,</span> <span class="DecNumber">tagApplet</span><span class="Other">,</span> <span class="DecNumber">tagB</span><span class="Other">,</span> <span class="DecNumber">tagBasefont</span><span class="Other">,</span> <span class="DecNumber">tagBdo</span><span class="Other">,</span>
  422. <span class="DecNumber">tagBig</span><span class="Other">,</span> <span class="DecNumber">tagBr</span><span class="Other">,</span> <span class="DecNumber">tagButton</span><span class="Other">,</span> <span class="DecNumber">tagCite</span><span class="Other">,</span> <span class="DecNumber">tagCode</span><span class="Other">,</span> <span class="DecNumber">tagDel</span><span class="Other">,</span> <span class="DecNumber">tagDfn</span><span class="Other">,</span> <span class="DecNumber">tagEm</span><span class="Other">,</span>
  423. <span class="DecNumber">tagFont</span><span class="Other">,</span> <span class="DecNumber">tagI</span><span class="Other">,</span> <span class="DecNumber">tagImg</span><span class="Other">,</span> <span class="DecNumber">tagIns</span><span class="Other">,</span> <span class="DecNumber">tagInput</span><span class="Other">,</span> <span class="DecNumber">tagIframe</span><span class="Other">,</span> <span class="DecNumber">tagKbd</span><span class="Other">,</span>
  424. <span class="DecNumber">tagLabel</span><span class="Other">,</span> <span class="DecNumber">tagMap</span><span class="Other">,</span> <span class="DecNumber">tagObject</span><span class="Other">,</span> <span class="DecNumber">tagQ</span><span class="Other">,</span> <span class="DecNumber">tagSamp</span><span class="Other">,</span> <span class="DecNumber">tagScript</span><span class="Other">,</span> <span class="DecNumber">tagSelect</span><span class="Other">,</span>
  425. <span class="DecNumber">tagSmall</span><span class="Other">,</span> <span class="DecNumber">tagSpan</span><span class="Other">,</span> <span class="DecNumber">tagStrong</span><span class="Other">,</span> <span class="DecNumber">tagSub</span><span class="Other">,</span> <span class="DecNumber">tagSup</span><span class="Other">,</span> <span class="DecNumber">tagTextarea</span><span class="Other">,</span> <span class="DecNumber">tagTt</span><span class="Other">,</span>
  426. <span class="DecNumber">tagVar</span><span class="Other">,</span> <span class="DecNumber">tagApplet</span><span class="Other">,</span> <span class="DecNumber">tagBasefont</span><span class="Other">,</span> <span class="DecNumber">tagFont</span><span class="Other">,</span> <span class="DecNumber">tagIframe</span><span class="Other">,</span> <span class="DecNumber">tagU</span><span class="Other">,</span> <span class="DecNumber">tagS</span><span class="Other">,</span>
  427. <span class="DecNumber">tagStrike</span><span class="Other">,</span> <span class="DecNumber">tagWbr</span><span class="Other">}</span></pre></dt>
  428. <dd>
  429. </dd>
  430. </div>
  431. <div id="SingleTags">
  432. <dt><pre><a href="htmlparser.html#SingleTags"><span class="Identifier">SingleTags</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">tagArea</span><span class="Other">,</span> <span class="DecNumber">tagBase</span><span class="Other">,</span> <span class="DecNumber">tagBasefont</span><span class="Other">,</span> <span class="DecNumber">tagBr</span><span class="Other">,</span> <span class="DecNumber">tagCol</span><span class="Other">,</span> <span class="DecNumber">tagFrame</span><span class="Other">,</span> <span class="DecNumber">tagHr</span><span class="Other">,</span>
  433. <span class="DecNumber">tagImg</span><span class="Other">,</span> <span class="DecNumber">tagIsindex</span><span class="Other">,</span> <span class="DecNumber">tagLink</span><span class="Other">,</span> <span class="DecNumber">tagMeta</span><span class="Other">,</span> <span class="DecNumber">tagParam</span><span class="Other">,</span> <span class="DecNumber">tagWbr</span><span class="Other">,</span> <span class="DecNumber">tagSource</span><span class="Other">}</span></pre></dt>
  434. <dd>
  435. </dd>
  436. </div>
  437. <div id="tagToStr">
  438. <dt><pre><a href="htmlparser.html#tagToStr"><span class="Identifier">tagToStr</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="StringLit">&quot;a&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;abbr&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;acronym&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;address&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;applet&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;area&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;article&quot;</span><span class="Other">,</span>
  439. <span class="StringLit">&quot;aside&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;audio&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;b&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;base&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;basefont&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;bdi&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;bdo&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;big&quot;</span><span class="Other">,</span>
  440. <span class="StringLit">&quot;blockquote&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;body&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;br&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;button&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;canvas&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;caption&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;center&quot;</span><span class="Other">,</span>
  441. <span class="StringLit">&quot;cite&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;code&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;col&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;colgroup&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;command&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;datalist&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;dd&quot;</span><span class="Other">,</span>
  442. <span class="StringLit">&quot;del&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;details&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;dfn&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;dialog&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;div&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;dir&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;dl&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;dt&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;em&quot;</span><span class="Other">,</span>
  443. <span class="StringLit">&quot;embed&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;fieldset&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;figcaption&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;figure&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;font&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;footer&quot;</span><span class="Other">,</span>
  444. <span class="StringLit">&quot;form&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;frame&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;frameset&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;h1&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;h2&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;h3&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;h4&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;h5&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;h6&quot;</span><span class="Other">,</span>
  445. <span class="StringLit">&quot;head&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;header&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;hgroup&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;html&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;hr&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;i&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;iframe&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;img&quot;</span><span class="Other">,</span>
  446. <span class="StringLit">&quot;input&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;ins&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;isindex&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;kbd&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;keygen&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;label&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;legend&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;li&quot;</span><span class="Other">,</span>
  447. <span class="StringLit">&quot;link&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;map&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;mark&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;menu&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;meta&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;meter&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;nav&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;nobr&quot;</span><span class="Other">,</span>
  448. <span class="StringLit">&quot;noframes&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;noscript&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;object&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;ol&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;optgroup&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;option&quot;</span><span class="Other">,</span>
  449. <span class="StringLit">&quot;output&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;p&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;param&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;pre&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;progress&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;q&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;rp&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;rt&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;ruby&quot;</span><span class="Other">,</span>
  450. <span class="StringLit">&quot;s&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;samp&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;script&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;section&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;select&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;small&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;source&quot;</span><span class="Other">,</span>
  451. <span class="StringLit">&quot;span&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;strike&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;strong&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;style&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;sub&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;summary&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;sup&quot;</span><span class="Other">,</span>
  452. <span class="StringLit">&quot;table&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;tbody&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;td&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;textarea&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;tfoot&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;th&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;thead&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;time&quot;</span><span class="Other">,</span>
  453. <span class="StringLit">&quot;title&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;tr&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;track&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;tt&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;u&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;ul&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;var&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;video&quot;</span><span class="Other">,</span> <span class="StringLit">&quot;wbr&quot;</span><span class="Other">]</span></pre></dt>
  454. <dd>
  455. </dd>
  456. </div>
  457. </dl>
  458. </div>
  459. <div class="section" id="12">
  460. <h1><a class="toc-backref" href="#12">Procs</a></h1>
  461. <dl class="item">
  462. <div id="entityToRune-procs-all">
  463. <div id="entityToRune,string">
  464. <dt><pre><span class="Keyword">proc</span> <a href="#entityToRune%2Cstring"><span class="Identifier">entityToRune</span></a><span class="Other">(</span><span class="Identifier">entity</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Rune</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>
  465. <dd>
  466. Converts an HTML entity name like <tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span><span class="Identifier">Uuml</span><span class="Punctuation">;</span></span></tt> or values like <tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span><span class="Comment">#220;</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span><span class="Comment">#x000DC;</span></span></tt> to its UTF-8 equivalent. Rune(0) is returned if the entity name is unknown.
  467. <p><strong class="examples_text">Example:</strong></p>
  468. <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">unicode</span>
  469. <span class="Identifier">doAssert</span> <span class="Identifier">entityToRune</span><span class="Punctuation">(</span><span class="StringLit">&quot;&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">Rune</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
  470. <span class="Identifier">doAssert</span> <span class="Identifier">entityToRune</span><span class="Punctuation">(</span><span class="StringLit">&quot;a&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">Rune</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
  471. <span class="Identifier">doAssert</span> <span class="Identifier">entityToRune</span><span class="Punctuation">(</span><span class="StringLit">&quot;gt&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;&gt;&quot;</span><span class="Operator">.</span><span class="Identifier">runeAt</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
  472. <span class="Identifier">doAssert</span> <span class="Identifier">entityToRune</span><span class="Punctuation">(</span><span class="StringLit">&quot;Uuml&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;Ü&quot;</span><span class="Operator">.</span><span class="Identifier">runeAt</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
  473. <span class="Identifier">doAssert</span> <span class="Identifier">entityToRune</span><span class="Punctuation">(</span><span class="StringLit">&quot;quest&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;?&quot;</span><span class="Operator">.</span><span class="Identifier">runeAt</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
  474. <span class="Identifier">doAssert</span> <span class="Identifier">entityToRune</span><span class="Punctuation">(</span><span class="StringLit">&quot;#x0003F&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;?&quot;</span><span class="Operator">.</span><span class="Identifier">runeAt</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span></pre>
  475. </dd>
  476. </div>
  477. </div>
  478. <div id="entityToUtf8-procs-all">
  479. <div id="entityToUtf8,string">
  480. <dt><pre><span class="Keyword">proc</span> <a href="#entityToUtf8%2Cstring"><span class="Identifier">entityToUtf8</span></a><span class="Other">(</span><span class="Identifier">entity</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</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>
  481. <dd>
  482. Converts an HTML entity name like <tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span><span class="Identifier">Uuml</span><span class="Punctuation">;</span></span></tt> or values like <tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span><span class="Comment">#220;</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span><span class="Comment">#x000DC;</span></span></tt> to its UTF-8 equivalent. &quot;&quot; is returned if the entity name is unknown. The HTML parser already converts entities to UTF-8.
  483. <p><strong class="examples_text">Example:</strong></p>
  484. <pre class="listing"><span class="Keyword">const</span> <span class="Identifier">sigma</span> <span class="Operator">=</span> <span class="StringLit">&quot;Σ&quot;</span>
  485. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;&quot;</span>
  486. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;a&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;&quot;</span>
  487. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;gt&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;&gt;&quot;</span>
  488. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;Uuml&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;Ü&quot;</span>
  489. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;quest&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;?&quot;</span>
  490. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;#63&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;?&quot;</span>
  491. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;Sigma&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">sigma</span>
  492. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;#931&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">sigma</span>
  493. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;#0931&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">sigma</span>
  494. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;#x3A3&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">sigma</span>
  495. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;#x03A3&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">sigma</span>
  496. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;#x3a3&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">sigma</span>
  497. <span class="Identifier">doAssert</span> <span class="Identifier">entityToUtf8</span><span class="Punctuation">(</span><span class="StringLit">&quot;#X3a3&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">sigma</span></pre>
  498. </dd>
  499. </div>
  500. </div>
  501. <div id="htmlTag-procs-all">
  502. <div id="htmlTag,XmlNode">
  503. <dt><pre><span class="Keyword">proc</span> <a href="#htmlTag%2CXmlNode"><span class="Identifier">htmlTag</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">XmlNode</span><span class="Other">)</span><span class="Other">:</span> <a href="htmlparser.html#HtmlTag"><span class="Identifier">HtmlTag</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>
  504. <dd>
  505. Gets <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt>'s tag as a <tt class="docutils literal"><span class="pre"><span class="Identifier">HtmlTag</span></span></tt>.
  506. </dd>
  507. </div>
  508. <div id="htmlTag,string">
  509. <dt><pre><span class="Keyword">proc</span> <a href="#htmlTag%2Cstring"><span class="Identifier">htmlTag</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="htmlparser.html#HtmlTag"><span class="Identifier">HtmlTag</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>
  510. <dd>
  511. Converts <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> to a <tt class="docutils literal"><span class="pre"><span class="Identifier">HtmlTag</span></span></tt>. If <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> is no HTML tag, <tt class="docutils literal"><span class="pre"><span class="Identifier">tagUnknown</span></span></tt> is returned.
  512. </dd>
  513. </div>
  514. </div>
  515. <div id="loadHtml-procs-all">
  516. <div id="loadHtml,string">
  517. <dt><pre><span class="Keyword">proc</span> <a href="#loadHtml%2Cstring"><span class="Identifier">loadHtml</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">XmlNode</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="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span>
  518. <span class="Identifier">Exception</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">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</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>
  519. <dd>
  520. Loads and parses HTML from file specified by <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>, and returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">XmlNode</span></span></tt>. All parsing errors are ignored.
  521. </dd>
  522. </div>
  523. <div id="loadHtml,string,seq[string]">
  524. <dt><pre><span class="Keyword">proc</span> <a href="#loadHtml%2Cstring%2Cseq%5Bstring%5D"><span class="Identifier">loadHtml</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">errors</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">XmlNode</span> {.
  525. <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="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
  526. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</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>
  527. <dd>
  528. Loads and parses HTML from file specified by <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>, and returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">XmlNode</span></span></tt>. Every occurred parsing error is added to the <tt class="docutils literal"><span class="pre"><span class="Identifier">errors</span></span></tt> sequence.
  529. </dd>
  530. </div>
  531. </div>
  532. <div id="parseHtml-procs-all">
  533. <div id="parseHtml,string">
  534. <dt><pre><span class="Keyword">proc</span> <a href="#parseHtml%2Cstring"><span class="Identifier">parseHtml</span></a><span class="Other">(</span><span class="Identifier">html</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">XmlNode</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="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span>
  535. <span class="Identifier">Exception</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">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</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>
  536. <dd>
  537. Parses the HTML from string <tt class="docutils literal"><span class="pre"><span class="Identifier">html</span></span></tt> and returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">XmlNode</span></span></tt>. All parsing errors are ignored.
  538. </dd>
  539. </div>
  540. <div id="parseHtml,Stream">
  541. <dt><pre><span class="Keyword">proc</span> <a href="#parseHtml%2CStream"><span class="Identifier">parseHtml</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">Stream</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">XmlNode</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="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span>
  542. <span class="Identifier">Exception</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">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</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>
  543. <dd>
  544. Parses the HTML from stream <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> and returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">XmlNode</span></span></tt>. All parsing errors are ignored.
  545. </dd>
  546. </div>
  547. <div id="parseHtml,Stream,string,seq[string]">
  548. <dt><pre><span class="Keyword">proc</span> <a href="#parseHtml%2CStream%2Cstring%2Cseq%5Bstring%5D"><span class="Identifier">parseHtml</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">Stream</span><span class="Other">;</span> <span class="Identifier">filename</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">errors</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">XmlNode</span> {.
  549. <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="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
  550. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</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>
  551. <dd>
  552. Parses the XML from stream <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> and returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">XmlNode</span></span></tt>. Every occurred parsing error is added to the <tt class="docutils literal"><span class="pre"><span class="Identifier">errors</span></span></tt> sequence.
  553. </dd>
  554. </div>
  555. </div>
  556. <div id="runeToEntity-procs-all">
  557. <div id="runeToEntity,Rune">
  558. <dt><pre><span class="Keyword">proc</span> <a href="#runeToEntity%2CRune"><span class="Identifier">runeToEntity</span></a><span class="Other">(</span><span class="Identifier">rune</span><span class="Other">:</span> <span class="Identifier">Rune</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</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>
  559. <dd>
  560. converts a Rune to its numeric HTML entity equivalent.
  561. <p><strong class="examples_text">Example:</strong></p>
  562. <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">unicode</span>
  563. <span class="Identifier">doAssert</span> <span class="Identifier">runeToEntity</span><span class="Punctuation">(</span><span class="Identifier">Rune</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;&quot;</span>
  564. <span class="Identifier">doAssert</span> <span class="Identifier">runeToEntity</span><span class="Punctuation">(</span><span class="Identifier">Rune</span><span class="Punctuation">(</span><span class="Operator">-</span><span class="DecNumber">1</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;&quot;</span>
  565. <span class="Identifier">doAssert</span> <span class="Identifier">runeToEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;Ü&quot;</span><span class="Operator">.</span><span class="Identifier">runeAt</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;#220&quot;</span>
  566. <span class="Identifier">doAssert</span> <span class="Identifier">runeToEntity</span><span class="Punctuation">(</span><span class="StringLit">&quot;∈&quot;</span><span class="Operator">.</span><span class="Identifier">runeAt</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;#8712&quot;</span></pre>
  567. </dd>
  568. </div>
  569. </div>
  570. </dl>
  571. </div>
  572. </div>
  573. </div>
  574. <div class="twelve-columns footer">
  575. <span class="nim-sprite"></span>
  576. <br>
  577. <small style="color: var(--hint);">Made with Nim. Generated: 2025-02-03 14:57:41 UTC</small>
  578. </div>
  579. </div>
  580. </div>
  581. <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
  582. </body>
  583. </html>