use single backtick (#17181)

This commit is contained in:
flywind 2021-02-24 23:47:27 -06:00 • committed by GitHub
commit fcb5cf643c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 381 additions and 381 deletions

View file

@ -149,9 +149,9 @@ proc encode*[T: SomeInteger|char](s: openArray[T], safe = false): string =
## This procedure encodes an openarray (array or sequence) of either integers ## This procedure encodes an openarray (array or sequence) of either integers
## or characters. ## or characters.
## ##
## If ``safe`` is ``true`` then it will encode using the ## If `safe` is `true` then it will encode using the
## URL-Safe and Filesystem-safe standard alphabet characters, ## URL-Safe and Filesystem-safe standard alphabet characters,
## which substitutes ``-`` instead of ``+`` and ``_`` instead of ``/``. ## which substitutes `-` instead of `+` and `_` instead of `/`.
## * https://en.wikipedia.org/wiki/Base64#URL_applications ## * https://en.wikipedia.org/wiki/Base64#URL_applications
## * https://tools.ietf.org/html/rfc4648#page-7 ## * https://tools.ietf.org/html/rfc4648#page-7
## ##
@ -165,13 +165,13 @@ proc encode*[T: SomeInteger|char](s: openArray[T], safe = false): string =
encodeImpl() encodeImpl()
proc encode*(s: string, safe = false): string = proc encode*(s: string, safe = false): string =
## Encodes ``s`` into base64 representation. ## Encodes `s` into base64 representation.
## ##
## This procedure encodes a string. ## This procedure encodes a string.
## ##
## If ``safe`` is ``true`` then it will encode using the ## If `safe` is `true` then it will encode using the
## URL-Safe and Filesystem-safe standard alphabet characters, ## URL-Safe and Filesystem-safe standard alphabet characters,
## which substitutes ``-`` instead of ``+`` and ``_`` instead of ``/``. ## which substitutes `-` instead of `+` and `_` instead of `/`.
## * https://en.wikipedia.org/wiki/Base64#URL_applications ## * https://en.wikipedia.org/wiki/Base64#URL_applications
## * https://tools.ietf.org/html/rfc4648#page-7 ## * https://tools.ietf.org/html/rfc4648#page-7
## ##
@ -183,8 +183,8 @@ proc encode*(s: string, safe = false): string =
encodeImpl() encodeImpl()
proc encodeMime*(s: string, lineLen = 75, newLine = "\r\n"): string = proc encodeMime*(s: string, lineLen = 75, newLine = "\r\n"): string =
## Encodes ``s`` into base64 representation as lines. ## Encodes `s` into base64 representation as lines.
## Used in email MIME format, use ``lineLen`` and ``newline``. ## Used in email MIME format, use `lineLen` and `newline`.
## ##
## This procedure encodes a string according to MIME spec. ## This procedure encodes a string according to MIME spec.
## ##
@ -215,7 +215,7 @@ const
decodeTable = initDecodeTable() decodeTable = initDecodeTable()
proc decode*(s: string): string = proc decode*(s: string): string =
## Decodes string ``s`` in base64 representation back into its original form. ## Decodes string `s` in base64 representation back into its original form.
## The initial whitespace is skipped. ## The initial whitespace is skipped.
## ##
## **See also:** ## **See also:**

View file

@ -8,8 +8,8 @@
# #
## This module implements the ability to access symbols from shared ## This module implements the ability to access symbols from shared
## libraries. On POSIX this uses the ``dlsym`` mechanism, on ## libraries. On POSIX this uses the `dlsym` mechanism, on
## Windows ``LoadLibrary``. ## Windows `LoadLibrary`.
## ##
## Examples ## Examples
## ======== ## ========

View file

@ -130,7 +130,7 @@ template fpRadix*: int = FLT_RADIX
## point type on the architecture used to build the program. ## point type on the architecture used to build the program.
template mantissaDigits*(T: typedesc[float32]): int = FLT_MANT_DIG template mantissaDigits*(T: typedesc[float32]): int = FLT_MANT_DIG
## Number of digits (in base ``floatingPointRadix``) in the mantissa ## Number of digits (in base `floatingPointRadix`) in the mantissa
## of 32-bit floating-point numbers. ## of 32-bit floating-point numbers.
template digits*(T: typedesc[float32]): int = FLT_DIG template digits*(T: typedesc[float32]): int = FLT_DIG
## Number of decimal digits that can be represented in a ## Number of decimal digits that can be represented in a
@ -156,7 +156,7 @@ template epsilon*(T: typedesc[float32]): float32 = FLT_EPSILON
## 1.0 that can be represented in a 32-bit floating-point type. ## 1.0 that can be represented in a 32-bit floating-point type.
template mantissaDigits*(T: typedesc[float64]): int = DBL_MANT_DIG template mantissaDigits*(T: typedesc[float64]): int = DBL_MANT_DIG
## Number of digits (in base ``floatingPointRadix``) in the mantissa ## Number of digits (in base `floatingPointRadix`) in the mantissa
## of 64-bit floating-point numbers. ## of 64-bit floating-point numbers.
template digits*(T: typedesc[float64]): int = DBL_DIG template digits*(T: typedesc[float64]): int = DBL_DIG
## Number of decimal digits that can be represented in a ## Number of decimal digits that can be represented in a

View file

@ -8,9 +8,9 @@
# #
## Do yourself a favor and import the module ## Do yourself a favor and import the module
## as ``from htmlgen import nil`` and then fully qualify the macros. ## as `from htmlgen import nil` and then fully qualify the macros.
## ##
## *Note*: The Karax project (``nimble install karax``) has a better ## *Note*: The Karax project (`nimble install karax`) has a better
## way to achieve the same, see https://github.com/pragmagic/karax/blob/master/tests/nativehtmlgen.nim ## way to achieve the same, see https://github.com/pragmagic/karax/blob/master/tests/nativehtmlgen.nim
## for an example. ## for an example.
## ##
@ -116,230 +116,230 @@ proc xmlCheckedTag*(argsList: NimNode, tag: string, optAttr = "", reqAttr = "",
result = nestList(ident"&", result) result = nestList(ident"&", result)
macro a*(e: varargs[untyped]): untyped = macro a*(e: varargs[untyped]): untyped =
## Generates the HTML ``a`` element. ## Generates the HTML `a` element.
result = xmlCheckedTag(e, "a", "href target download rel hreflang type " & result = xmlCheckedTag(e, "a", "href target download rel hreflang type " &
commonAttr) commonAttr)
macro abbr*(e: varargs[untyped]): untyped = macro abbr*(e: varargs[untyped]): untyped =
## Generates the HTML ``abbr`` element. ## Generates the HTML `abbr` element.
result = xmlCheckedTag(e, "abbr", commonAttr) result = xmlCheckedTag(e, "abbr", commonAttr)
macro address*(e: varargs[untyped]): untyped = macro address*(e: varargs[untyped]): untyped =
## Generates the HTML ``address`` element. ## Generates the HTML `address` element.
result = xmlCheckedTag(e, "address", commonAttr) result = xmlCheckedTag(e, "address", commonAttr)
macro area*(e: varargs[untyped]): untyped = macro area*(e: varargs[untyped]): untyped =
## Generates the HTML ``area`` element. ## Generates the HTML `area` element.
result = xmlCheckedTag(e, "area", "coords download href hreflang rel " & result = xmlCheckedTag(e, "area", "coords download href hreflang rel " &
"shape target type" & commonAttr, "alt", true) "shape target type" & commonAttr, "alt", true)
macro article*(e: varargs[untyped]): untyped = macro article*(e: varargs[untyped]): untyped =
## Generates the HTML ``article`` element. ## Generates the HTML `article` element.
result = xmlCheckedTag(e, "article", commonAttr) result = xmlCheckedTag(e, "article", commonAttr)
macro aside*(e: varargs[untyped]): untyped = macro aside*(e: varargs[untyped]): untyped =
## Generates the HTML ``aside`` element. ## Generates the HTML `aside` element.
result = xmlCheckedTag(e, "aside", commonAttr) result = xmlCheckedTag(e, "aside", commonAttr)
macro audio*(e: varargs[untyped]): untyped = macro audio*(e: varargs[untyped]): untyped =
## Generates the HTML ``audio`` element. ## Generates the HTML `audio` element.
result = xmlCheckedTag(e, "audio", "src crossorigin preload " & result = xmlCheckedTag(e, "audio", "src crossorigin preload " &
"autoplay mediagroup loop muted controls" & commonAttr) "autoplay mediagroup loop muted controls" & commonAttr)
macro b*(e: varargs[untyped]): untyped = macro b*(e: varargs[untyped]): untyped =
## Generates the HTML ``b`` element. ## Generates the HTML `b` element.
result = xmlCheckedTag(e, "b", commonAttr) result = xmlCheckedTag(e, "b", commonAttr)
macro base*(e: varargs[untyped]): untyped = macro base*(e: varargs[untyped]): untyped =
## Generates the HTML ``base`` element. ## Generates the HTML `base` element.
result = xmlCheckedTag(e, "base", "href target" & commonAttr, "", true) result = xmlCheckedTag(e, "base", "href target" & commonAttr, "", true)
macro bdi*(e: varargs[untyped]): untyped = macro bdi*(e: varargs[untyped]): untyped =
## Generates the HTML ``bdi`` element. ## Generates the HTML `bdi` element.
result = xmlCheckedTag(e, "bdi", commonAttr) result = xmlCheckedTag(e, "bdi", commonAttr)
macro bdo*(e: varargs[untyped]): untyped = macro bdo*(e: varargs[untyped]): untyped =
## Generates the HTML ``bdo`` element. ## Generates the HTML `bdo` element.
result = xmlCheckedTag(e, "bdo", commonAttr) result = xmlCheckedTag(e, "bdo", commonAttr)
macro big*(e: varargs[untyped]): untyped = macro big*(e: varargs[untyped]): untyped =
## Generates the HTML ``big`` element. ## Generates the HTML `big` element.
result = xmlCheckedTag(e, "big", commonAttr) result = xmlCheckedTag(e, "big", commonAttr)
macro blockquote*(e: varargs[untyped]): untyped = macro blockquote*(e: varargs[untyped]): untyped =
## Generates the HTML ``blockquote`` element. ## Generates the HTML `blockquote` element.
result = xmlCheckedTag(e, "blockquote", " cite" & commonAttr) result = xmlCheckedTag(e, "blockquote", " cite" & commonAttr)
macro body*(e: varargs[untyped]): untyped = macro body*(e: varargs[untyped]): untyped =
## Generates the HTML ``body`` element. ## Generates the HTML `body` element.
result = xmlCheckedTag(e, "body", "onafterprint onbeforeprint " & result = xmlCheckedTag(e, "body", "onafterprint onbeforeprint " &
"onbeforeunload onhashchange onmessage onoffline ononline onpagehide " & "onbeforeunload onhashchange onmessage onoffline ononline onpagehide " &
"onpageshow onpopstate onstorage onunload" & commonAttr) "onpageshow onpopstate onstorage onunload" & commonAttr)
macro br*(e: varargs[untyped]): untyped = macro br*(e: varargs[untyped]): untyped =
## Generates the HTML ``br`` element. ## Generates the HTML `br` element.
result = xmlCheckedTag(e, "br", commonAttr, "", true) result = xmlCheckedTag(e, "br", commonAttr, "", true)
macro button*(e: varargs[untyped]): untyped = macro button*(e: varargs[untyped]): untyped =
## Generates the HTML ``button`` element. ## Generates the HTML `button` element.
result = xmlCheckedTag(e, "button", "autofocus disabled form formaction " & result = xmlCheckedTag(e, "button", "autofocus disabled form formaction " &
"formenctype formmethod formnovalidate formtarget menu name type value" & "formenctype formmethod formnovalidate formtarget menu name type value" &
commonAttr) commonAttr)
macro canvas*(e: varargs[untyped]): untyped = macro canvas*(e: varargs[untyped]): untyped =
## Generates the HTML ``canvas`` element. ## Generates the HTML `canvas` element.
result = xmlCheckedTag(e, "canvas", "width height" & commonAttr) result = xmlCheckedTag(e, "canvas", "width height" & commonAttr)
macro caption*(e: varargs[untyped]): untyped = macro caption*(e: varargs[untyped]): untyped =
## Generates the HTML ``caption`` element. ## Generates the HTML `caption` element.
result = xmlCheckedTag(e, "caption", commonAttr) result = xmlCheckedTag(e, "caption", commonAttr)
macro center*(e: varargs[untyped]): untyped = macro center*(e: varargs[untyped]): untyped =
## Generates the HTML ``center`` element. ## Generates the HTML `center` element.
result = xmlCheckedTag(e, "center", commonAttr) result = xmlCheckedTag(e, "center", commonAttr)
macro cite*(e: varargs[untyped]): untyped = macro cite*(e: varargs[untyped]): untyped =
## Generates the HTML ``cite`` element. ## Generates the HTML `cite` element.
result = xmlCheckedTag(e, "cite", commonAttr) result = xmlCheckedTag(e, "cite", commonAttr)
macro code*(e: varargs[untyped]): untyped = macro code*(e: varargs[untyped]): untyped =
## Generates the HTML ``code`` element. ## Generates the HTML `code` element.
result = xmlCheckedTag(e, "code", commonAttr) result = xmlCheckedTag(e, "code", commonAttr)
macro col*(e: varargs[untyped]): untyped = macro col*(e: varargs[untyped]): untyped =
## Generates the HTML ``col`` element. ## Generates the HTML `col` element.
result = xmlCheckedTag(e, "col", "span" & commonAttr, "", true) result = xmlCheckedTag(e, "col", "span" & commonAttr, "", true)
macro colgroup*(e: varargs[untyped]): untyped = macro colgroup*(e: varargs[untyped]): untyped =
## Generates the HTML ``colgroup`` element. ## Generates the HTML `colgroup` element.
result = xmlCheckedTag(e, "colgroup", "span" & commonAttr) result = xmlCheckedTag(e, "colgroup", "span" & commonAttr)
macro data*(e: varargs[untyped]): untyped = macro data*(e: varargs[untyped]): untyped =
## Generates the HTML ``data`` element. ## Generates the HTML `data` element.
result = xmlCheckedTag(e, "data", "value" & commonAttr) result = xmlCheckedTag(e, "data", "value" & commonAttr)
macro datalist*(e: varargs[untyped]): untyped = macro datalist*(e: varargs[untyped]): untyped =
## Generates the HTML ``datalist`` element. ## Generates the HTML `datalist` element.
result = xmlCheckedTag(e, "datalist", commonAttr) result = xmlCheckedTag(e, "datalist", commonAttr)
macro dd*(e: varargs[untyped]): untyped = macro dd*(e: varargs[untyped]): untyped =
## Generates the HTML ``dd`` element. ## Generates the HTML `dd` element.
result = xmlCheckedTag(e, "dd", commonAttr) result = xmlCheckedTag(e, "dd", commonAttr)
macro del*(e: varargs[untyped]): untyped = macro del*(e: varargs[untyped]): untyped =
## Generates the HTML ``del`` element. ## Generates the HTML `del` element.
result = xmlCheckedTag(e, "del", "cite datetime" & commonAttr) result = xmlCheckedTag(e, "del", "cite datetime" & commonAttr)
macro details*(e: varargs[untyped]): untyped = macro details*(e: varargs[untyped]): untyped =
## Generates the HTML ``details`` element. ## Generates the HTML `details` element.
result = xmlCheckedTag(e, "details", commonAttr & "open") result = xmlCheckedTag(e, "details", commonAttr & "open")
macro dfn*(e: varargs[untyped]): untyped = macro dfn*(e: varargs[untyped]): untyped =
## Generates the HTML ``dfn`` element. ## Generates the HTML `dfn` element.
result = xmlCheckedTag(e, "dfn", commonAttr) result = xmlCheckedTag(e, "dfn", commonAttr)
macro dialog*(e: varargs[untyped]): untyped = macro dialog*(e: varargs[untyped]): untyped =
## Generates the HTML ``dialog`` element. ## Generates the HTML `dialog` element.
result = xmlCheckedTag(e, "dialog", commonAttr & "open") result = xmlCheckedTag(e, "dialog", commonAttr & "open")
macro `div`*(e: varargs[untyped]): untyped = macro `div`*(e: varargs[untyped]): untyped =
## Generates the HTML ``div`` element. ## Generates the HTML `div` element.
result = xmlCheckedTag(e, "div", commonAttr) result = xmlCheckedTag(e, "div", commonAttr)
macro dl*(e: varargs[untyped]): untyped = macro dl*(e: varargs[untyped]): untyped =
## Generates the HTML ``dl`` element. ## Generates the HTML `dl` element.
result = xmlCheckedTag(e, "dl", commonAttr) result = xmlCheckedTag(e, "dl", commonAttr)
macro dt*(e: varargs[untyped]): untyped = macro dt*(e: varargs[untyped]): untyped =
## Generates the HTML ``dt`` element. ## Generates the HTML `dt` element.
result = xmlCheckedTag(e, "dt", commonAttr) result = xmlCheckedTag(e, "dt", commonAttr)
macro em*(e: varargs[untyped]): untyped = macro em*(e: varargs[untyped]): untyped =
## Generates the HTML ``em`` element. ## Generates the HTML `em` element.
result = xmlCheckedTag(e, "em", commonAttr) result = xmlCheckedTag(e, "em", commonAttr)
macro embed*(e: varargs[untyped]): untyped = macro embed*(e: varargs[untyped]): untyped =
## Generates the HTML ``embed`` element. ## Generates the HTML `embed` element.
result = xmlCheckedTag(e, "embed", "src type height width" & result = xmlCheckedTag(e, "embed", "src type height width" &
commonAttr, "", true) commonAttr, "", true)
macro fieldset*(e: varargs[untyped]): untyped = macro fieldset*(e: varargs[untyped]): untyped =
## Generates the HTML ``fieldset`` element. ## Generates the HTML `fieldset` element.
result = xmlCheckedTag(e, "fieldset", "disabled form name" & commonAttr) result = xmlCheckedTag(e, "fieldset", "disabled form name" & commonAttr)
macro figure*(e: varargs[untyped]): untyped = macro figure*(e: varargs[untyped]): untyped =
## Generates the HTML ``figure`` element. ## Generates the HTML `figure` element.
result = xmlCheckedTag(e, "figure", commonAttr) result = xmlCheckedTag(e, "figure", commonAttr)
macro figcaption*(e: varargs[untyped]): untyped = macro figcaption*(e: varargs[untyped]): untyped =
## Generates the HTML ``figcaption`` element. ## Generates the HTML `figcaption` element.
result = xmlCheckedTag(e, "figcaption", commonAttr) result = xmlCheckedTag(e, "figcaption", commonAttr)
macro footer*(e: varargs[untyped]): untyped = macro footer*(e: varargs[untyped]): untyped =
## Generates the HTML ``footer`` element. ## Generates the HTML `footer` element.
result = xmlCheckedTag(e, "footer", commonAttr) result = xmlCheckedTag(e, "footer", commonAttr)
macro form*(e: varargs[untyped]): untyped = macro form*(e: varargs[untyped]): untyped =
## Generates the HTML ``form`` element. ## Generates the HTML `form` element.
result = xmlCheckedTag(e, "form", "accept-charset action autocomplete " & result = xmlCheckedTag(e, "form", "accept-charset action autocomplete " &
"enctype method name novalidate target" & commonAttr) "enctype method name novalidate target" & commonAttr)
macro h1*(e: varargs[untyped]): untyped = macro h1*(e: varargs[untyped]): untyped =
## Generates the HTML ``h1`` element. ## Generates the HTML `h1` element.
result = xmlCheckedTag(e, "h1", commonAttr) result = xmlCheckedTag(e, "h1", commonAttr)
macro h2*(e: varargs[untyped]): untyped = macro h2*(e: varargs[untyped]): untyped =
## Generates the HTML ``h2`` element. ## Generates the HTML `h2` element.
result = xmlCheckedTag(e, "h2", commonAttr) result = xmlCheckedTag(e, "h2", commonAttr)
macro h3*(e: varargs[untyped]): untyped = macro h3*(e: varargs[untyped]): untyped =
## Generates the HTML ``h3`` element. ## Generates the HTML `h3` element.
result = xmlCheckedTag(e, "h3", commonAttr) result = xmlCheckedTag(e, "h3", commonAttr)
macro h4*(e: varargs[untyped]): untyped = macro h4*(e: varargs[untyped]): untyped =
## Generates the HTML ``h4`` element. ## Generates the HTML `h4` element.
result = xmlCheckedTag(e, "h4", commonAttr) result = xmlCheckedTag(e, "h4", commonAttr)
macro h5*(e: varargs[untyped]): untyped = macro h5*(e: varargs[untyped]): untyped =
## Generates the HTML ``h5`` element. ## Generates the HTML `h5` element.
result = xmlCheckedTag(e, "h5", commonAttr) result = xmlCheckedTag(e, "h5", commonAttr)
macro h6*(e: varargs[untyped]): untyped = macro h6*(e: varargs[untyped]): untyped =
## Generates the HTML ``h6`` element. ## Generates the HTML `h6` element.
result = xmlCheckedTag(e, "h6", commonAttr) result = xmlCheckedTag(e, "h6", commonAttr)
macro head*(e: varargs[untyped]): untyped = macro head*(e: varargs[untyped]): untyped =
## Generates the HTML ``head`` element. ## Generates the HTML `head` element.
result = xmlCheckedTag(e, "head", commonAttr) result = xmlCheckedTag(e, "head", commonAttr)
macro header*(e: varargs[untyped]): untyped = macro header*(e: varargs[untyped]): untyped =
## Generates the HTML ``header`` element. ## Generates the HTML `header` element.
result = xmlCheckedTag(e, "header", commonAttr) result = xmlCheckedTag(e, "header", commonAttr)
macro html*(e: varargs[untyped]): untyped = macro html*(e: varargs[untyped]): untyped =
## Generates the HTML ``html`` element. ## Generates the HTML `html` element.
result = xmlCheckedTag(e, "html", "xmlns" & commonAttr, "") result = xmlCheckedTag(e, "html", "xmlns" & commonAttr, "")
macro hr*(): untyped = macro hr*(): untyped =
## Generates the HTML ``hr`` element. ## Generates the HTML `hr` element.
result = xmlCheckedTag(newNimNode(nnkArglist), "hr", commonAttr, "", true) result = xmlCheckedTag(newNimNode(nnkArglist), "hr", commonAttr, "", true)
macro i*(e: varargs[untyped]): untyped = macro i*(e: varargs[untyped]): untyped =
## Generates the HTML ``i`` element. ## Generates the HTML `i` element.
result = xmlCheckedTag(e, "i", commonAttr) result = xmlCheckedTag(e, "i", commonAttr)
macro iframe*(e: varargs[untyped]): untyped = macro iframe*(e: varargs[untyped]): untyped =
## Generates the HTML ``iframe`` element. ## Generates the HTML `iframe` element.
result = xmlCheckedTag(e, "iframe", "src srcdoc name sandbox width height loading" & result = xmlCheckedTag(e, "iframe", "src srcdoc name sandbox width height loading" &
commonAttr) commonAttr)
macro img*(e: varargs[untyped]): untyped = macro img*(e: varargs[untyped]): untyped =
## Generates the HTML ``img`` element. ## Generates the HTML `img` element.
result = xmlCheckedTag(e, "img", "crossorigin usemap ismap height width loading" & result = xmlCheckedTag(e, "img", "crossorigin usemap ismap height width loading" &
commonAttr, "src alt", true) commonAttr, "src alt", true)
macro input*(e: varargs[untyped]): untyped = macro input*(e: varargs[untyped]): untyped =
## Generates the HTML ``input`` element. ## Generates the HTML `input` element.
result = xmlCheckedTag(e, "input", "accept alt autocomplete autofocus " & result = xmlCheckedTag(e, "input", "accept alt autocomplete autofocus " &
"checked dirname disabled form formaction formenctype formmethod " & "checked dirname disabled form formaction formenctype formmethod " &
"formnovalidate formtarget height inputmode list max maxlength min " & "formnovalidate formtarget height inputmode list max maxlength min " &
@ -347,397 +347,397 @@ macro input*(e: varargs[untyped]): untyped =
"src step type value width" & commonAttr, "", true) "src step type value width" & commonAttr, "", true)
macro ins*(e: varargs[untyped]): untyped = macro ins*(e: varargs[untyped]): untyped =
## Generates the HTML ``ins`` element. ## Generates the HTML `ins` element.
result = xmlCheckedTag(e, "ins", "cite datetime" & commonAttr) result = xmlCheckedTag(e, "ins", "cite datetime" & commonAttr)
macro kbd*(e: varargs[untyped]): untyped = macro kbd*(e: varargs[untyped]): untyped =
## Generates the HTML ``kbd`` element. ## Generates the HTML `kbd` element.
result = xmlCheckedTag(e, "kbd", commonAttr) result = xmlCheckedTag(e, "kbd", commonAttr)
macro keygen*(e: varargs[untyped]): untyped = macro keygen*(e: varargs[untyped]): untyped =
## Generates the HTML ``keygen`` element. ## Generates the HTML `keygen` element.
result = xmlCheckedTag(e, "keygen", "autofocus challenge disabled " & result = xmlCheckedTag(e, "keygen", "autofocus challenge disabled " &
"form keytype name" & commonAttr) "form keytype name" & commonAttr)
macro label*(e: varargs[untyped]): untyped = macro label*(e: varargs[untyped]): untyped =
## Generates the HTML ``label`` element. ## Generates the HTML `label` element.
result = xmlCheckedTag(e, "label", "form for" & commonAttr) result = xmlCheckedTag(e, "label", "form for" & commonAttr)
macro legend*(e: varargs[untyped]): untyped = macro legend*(e: varargs[untyped]): untyped =
## Generates the HTML ``legend`` element. ## Generates the HTML `legend` element.
result = xmlCheckedTag(e, "legend", commonAttr) result = xmlCheckedTag(e, "legend", commonAttr)
macro li*(e: varargs[untyped]): untyped = macro li*(e: varargs[untyped]): untyped =
## Generates the HTML ``li`` element. ## Generates the HTML `li` element.
result = xmlCheckedTag(e, "li", "value" & commonAttr) result = xmlCheckedTag(e, "li", "value" & commonAttr)
macro link*(e: varargs[untyped]): untyped = macro link*(e: varargs[untyped]): untyped =
## Generates the HTML ``link`` element. ## Generates the HTML `link` element.
result = xmlCheckedTag(e, "link", "href crossorigin rel media hreflang " & result = xmlCheckedTag(e, "link", "href crossorigin rel media hreflang " &
"type sizes" & commonAttr, "", true) "type sizes" & commonAttr, "", true)
macro main*(e: varargs[untyped]): untyped = macro main*(e: varargs[untyped]): untyped =
## Generates the HTML ``main`` element. ## Generates the HTML `main` element.
result = xmlCheckedTag(e, "main", commonAttr) result = xmlCheckedTag(e, "main", commonAttr)
macro map*(e: varargs[untyped]): untyped = macro map*(e: varargs[untyped]): untyped =
## Generates the HTML ``map`` element. ## Generates the HTML `map` element.
result = xmlCheckedTag(e, "map", "name" & commonAttr) result = xmlCheckedTag(e, "map", "name" & commonAttr)
macro mark*(e: varargs[untyped]): untyped = macro mark*(e: varargs[untyped]): untyped =
## Generates the HTML ``mark`` element. ## Generates the HTML `mark` element.
result = xmlCheckedTag(e, "mark", commonAttr) result = xmlCheckedTag(e, "mark", commonAttr)
macro marquee*(e: varargs[untyped]): untyped = macro marquee*(e: varargs[untyped]): untyped =
## Generates the HTML ``marquee`` element. ## Generates the HTML `marquee` element.
result = xmlCheckedTag(e, "marquee", coreAttr & result = xmlCheckedTag(e, "marquee", coreAttr &
"behavior bgcolor direction height hspace loop scrollamount " & "behavior bgcolor direction height hspace loop scrollamount " &
"scrolldelay truespeed vspace width onbounce onfinish onstart") "scrolldelay truespeed vspace width onbounce onfinish onstart")
macro meta*(e: varargs[untyped]): untyped = macro meta*(e: varargs[untyped]): untyped =
## Generates the HTML ``meta`` element. ## Generates the HTML `meta` element.
result = xmlCheckedTag(e, "meta", "name http-equiv content charset" & result = xmlCheckedTag(e, "meta", "name http-equiv content charset" &
commonAttr, "", true) commonAttr, "", true)
macro meter*(e: varargs[untyped]): untyped = macro meter*(e: varargs[untyped]): untyped =
## Generates the HTML ``meter`` element. ## Generates the HTML `meter` element.
result = xmlCheckedTag(e, "meter", "value min max low high optimum" & result = xmlCheckedTag(e, "meter", "value min max low high optimum" &
commonAttr) commonAttr)
macro nav*(e: varargs[untyped]): untyped = macro nav*(e: varargs[untyped]): untyped =
## Generates the HTML ``nav`` element. ## Generates the HTML `nav` element.
result = xmlCheckedTag(e, "nav", commonAttr) result = xmlCheckedTag(e, "nav", commonAttr)
macro noscript*(e: varargs[untyped]): untyped = macro noscript*(e: varargs[untyped]): untyped =
## Generates the HTML ``noscript`` element. ## Generates the HTML `noscript` element.
result = xmlCheckedTag(e, "noscript", commonAttr) result = xmlCheckedTag(e, "noscript", commonAttr)
macro `object`*(e: varargs[untyped]): untyped = macro `object`*(e: varargs[untyped]): untyped =
## Generates the HTML ``object`` element. ## Generates the HTML `object` element.
result = xmlCheckedTag(e, "object", "data type typemustmatch name usemap " & result = xmlCheckedTag(e, "object", "data type typemustmatch name usemap " &
"form width height" & commonAttr) "form width height" & commonAttr)
macro ol*(e: varargs[untyped]): untyped = macro ol*(e: varargs[untyped]): untyped =
## Generates the HTML ``ol`` element. ## Generates the HTML `ol` element.
result = xmlCheckedTag(e, "ol", "reversed start type" & commonAttr) result = xmlCheckedTag(e, "ol", "reversed start type" & commonAttr)
macro optgroup*(e: varargs[untyped]): untyped = macro optgroup*(e: varargs[untyped]): untyped =
## Generates the HTML ``optgroup`` element. ## Generates the HTML `optgroup` element.
result = xmlCheckedTag(e, "optgroup", "disabled" & commonAttr, "label", false) result = xmlCheckedTag(e, "optgroup", "disabled" & commonAttr, "label", false)
macro option*(e: varargs[untyped]): untyped = macro option*(e: varargs[untyped]): untyped =
## Generates the HTML ``option`` element. ## Generates the HTML `option` element.
result = xmlCheckedTag(e, "option", "disabled label selected value" & result = xmlCheckedTag(e, "option", "disabled label selected value" &
commonAttr) commonAttr)
macro output*(e: varargs[untyped]): untyped = macro output*(e: varargs[untyped]): untyped =
## Generates the HTML ``output`` element. ## Generates the HTML `output` element.
result = xmlCheckedTag(e, "output", "for form name" & commonAttr) result = xmlCheckedTag(e, "output", "for form name" & commonAttr)
macro p*(e: varargs[untyped]): untyped = macro p*(e: varargs[untyped]): untyped =
## Generates the HTML ``p`` element. ## Generates the HTML `p` element.
result = xmlCheckedTag(e, "p", commonAttr) result = xmlCheckedTag(e, "p", commonAttr)
macro param*(e: varargs[untyped]): untyped = macro param*(e: varargs[untyped]): untyped =
## Generates the HTML ``param`` element. ## Generates the HTML `param` element.
result = xmlCheckedTag(e, "param", commonAttr, "name value", true) result = xmlCheckedTag(e, "param", commonAttr, "name value", true)
macro picture*(e: varargs[untyped]): untyped = macro picture*(e: varargs[untyped]): untyped =
## Generates the HTML ``picture`` element. ## Generates the HTML `picture` element.
result = xmlCheckedTag(e, "picture", commonAttr) result = xmlCheckedTag(e, "picture", commonAttr)
macro pre*(e: varargs[untyped]): untyped = macro pre*(e: varargs[untyped]): untyped =
## Generates the HTML ``pre`` element. ## Generates the HTML `pre` element.
result = xmlCheckedTag(e, "pre", commonAttr) result = xmlCheckedTag(e, "pre", commonAttr)
macro progress*(e: varargs[untyped]): untyped = macro progress*(e: varargs[untyped]): untyped =
## Generates the HTML ``progress`` element. ## Generates the HTML `progress` element.
result = xmlCheckedTag(e, "progress", "value max" & commonAttr) result = xmlCheckedTag(e, "progress", "value max" & commonAttr)
macro q*(e: varargs[untyped]): untyped = macro q*(e: varargs[untyped]): untyped =
## Generates the HTML ``q`` element. ## Generates the HTML `q` element.
result = xmlCheckedTag(e, "q", "cite" & commonAttr) result = xmlCheckedTag(e, "q", "cite" & commonAttr)
macro rb*(e: varargs[untyped]): untyped = macro rb*(e: varargs[untyped]): untyped =
## Generates the HTML ``rb`` element. ## Generates the HTML `rb` element.
result = xmlCheckedTag(e, "rb", commonAttr) result = xmlCheckedTag(e, "rb", commonAttr)
macro rp*(e: varargs[untyped]): untyped = macro rp*(e: varargs[untyped]): untyped =
## Generates the HTML ``rp`` element. ## Generates the HTML `rp` element.
result = xmlCheckedTag(e, "rp", commonAttr) result = xmlCheckedTag(e, "rp", commonAttr)
macro rt*(e: varargs[untyped]): untyped = macro rt*(e: varargs[untyped]): untyped =
## Generates the HTML ``rt`` element. ## Generates the HTML `rt` element.
result = xmlCheckedTag(e, "rt", commonAttr) result = xmlCheckedTag(e, "rt", commonAttr)
macro rtc*(e: varargs[untyped]): untyped = macro rtc*(e: varargs[untyped]): untyped =
## Generates the HTML ``rtc`` element. ## Generates the HTML `rtc` element.
result = xmlCheckedTag(e, "rtc", commonAttr) result = xmlCheckedTag(e, "rtc", commonAttr)
macro ruby*(e: varargs[untyped]): untyped = macro ruby*(e: varargs[untyped]): untyped =
## Generates the HTML ``ruby`` element. ## Generates the HTML `ruby` element.
result = xmlCheckedTag(e, "ruby", commonAttr) result = xmlCheckedTag(e, "ruby", commonAttr)
macro s*(e: varargs[untyped]): untyped = macro s*(e: varargs[untyped]): untyped =
## Generates the HTML ``s`` element. ## Generates the HTML `s` element.
result = xmlCheckedTag(e, "s", commonAttr) result = xmlCheckedTag(e, "s", commonAttr)
macro samp*(e: varargs[untyped]): untyped = macro samp*(e: varargs[untyped]): untyped =
## Generates the HTML ``samp`` element. ## Generates the HTML `samp` element.
result = xmlCheckedTag(e, "samp", commonAttr) result = xmlCheckedTag(e, "samp", commonAttr)
macro script*(e: varargs[untyped]): untyped = macro script*(e: varargs[untyped]): untyped =
## Generates the HTML ``script`` element. ## Generates the HTML `script` element.
result = xmlCheckedTag(e, "script", "src type charset async defer " & result = xmlCheckedTag(e, "script", "src type charset async defer " &
"crossorigin" & commonAttr) "crossorigin" & commonAttr)
macro section*(e: varargs[untyped]): untyped = macro section*(e: varargs[untyped]): untyped =
## Generates the HTML ``section`` element. ## Generates the HTML `section` element.
result = xmlCheckedTag(e, "section", commonAttr) result = xmlCheckedTag(e, "section", commonAttr)
macro select*(e: varargs[untyped]): untyped = macro select*(e: varargs[untyped]): untyped =
## Generates the HTML ``select`` element. ## Generates the HTML `select` element.
result = xmlCheckedTag(e, "select", "autofocus disabled form multiple " & result = xmlCheckedTag(e, "select", "autofocus disabled form multiple " &
"name required size" & commonAttr) "name required size" & commonAttr)
macro slot*(e: varargs[untyped]): untyped = macro slot*(e: varargs[untyped]): untyped =
## Generates the HTML ``slot`` element. ## Generates the HTML `slot` element.
result = xmlCheckedTag(e, "slot", commonAttr) result = xmlCheckedTag(e, "slot", commonAttr)
macro small*(e: varargs[untyped]): untyped = macro small*(e: varargs[untyped]): untyped =
## Generates the HTML ``small`` element. ## Generates the HTML `small` element.
result = xmlCheckedTag(e, "small", commonAttr) result = xmlCheckedTag(e, "small", commonAttr)
macro source*(e: varargs[untyped]): untyped = macro source*(e: varargs[untyped]): untyped =
## Generates the HTML ``source`` element. ## Generates the HTML `source` element.
result = xmlCheckedTag(e, "source", "type" & commonAttr, "src", true) result = xmlCheckedTag(e, "source", "type" & commonAttr, "src", true)
macro span*(e: varargs[untyped]): untyped = macro span*(e: varargs[untyped]): untyped =
## Generates the HTML ``span`` element. ## Generates the HTML `span` element.
result = xmlCheckedTag(e, "span", commonAttr) result = xmlCheckedTag(e, "span", commonAttr)
macro strong*(e: varargs[untyped]): untyped = macro strong*(e: varargs[untyped]): untyped =
## Generates the HTML ``strong`` element. ## Generates the HTML `strong` element.
result = xmlCheckedTag(e, "strong", commonAttr) result = xmlCheckedTag(e, "strong", commonAttr)
macro style*(e: varargs[untyped]): untyped = macro style*(e: varargs[untyped]): untyped =
## Generates the HTML ``style`` element. ## Generates the HTML `style` element.
result = xmlCheckedTag(e, "style", "media type" & commonAttr) result = xmlCheckedTag(e, "style", "media type" & commonAttr)
macro sub*(e: varargs[untyped]): untyped = macro sub*(e: varargs[untyped]): untyped =
## Generates the HTML ``sub`` element. ## Generates the HTML `sub` element.
result = xmlCheckedTag(e, "sub", commonAttr) result = xmlCheckedTag(e, "sub", commonAttr)
macro summary*(e: varargs[untyped]): untyped = macro summary*(e: varargs[untyped]): untyped =
## Generates the HTML ``summary`` element. ## Generates the HTML `summary` element.
result = xmlCheckedTag(e, "summary", commonAttr) result = xmlCheckedTag(e, "summary", commonAttr)
macro sup*(e: varargs[untyped]): untyped = macro sup*(e: varargs[untyped]): untyped =
## Generates the HTML ``sup`` element. ## Generates the HTML `sup` element.
result = xmlCheckedTag(e, "sup", commonAttr) result = xmlCheckedTag(e, "sup", commonAttr)
macro table*(e: varargs[untyped]): untyped = macro table*(e: varargs[untyped]): untyped =
## Generates the HTML ``table`` element. ## Generates the HTML `table` element.
result = xmlCheckedTag(e, "table", "border sortable" & commonAttr) result = xmlCheckedTag(e, "table", "border sortable" & commonAttr)
macro tbody*(e: varargs[untyped]): untyped = macro tbody*(e: varargs[untyped]): untyped =
## Generates the HTML ``tbody`` element. ## Generates the HTML `tbody` element.
result = xmlCheckedTag(e, "tbody", commonAttr) result = xmlCheckedTag(e, "tbody", commonAttr)
macro td*(e: varargs[untyped]): untyped = macro td*(e: varargs[untyped]): untyped =
## Generates the HTML ``td`` element. ## Generates the HTML `td` element.
result = xmlCheckedTag(e, "td", "colspan rowspan headers" & commonAttr) result = xmlCheckedTag(e, "td", "colspan rowspan headers" & commonAttr)
macro `template`*(e: varargs[untyped]): untyped = macro `template`*(e: varargs[untyped]): untyped =
## Generates the HTML ``template`` element. ## Generates the HTML `template` element.
result = xmlCheckedTag(e, "template", commonAttr) result = xmlCheckedTag(e, "template", commonAttr)
macro textarea*(e: varargs[untyped]): untyped = macro textarea*(e: varargs[untyped]): untyped =
## Generates the HTML ``textarea`` element. ## Generates the HTML `textarea` element.
result = xmlCheckedTag(e, "textarea", "autocomplete autofocus cols " & result = xmlCheckedTag(e, "textarea", "autocomplete autofocus cols " &
"dirname disabled form inputmode maxlength minlength name placeholder " & "dirname disabled form inputmode maxlength minlength name placeholder " &
"readonly required rows wrap" & commonAttr) "readonly required rows wrap" & commonAttr)
macro tfoot*(e: varargs[untyped]): untyped = macro tfoot*(e: varargs[untyped]): untyped =
## Generates the HTML ``tfoot`` element. ## Generates the HTML `tfoot` element.
result = xmlCheckedTag(e, "tfoot", commonAttr) result = xmlCheckedTag(e, "tfoot", commonAttr)
macro th*(e: varargs[untyped]): untyped = macro th*(e: varargs[untyped]): untyped =
## Generates the HTML ``th`` element. ## Generates the HTML `th` element.
result = xmlCheckedTag(e, "th", "colspan rowspan headers abbr scope axis" & result = xmlCheckedTag(e, "th", "colspan rowspan headers abbr scope axis" &
" sorted" & commonAttr) " sorted" & commonAttr)
macro thead*(e: varargs[untyped]): untyped = macro thead*(e: varargs[untyped]): untyped =
## Generates the HTML ``thead`` element. ## Generates the HTML `thead` element.
result = xmlCheckedTag(e, "thead", commonAttr) result = xmlCheckedTag(e, "thead", commonAttr)
macro time*(e: varargs[untyped]): untyped = macro time*(e: varargs[untyped]): untyped =
## Generates the HTML ``time`` element. ## Generates the HTML `time` element.
result = xmlCheckedTag(e, "time", "datetime" & commonAttr) result = xmlCheckedTag(e, "time", "datetime" & commonAttr)
macro title*(e: varargs[untyped]): untyped = macro title*(e: varargs[untyped]): untyped =
## Generates the HTML ``title`` element. ## Generates the HTML `title` element.
result = xmlCheckedTag(e, "title", commonAttr) result = xmlCheckedTag(e, "title", commonAttr)
macro tr*(e: varargs[untyped]): untyped = macro tr*(e: varargs[untyped]): untyped =
## Generates the HTML ``tr`` element. ## Generates the HTML `tr` element.
result = xmlCheckedTag(e, "tr", commonAttr) result = xmlCheckedTag(e, "tr", commonAttr)
macro track*(e: varargs[untyped]): untyped = macro track*(e: varargs[untyped]): untyped =
## Generates the HTML ``track`` element. ## Generates the HTML `track` element.
result = xmlCheckedTag(e, "track", "kind srclang label default" & result = xmlCheckedTag(e, "track", "kind srclang label default" &
commonAttr, "src", true) commonAttr, "src", true)
macro tt*(e: varargs[untyped]): untyped = macro tt*(e: varargs[untyped]): untyped =
## Generates the HTML ``tt`` element. ## Generates the HTML `tt` element.
result = xmlCheckedTag(e, "tt", commonAttr) result = xmlCheckedTag(e, "tt", commonAttr)
macro u*(e: varargs[untyped]): untyped = macro u*(e: varargs[untyped]): untyped =
## Generates the HTML ``u`` element. ## Generates the HTML `u` element.
result = xmlCheckedTag(e, "u", commonAttr) result = xmlCheckedTag(e, "u", commonAttr)
macro ul*(e: varargs[untyped]): untyped = macro ul*(e: varargs[untyped]): untyped =
## Generates the HTML ``ul`` element. ## Generates the HTML `ul` element.
result = xmlCheckedTag(e, "ul", commonAttr) result = xmlCheckedTag(e, "ul", commonAttr)
macro `var`*(e: varargs[untyped]): untyped = macro `var`*(e: varargs[untyped]): untyped =
## Generates the HTML ``var`` element. ## Generates the HTML `var` element.
result = xmlCheckedTag(e, "var", commonAttr) result = xmlCheckedTag(e, "var", commonAttr)
macro video*(e: varargs[untyped]): untyped = macro video*(e: varargs[untyped]): untyped =
## Generates the HTML ``video`` element. ## Generates the HTML `video` element.
result = xmlCheckedTag(e, "video", "src crossorigin poster preload " & result = xmlCheckedTag(e, "video", "src crossorigin poster preload " &
"autoplay mediagroup loop muted controls width height" & commonAttr) "autoplay mediagroup loop muted controls width height" & commonAttr)
macro wbr*(e: varargs[untyped]): untyped = macro wbr*(e: varargs[untyped]): untyped =
## Generates the HTML ``wbr`` element. ## Generates the HTML `wbr` element.
result = xmlCheckedTag(e, "wbr", commonAttr, "", true) result = xmlCheckedTag(e, "wbr", commonAttr, "", true)
macro math*(e: varargs[untyped]): untyped = macro math*(e: varargs[untyped]): untyped =
## Generates the HTML ``math`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `math` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/math#Examples ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/math#Examples
result = xmlCheckedTag(e, "math", "mathbackground mathcolor href overflow" & commonAttr) result = xmlCheckedTag(e, "math", "mathbackground mathcolor href overflow" & commonAttr)
macro maction*(e: varargs[untyped]): untyped = macro maction*(e: varargs[untyped]): untyped =
## Generates the HTML ``maction`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `maction` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/maction ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/maction
result = xmlCheckedTag(e, "maction", "mathbackground mathcolor href" & commonAttr) result = xmlCheckedTag(e, "maction", "mathbackground mathcolor href" & commonAttr)
macro menclose*(e: varargs[untyped]): untyped = macro menclose*(e: varargs[untyped]): untyped =
## Generates the HTML ``menclose`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `menclose` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/menclose ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/menclose
result = xmlCheckedTag(e, "menclose", "mathbackground mathcolor href notation" & commonAttr) result = xmlCheckedTag(e, "menclose", "mathbackground mathcolor href notation" & commonAttr)
macro merror*(e: varargs[untyped]): untyped = macro merror*(e: varargs[untyped]): untyped =
## Generates the HTML ``merror`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `merror` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/merror ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/merror
result = xmlCheckedTag(e, "merror", "mathbackground mathcolor href" & commonAttr) result = xmlCheckedTag(e, "merror", "mathbackground mathcolor href" & commonAttr)
macro mfenced*(e: varargs[untyped]): untyped = macro mfenced*(e: varargs[untyped]): untyped =
## Generates the HTML ``mfenced`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mfenced` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mfenced ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mfenced
result = xmlCheckedTag(e, "mfenced", "mathbackground mathcolor href open separators" & commonAttr) result = xmlCheckedTag(e, "mfenced", "mathbackground mathcolor href open separators" & commonAttr)
macro mfrac*(e: varargs[untyped]): untyped = macro mfrac*(e: varargs[untyped]): untyped =
## Generates the HTML ``mfrac`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mfrac` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mfrac ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mfrac
result = xmlCheckedTag(e, "mfrac", "mathbackground mathcolor href linethickness numalign" & commonAttr) result = xmlCheckedTag(e, "mfrac", "mathbackground mathcolor href linethickness numalign" & commonAttr)
macro mglyph*(e: varargs[untyped]): untyped = macro mglyph*(e: varargs[untyped]): untyped =
## Generates the HTML ``mglyph`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mglyph` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mglyph ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mglyph
result = xmlCheckedTag(e, "mglyph", "mathbackground mathcolor href src valign" & commonAttr) result = xmlCheckedTag(e, "mglyph", "mathbackground mathcolor href src valign" & commonAttr)
macro mi*(e: varargs[untyped]): untyped = macro mi*(e: varargs[untyped]): untyped =
## Generates the HTML ``mi`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mi` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mi ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mi
result = xmlCheckedTag(e, "mi", "mathbackground mathcolor href mathsize mathvariant" & commonAttr) result = xmlCheckedTag(e, "mi", "mathbackground mathcolor href mathsize mathvariant" & commonAttr)
macro mlabeledtr*(e: varargs[untyped]): untyped = macro mlabeledtr*(e: varargs[untyped]): untyped =
## Generates the HTML ``mlabeledtr`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mlabeledtr` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mlabeledtr ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mlabeledtr
result = xmlCheckedTag(e, "mlabeledtr", "mathbackground mathcolor href columnalign groupalign rowalign" & commonAttr) result = xmlCheckedTag(e, "mlabeledtr", "mathbackground mathcolor href columnalign groupalign rowalign" & commonAttr)
macro mmultiscripts*(e: varargs[untyped]): untyped = macro mmultiscripts*(e: varargs[untyped]): untyped =
## Generates the HTML ``mmultiscripts`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mmultiscripts` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mmultiscripts ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mmultiscripts
result = xmlCheckedTag(e, "mmultiscripts", "mathbackground mathcolor href subscriptshift superscriptshift" & commonAttr) result = xmlCheckedTag(e, "mmultiscripts", "mathbackground mathcolor href subscriptshift superscriptshift" & commonAttr)
macro mn*(e: varargs[untyped]): untyped = macro mn*(e: varargs[untyped]): untyped =
## Generates the HTML ``mn`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mn` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mn ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mn
result = xmlCheckedTag(e, "mn", "mathbackground mathcolor href mathsize mathvariant" & commonAttr) result = xmlCheckedTag(e, "mn", "mathbackground mathcolor href mathsize mathvariant" & commonAttr)
macro mo*(e: varargs[untyped]): untyped = macro mo*(e: varargs[untyped]): untyped =
## Generates the HTML ``mo`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mo` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo
result = xmlCheckedTag(e, "mo", result = xmlCheckedTag(e, "mo",
"mathbackground mathcolor fence form largeop lspace mathsize mathvariant movablelimits rspace separator stretchy symmetric" & commonAttr) "mathbackground mathcolor fence form largeop lspace mathsize mathvariant movablelimits rspace separator stretchy symmetric" & commonAttr)
macro mover*(e: varargs[untyped]): untyped = macro mover*(e: varargs[untyped]): untyped =
## Generates the HTML ``mover`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mover` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mover ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mover
result = xmlCheckedTag(e, "mover", "mathbackground mathcolor accent href" & commonAttr) result = xmlCheckedTag(e, "mover", "mathbackground mathcolor accent href" & commonAttr)
macro mpadded*(e: varargs[untyped]): untyped = macro mpadded*(e: varargs[untyped]): untyped =
## Generates the HTML ``mpadded`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mpadded` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mpadded ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mpadded
result = xmlCheckedTag(e, "mpadded", "mathbackground mathcolor depth href lspace voffset" & commonAttr) result = xmlCheckedTag(e, "mpadded", "mathbackground mathcolor depth href lspace voffset" & commonAttr)
macro mphantom*(e: varargs[untyped]): untyped = macro mphantom*(e: varargs[untyped]): untyped =
## Generates the HTML ``mphantom`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mphantom` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mphantom ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mphantom
result = xmlCheckedTag(e, "mphantom", "mathbackground" & commonAttr) result = xmlCheckedTag(e, "mphantom", "mathbackground" & commonAttr)
macro mroot*(e: varargs[untyped]): untyped = macro mroot*(e: varargs[untyped]): untyped =
## Generates the HTML ``mroot`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mroot` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mroot ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mroot
result = xmlCheckedTag(e, "mroot", "mathbackground mathcolor href" & commonAttr) result = xmlCheckedTag(e, "mroot", "mathbackground mathcolor href" & commonAttr)
macro mrow*(e: varargs[untyped]): untyped = macro mrow*(e: varargs[untyped]): untyped =
## Generates the HTML ``mrow`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mrow` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mrow ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mrow
result = xmlCheckedTag(e, "mrow", "mathbackground mathcolor href" & commonAttr) result = xmlCheckedTag(e, "mrow", "mathbackground mathcolor href" & commonAttr)
macro ms*(e: varargs[untyped]): untyped = macro ms*(e: varargs[untyped]): untyped =
## Generates the HTML ``ms`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `ms` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/ms ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/ms
result = xmlCheckedTag(e, "ms", "mathbackground mathcolor href lquote mathsize mathvariant rquote" & commonAttr) result = xmlCheckedTag(e, "ms", "mathbackground mathcolor href lquote mathsize mathvariant rquote" & commonAttr)
macro mspace*(e: varargs[untyped]): untyped = macro mspace*(e: varargs[untyped]): untyped =
## Generates the HTML ``mspace`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mspace` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mspace ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mspace
result = xmlCheckedTag(e, "mspace", "mathbackground mathcolor href linebreak" & commonAttr) result = xmlCheckedTag(e, "mspace", "mathbackground mathcolor href linebreak" & commonAttr)
macro msqrt*(e: varargs[untyped]): untyped = macro msqrt*(e: varargs[untyped]): untyped =
## Generates the HTML ``msqrt`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `msqrt` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msqrt ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msqrt
result = xmlCheckedTag(e, "msqrt", "mathbackground mathcolor href" & commonAttr) result = xmlCheckedTag(e, "msqrt", "mathbackground mathcolor href" & commonAttr)
macro mstyle*(e: varargs[untyped]): untyped = macro mstyle*(e: varargs[untyped]): untyped =
## Generates the HTML ``mstyle`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mstyle` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mstyle ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mstyle
result = xmlCheckedTag(e, "mstyle", ("mathbackground mathcolor href decimalpoint displaystyle " & result = xmlCheckedTag(e, "mstyle", ("mathbackground mathcolor href decimalpoint displaystyle " &
"infixlinebreakstyle scriptlevel scriptminsize scriptsizemultiplier" & commonAttr)) "infixlinebreakstyle scriptlevel scriptminsize scriptsizemultiplier" & commonAttr))
macro msub*(e: varargs[untyped]): untyped = macro msub*(e: varargs[untyped]): untyped =
## Generates the HTML ``msub`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `msub` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msub ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msub
result = xmlCheckedTag(e, "msub", "mathbackground mathcolor href subscriptshift" & commonAttr) result = xmlCheckedTag(e, "msub", "mathbackground mathcolor href subscriptshift" & commonAttr)
macro msubsup*(e: varargs[untyped]): untyped = macro msubsup*(e: varargs[untyped]): untyped =
## Generates the HTML ``msubsup`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `msubsup` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msubsup ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msubsup
result = xmlCheckedTag(e, "msubsup", "mathbackground mathcolor href subscriptshift superscriptshift" & commonAttr) result = xmlCheckedTag(e, "msubsup", "mathbackground mathcolor href subscriptshift superscriptshift" & commonAttr)
macro msup*(e: varargs[untyped]): untyped = macro msup*(e: varargs[untyped]): untyped =
## Generates the HTML ``msup`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `msup` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msup ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msup
result = xmlCheckedTag(e, "msup", "mathbackground mathcolor href superscriptshift" & commonAttr) result = xmlCheckedTag(e, "msup", "mathbackground mathcolor href superscriptshift" & commonAttr)
macro mtable*(e: varargs[untyped]): untyped = macro mtable*(e: varargs[untyped]): untyped =
## Generates the HTML ``mtable`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mtable` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtable ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtable
result = xmlCheckedTag(e, "mtable", ("mathbackground mathcolor href align " & result = xmlCheckedTag(e, "mtable", ("mathbackground mathcolor href align " &
"alignmentscope columnalign columnlines columnspacing columnwidth " & "alignmentscope columnalign columnlines columnspacing columnwidth " &
@ -745,38 +745,38 @@ macro mtable*(e: varargs[untyped]): untyped =
"rowalign rowlines rowspacing side width" & commonAttr)) "rowalign rowlines rowspacing side width" & commonAttr))
macro mtd*(e: varargs[untyped]): untyped = macro mtd*(e: varargs[untyped]): untyped =
## Generates the HTML ``mtd`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mtd` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtd ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtd
result = xmlCheckedTag(e, "mtd", result = xmlCheckedTag(e, "mtd",
"mathbackground mathcolor href columnalign columnspan groupalign rowalign rowspan" & commonAttr) "mathbackground mathcolor href columnalign columnspan groupalign rowalign rowspan" & commonAttr)
macro mtext*(e: varargs[untyped]): untyped = macro mtext*(e: varargs[untyped]): untyped =
## Generates the HTML ``mtext`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `mtext` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtext ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtext
result = xmlCheckedTag(e, "mtext", "mathbackground mathcolor href mathsize mathvariant" & commonAttr) result = xmlCheckedTag(e, "mtext", "mathbackground mathcolor href mathsize mathvariant" & commonAttr)
macro munder*(e: varargs[untyped]): untyped = macro munder*(e: varargs[untyped]): untyped =
## Generates the HTML ``munder`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `munder` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/munder ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/munder
result = xmlCheckedTag(e, "munder", "mathbackground mathcolor href accentunder align" & commonAttr) result = xmlCheckedTag(e, "munder", "mathbackground mathcolor href accentunder align" & commonAttr)
macro munderover*(e: varargs[untyped]): untyped = macro munderover*(e: varargs[untyped]): untyped =
## Generates the HTML ``munderover`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `munderover` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/munderover ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/munderover
result = xmlCheckedTag(e, "munderover", "mathbackground mathcolor href accentunder accent align" & commonAttr) result = xmlCheckedTag(e, "munderover", "mathbackground mathcolor href accentunder accent align" & commonAttr)
macro semantics*(e: varargs[untyped]): untyped = macro semantics*(e: varargs[untyped]): untyped =
## Generates the HTML ``semantics`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `semantics` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics
result = xmlCheckedTag(e, "semantics", "mathbackground mathcolor href definitionURL encoding cd src" & commonAttr) result = xmlCheckedTag(e, "semantics", "mathbackground mathcolor href definitionURL encoding cd src" & commonAttr)
macro annotation*(e: varargs[untyped]): untyped = macro annotation*(e: varargs[untyped]): untyped =
## Generates the HTML ``annotation`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `annotation` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics
result = xmlCheckedTag(e, "annotation", "mathbackground mathcolor href definitionURL encoding cd src" & commonAttr) result = xmlCheckedTag(e, "annotation", "mathbackground mathcolor href definitionURL encoding cd src" & commonAttr)
macro `annotation-xml`*(e: varargs[untyped]): untyped = macro `annotation-xml`*(e: varargs[untyped]): untyped =
## Generates the HTML ``annotation-xml`` element. MathML https://wikipedia.org/wiki/MathML ## Generates the HTML `annotation-xml` element. MathML https://wikipedia.org/wiki/MathML
## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics ## https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics
result = xmlCheckedTag(e, "annotation", "mathbackground mathcolor href definitionURL encoding cd src" & commonAttr) result = xmlCheckedTag(e, "annotation", "mathbackground mathcolor href definitionURL encoding cd src" & commonAttr)

View file

@ -19,7 +19,7 @@
## ##
## Every tag in the resulting tree is in lower case. ## Every tag in the resulting tree is in lower case.
## ##
## **Note:** The resulting ``XmlNode`` already uses the ``clientData`` field, ## **Note:** The resulting `XmlNode` already uses the `clientData` field,
## so it cannot be used by clients of this library. ## so it cannot be used by clients of this library.
## ##
## Example: Transforming hyperlinks ## Example: Transforming hyperlinks
@ -27,7 +27,7 @@
## ##
## This code demonstrates how you can iterate over all the tags in an HTML file ## 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 ## and write back the modified version. In this case we look for hyperlinks
## ending with the extension ``.rst`` and convert them to ``.html``. ## ending with the extension `.rst` and convert them to `.html`.
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## :test: ## :test:
@ -55,129 +55,129 @@ type
HtmlTag* = enum ## list of all supported HTML tags; order will always be HtmlTag* = enum ## list of all supported HTML tags; order will always be
## alphabetically ## alphabetically
tagUnknown, ## unknown HTML element tagUnknown, ## unknown HTML element
tagA, ## the HTML ``a`` element tagA, ## the HTML `a` element
tagAbbr, ## the deprecated HTML ``abbr`` element tagAbbr, ## the deprecated HTML `abbr` element
tagAcronym, ## the HTML ``acronym`` element tagAcronym, ## the HTML `acronym` element
tagAddress, ## the HTML ``address`` element tagAddress, ## the HTML `address` element
tagApplet, ## the deprecated HTML ``applet`` element tagApplet, ## the deprecated HTML `applet` element
tagArea, ## the HTML ``area`` element tagArea, ## the HTML `area` element
tagArticle, ## the HTML ``article`` element tagArticle, ## the HTML `article` element
tagAside, ## the HTML ``aside`` element tagAside, ## the HTML `aside` element
tagAudio, ## the HTML ``audio`` element tagAudio, ## the HTML `audio` element
tagB, ## the HTML ``b`` element tagB, ## the HTML `b` element
tagBase, ## the HTML ``base`` element tagBase, ## the HTML `base` element
tagBdi, ## the HTML ``bdi`` element tagBdi, ## the HTML `bdi` element
tagBdo, ## the deprecated HTML ``dbo`` element tagBdo, ## the deprecated HTML `dbo` element
tagBasefont, ## the deprecated HTML ``basefont`` element tagBasefont, ## the deprecated HTML `basefont` element
tagBig, ## the HTML ``big`` element tagBig, ## the HTML `big` element
tagBlockquote, ## the HTML ``blockquote`` element tagBlockquote, ## the HTML `blockquote` element
tagBody, ## the HTML ``body`` element tagBody, ## the HTML `body` element
tagBr, ## the HTML ``br`` element tagBr, ## the HTML `br` element
tagButton, ## the HTML ``button`` element tagButton, ## the HTML `button` element
tagCanvas, ## the HTML ``canvas`` element tagCanvas, ## the HTML `canvas` element
tagCaption, ## the HTML ``caption`` element tagCaption, ## the HTML `caption` element
tagCenter, ## the deprecated HTML ``center`` element tagCenter, ## the deprecated HTML `center` element
tagCite, ## the HTML ``cite`` element tagCite, ## the HTML `cite` element
tagCode, ## the HTML ``code`` element tagCode, ## the HTML `code` element
tagCol, ## the HTML ``col`` element tagCol, ## the HTML `col` element
tagColgroup, ## the HTML ``colgroup`` element tagColgroup, ## the HTML `colgroup` element
tagCommand, ## the HTML ``command`` element tagCommand, ## the HTML `command` element
tagDatalist, ## the HTML ``datalist`` element tagDatalist, ## the HTML `datalist` element
tagDd, ## the HTML ``dd`` element tagDd, ## the HTML `dd` element
tagDel, ## the HTML ``del`` element tagDel, ## the HTML `del` element
tagDetails, ## the HTML ``details`` element tagDetails, ## the HTML `details` element
tagDfn, ## the HTML ``dfn`` element tagDfn, ## the HTML `dfn` element
tagDialog, ## the HTML ``dialog`` element tagDialog, ## the HTML `dialog` element
tagDiv, ## the HTML ``div`` element tagDiv, ## the HTML `div` element
tagDir, ## the deprecated HTLM ``dir`` element tagDir, ## the deprecated HTLM `dir` element
tagDl, ## the HTML ``dl`` element tagDl, ## the HTML `dl` element
tagDt, ## the HTML ``dt`` element tagDt, ## the HTML `dt` element
tagEm, ## the HTML ``em`` element tagEm, ## the HTML `em` element
tagEmbed, ## the HTML ``embed`` element tagEmbed, ## the HTML `embed` element
tagFieldset, ## the HTML ``fieldset`` element tagFieldset, ## the HTML `fieldset` element
tagFigcaption, ## the HTML ``figcaption`` element tagFigcaption, ## the HTML `figcaption` element
tagFigure, ## the HTML ``figure`` element tagFigure, ## the HTML `figure` element
tagFont, ## the deprecated HTML ``font`` element tagFont, ## the deprecated HTML `font` element
tagFooter, ## the HTML ``footer`` element tagFooter, ## the HTML `footer` element
tagForm, ## the HTML ``form`` element tagForm, ## the HTML `form` element
tagFrame, ## the HTML ``frame`` element tagFrame, ## the HTML `frame` element
tagFrameset, ## the deprecated HTML ``frameset`` element tagFrameset, ## the deprecated HTML `frameset` element
tagH1, ## the HTML ``h1`` element tagH1, ## the HTML `h1` element
tagH2, ## the HTML ``h2`` element tagH2, ## the HTML `h2` element
tagH3, ## the HTML ``h3`` element tagH3, ## the HTML `h3` element
tagH4, ## the HTML ``h4`` element tagH4, ## the HTML `h4` element
tagH5, ## the HTML ``h5`` element tagH5, ## the HTML `h5` element
tagH6, ## the HTML ``h6`` element tagH6, ## the HTML `h6` element
tagHead, ## the HTML ``head`` element tagHead, ## the HTML `head` element
tagHeader, ## the HTML ``header`` element tagHeader, ## the HTML `header` element
tagHgroup, ## the HTML ``hgroup`` element tagHgroup, ## the HTML `hgroup` element
tagHtml, ## the HTML ``html`` element tagHtml, ## the HTML `html` element
tagHr, ## the HTML ``hr`` element tagHr, ## the HTML `hr` element
tagI, ## the HTML ``i`` element tagI, ## the HTML `i` element
tagIframe, ## the deprecated HTML ``iframe`` element tagIframe, ## the deprecated HTML `iframe` element
tagImg, ## the HTML ``img`` element tagImg, ## the HTML `img` element
tagInput, ## the HTML ``input`` element tagInput, ## the HTML `input` element
tagIns, ## the HTML ``ins`` element tagIns, ## the HTML `ins` element
tagIsindex, ## the deprecated HTML ``isindex`` element tagIsindex, ## the deprecated HTML `isindex` element
tagKbd, ## the HTML ``kbd`` element tagKbd, ## the HTML `kbd` element
tagKeygen, ## the HTML ``keygen`` element tagKeygen, ## the HTML `keygen` element
tagLabel, ## the HTML ``label`` element tagLabel, ## the HTML `label` element
tagLegend, ## the HTML ``legend`` element tagLegend, ## the HTML `legend` element
tagLi, ## the HTML ``li`` element tagLi, ## the HTML `li` element
tagLink, ## the HTML ``link`` element tagLink, ## the HTML `link` element
tagMap, ## the HTML ``map`` element tagMap, ## the HTML `map` element
tagMark, ## the HTML ``mark`` element tagMark, ## the HTML `mark` element
tagMenu, ## the deprecated HTML ``menu`` element tagMenu, ## the deprecated HTML `menu` element
tagMeta, ## the HTML ``meta`` element tagMeta, ## the HTML `meta` element
tagMeter, ## the HTML ``meter`` element tagMeter, ## the HTML `meter` element
tagNav, ## the HTML ``nav`` element tagNav, ## the HTML `nav` element
tagNobr, ## the deprecated HTML ``nobr`` element tagNobr, ## the deprecated HTML `nobr` element
tagNoframes, ## the deprecated HTML ``noframes`` element tagNoframes, ## the deprecated HTML `noframes` element
tagNoscript, ## the HTML ``noscript`` element tagNoscript, ## the HTML `noscript` element
tagObject, ## the HTML ``object`` element tagObject, ## the HTML `object` element
tagOl, ## the HTML ``ol`` element tagOl, ## the HTML `ol` element
tagOptgroup, ## the HTML ``optgroup`` element tagOptgroup, ## the HTML `optgroup` element
tagOption, ## the HTML ``option`` element tagOption, ## the HTML `option` element
tagOutput, ## the HTML ``output`` element tagOutput, ## the HTML `output` element
tagP, ## the HTML ``p`` element tagP, ## the HTML `p` element
tagParam, ## the HTML ``param`` element tagParam, ## the HTML `param` element
tagPre, ## the HTML ``pre`` element tagPre, ## the HTML `pre` element
tagProgress, ## the HTML ``progress`` element tagProgress, ## the HTML `progress` element
tagQ, ## the HTML ``q`` element tagQ, ## the HTML `q` element
tagRp, ## the HTML ``rp`` element tagRp, ## the HTML `rp` element
tagRt, ## the HTML ``rt`` element tagRt, ## the HTML `rt` element
tagRuby, ## the HTML ``ruby`` element tagRuby, ## the HTML `ruby` element
tagS, ## the deprecated HTML ``s`` element tagS, ## the deprecated HTML `s` element
tagSamp, ## the HTML ``samp`` element tagSamp, ## the HTML `samp` element
tagScript, ## the HTML ``script`` element tagScript, ## the HTML `script` element
tagSection, ## the HTML ``section`` element tagSection, ## the HTML `section` element
tagSelect, ## the HTML ``select`` element tagSelect, ## the HTML `select` element
tagSmall, ## the HTML ``small`` element tagSmall, ## the HTML `small` element
tagSource, ## the HTML ``source`` element tagSource, ## the HTML `source` element
tagSpan, ## the HTML ``span`` element tagSpan, ## the HTML `span` element
tagStrike, ## the deprecated HTML ``strike`` element tagStrike, ## the deprecated HTML `strike` element
tagStrong, ## the HTML ``strong`` element tagStrong, ## the HTML `strong` element
tagStyle, ## the HTML ``style`` element tagStyle, ## the HTML `style` element
tagSub, ## the HTML ``sub`` element tagSub, ## the HTML `sub` element
tagSummary, ## the HTML ``summary`` element tagSummary, ## the HTML `summary` element
tagSup, ## the HTML ``sup`` element tagSup, ## the HTML `sup` element
tagTable, ## the HTML ``table`` element tagTable, ## the HTML `table` element
tagTbody, ## the HTML ``tbody`` element tagTbody, ## the HTML `tbody` element
tagTd, ## the HTML ``td`` element tagTd, ## the HTML `td` element
tagTextarea, ## the HTML ``textarea`` element tagTextarea, ## the HTML `textarea` element
tagTfoot, ## the HTML ``tfoot`` element tagTfoot, ## the HTML `tfoot` element
tagTh, ## the HTML ``th`` element tagTh, ## the HTML `th` element
tagThead, ## the HTML ``thead`` element tagThead, ## the HTML `thead` element
tagTime, ## the HTML ``time`` element tagTime, ## the HTML `time` element
tagTitle, ## the HTML ``title`` element tagTitle, ## the HTML `title` element
tagTr, ## the HTML ``tr`` element tagTr, ## the HTML `tr` element
tagTrack, ## the HTML ``track`` element tagTrack, ## the HTML `track` element
tagTt, ## the HTML ``tt`` element tagTt, ## the HTML `tt` element
tagU, ## the deprecated HTML ``u`` element tagU, ## the deprecated HTML `u` element
tagUl, ## the HTML ``ul`` element tagUl, ## the HTML `ul` element
tagVar, ## the HTML ``var`` element tagVar, ## the HTML `var` element
tagVideo, ## the HTML ``video`` element tagVideo, ## the HTML `video` element
tagWbr ## the HTML ``wbr`` element tagWbr ## the HTML `wbr` element
const const
tagToStr* = [ tagToStr* = [
@ -351,13 +351,13 @@ proc toHtmlTag(s: string): HtmlTag =
proc htmlTag*(n: XmlNode): HtmlTag = proc htmlTag*(n: XmlNode): HtmlTag =
## Gets `n`'s tag as a ``HtmlTag``. ## Gets `n`'s tag as a `HtmlTag`.
if n.clientData == 0: if n.clientData == 0:
n.clientData = toHtmlTag(n.tag).ord n.clientData = toHtmlTag(n.tag).ord
result = HtmlTag(n.clientData) result = HtmlTag(n.clientData)
proc htmlTag*(s: string): HtmlTag = proc htmlTag*(s: string): HtmlTag =
## Converts `s` to a ``HtmlTag``. If `s` is no HTML tag, ``tagUnknown`` is ## Converts `s` to a `HtmlTag`. If `s` is no HTML tag, `tagUnknown` is
## returned. ## returned.
let s = if allLower(s): s else: toLowerAscii(s) let s = if allLower(s): s else: toLowerAscii(s)
result = toHtmlTag(s) result = toHtmlTag(s)
@ -374,8 +374,8 @@ proc runeToEntity*(rune: Rune): string =
else: result = '#' & $rune.ord else: result = '#' & $rune.ord
proc entityToRune*(entity: string): Rune = proc entityToRune*(entity: string): Rune =
## Converts an HTML entity name like ``Ü`` or values like ``Ü`` ## Converts an HTML entity name like `Ü` or values like `Ü`
## or ``Ü`` to its UTF-8 equivalent. ## or `Ü` to its UTF-8 equivalent.
## Rune(0) is returned if the entity name is unknown. ## Rune(0) is returned if the entity name is unknown.
runnableExamples: runnableExamples:
import unicode import unicode
@ -395,7 +395,7 @@ proc entityToRune*(entity: string): Rune =
of 'x', 'X': # not case sensitive here of 'x', 'X': # not case sensitive here
try: runeValue = parseHexInt(entity[2..^1]) try: runeValue = parseHexInt(entity[2..^1])
except: discard except: discard
else: discard # other entities are not defined with prefix ``#`` else: discard # other entities are not defined with prefix `#`
if runeValue notin 0..0x10FFFF: runeValue = 0 # only return legal values if runeValue notin 0..0x10FFFF: runeValue = 0 # only return legal values
return Rune(runeValue) return Rune(runeValue)
case entity # entity names are case sensitive case entity # entity names are case sensitive
@ -1867,8 +1867,8 @@ proc entityToRune*(entity: string): Rune =
else: Rune(0) else: Rune(0)
proc entityToUtf8*(entity: string): string = proc entityToUtf8*(entity: string): string =
## Converts an HTML entity name like ``Ü`` or values like ``Ü`` ## Converts an HTML entity name like `Ü` or values like `Ü`
## or ``Ü`` to its UTF-8 equivalent. ## or `Ü` to its UTF-8 equivalent.
## "" is returned if the entity name is unknown. The HTML parser ## "" is returned if the entity name is unknown. The HTML parser
## already converts entities to UTF-8. ## already converts entities to UTF-8.
runnableExamples: runnableExamples:
@ -1905,7 +1905,7 @@ template adderr(x: untyped) =
proc untilElementEnd(x: var XmlParser, result: XmlNode, proc untilElementEnd(x: var XmlParser, result: XmlNode,
errors: var seq[string]) = errors: var seq[string]) =
# we parsed e.g. ``<br>`` and don't really expect a ``</br>``: # we parsed e.g. `<br>` and don't really expect a `</br>`:
if result.htmlTag in SingleTags: if result.htmlTag in SingleTags:
if x.kind != xmlElementEnd or cmpIgnoreCase(x.elemName, result.tag) != 0: if x.kind != xmlElementEnd or cmpIgnoreCase(x.elemName, result.tag) != 0:
return return
@ -1914,8 +1914,8 @@ proc untilElementEnd(x: var XmlParser, result: XmlNode,
of xmlElementStart, xmlElementOpen: of xmlElementStart, xmlElementOpen:
case result.htmlTag case result.htmlTag
of tagP, tagInput, tagOption: of tagP, tagInput, tagOption:
# some tags are common to have no ``</end>``, like ``<li>`` but # some tags are common to have no `</end>`, like `<li>` but
# allow ``<p>`` in `<dd>`, `<dt>` and ``<li>`` in next case # allow `<p>` in `<dd>`, `<dt>` and `<li>` in next case
if htmlTag(x.elemName) in {tagLi, tagP, tagDt, tagDd, tagInput, if htmlTag(x.elemName) in {tagLi, tagP, tagDt, tagDd, tagInput,
tagOption}: tagOption}:
adderr(expected(x, result)) adderr(expected(x, result))
@ -2012,7 +2012,7 @@ proc parse(x: var XmlParser, errors: var seq[string]): XmlNode =
proc parseHtml*(s: Stream, filename: string, proc parseHtml*(s: Stream, filename: string,
errors: var seq[string]): XmlNode = errors: var seq[string]): XmlNode =
## Parses the XML from stream `s` and returns a ``XmlNode``. Every ## Parses the XML from stream `s` and returns a `XmlNode`. Every
## occurred parsing error is added to the `errors` sequence. ## occurred parsing error is added to the `errors` sequence.
var x: XmlParser var x: XmlParser
open(x, s, filename, {reportComments, reportWhitespace, allowUnquotedAttribs, open(x, s, filename, {reportComments, reportWhitespace, allowUnquotedAttribs,
@ -2036,27 +2036,27 @@ proc parseHtml*(s: Stream, filename: string,
result = result[0] result = result[0]
proc parseHtml*(s: Stream): XmlNode = proc parseHtml*(s: Stream): XmlNode =
## Parses the HTML from stream `s` and returns a ``XmlNode``. All parsing ## Parses the HTML from stream `s` and returns a `XmlNode`. All parsing
## errors are ignored. ## errors are ignored.
var errors: seq[string] = @[] var errors: seq[string] = @[]
result = parseHtml(s, "unknown_html_doc", errors) result = parseHtml(s, "unknown_html_doc", errors)
proc parseHtml*(html: string): XmlNode = proc parseHtml*(html: string): XmlNode =
## Parses the HTML from string ``html`` and returns a ``XmlNode``. All parsing ## Parses the HTML from string `html` and returns a `XmlNode`. All parsing
## errors are ignored. ## errors are ignored.
parseHtml(newStringStream(html)) parseHtml(newStringStream(html))
proc loadHtml*(path: string, errors: var seq[string]): XmlNode = proc loadHtml*(path: string, errors: var seq[string]): XmlNode =
## Loads and parses HTML from file specified by ``path``, and returns ## Loads and parses HTML from file specified by `path`, and returns
## a ``XmlNode``. Every occurred parsing error is added to ## a `XmlNode`. Every occurred parsing error is added to
## the `errors` sequence. ## the `errors` sequence.
var s = newFileStream(path, fmRead) var s = newFileStream(path, fmRead)
if s == nil: raise newException(IOError, "Unable to read file: " & path) if s == nil: raise newException(IOError, "Unable to read file: " & path)
result = parseHtml(s, path, errors) result = parseHtml(s, path, errors)
proc loadHtml*(path: string): XmlNode = proc loadHtml*(path: string): XmlNode =
## Loads and parses HTML from file specified by ``path``, and returns ## Loads and parses HTML from file specified by `path`, and returns
## a ``XmlNode``. All parsing errors are ignored. ## a `XmlNode`. All parsing errors are ignored.
var errors: seq[string] = @[] var errors: seq[string] = @[]
result = loadHtml(path, errors) result = loadHtml(path, errors)

View file

@ -14,7 +14,7 @@
## ==================== ## ====================
## ##
## This example uses HTTP GET to retrieve ## This example uses HTTP GET to retrieve
## ``http://google.com``: ## `http://google.com`:
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## import httpclient ## import httpclient
@ -22,7 +22,7 @@
## echo client.getContent("http://google.com") ## echo client.getContent("http://google.com")
## ##
## The same action can also be performed asynchronously, simply use the ## The same action can also be performed asynchronously, simply use the
## ``AsyncHttpClient``: ## `AsyncHttpClient`:
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## import asyncdispatch, httpclient ## import asyncdispatch, httpclient
@ -33,18 +33,18 @@
## ##
## echo waitFor asyncProc() ## echo waitFor asyncProc()
## ##
## The functionality implemented by ``HttpClient`` and ``AsyncHttpClient`` ## The functionality implemented by `HttpClient` and `AsyncHttpClient`
## is the same, so you can use whichever one suits you best in the examples ## is the same, so you can use whichever one suits you best in the examples
## shown here. ## shown here.
## ##
## **Note:** You need to run asynchronous examples in an async proc ## **Note:** You need to run asynchronous examples in an async proc
## otherwise you will get an ``Undeclared identifier: 'await'`` error. ## otherwise you will get an `Undeclared identifier: 'await'` error.
## ##
## Using HTTP POST ## Using HTTP POST
## =============== ## ===============
## ##
## This example demonstrates the usage of the W3 HTML Validator, it ## This example demonstrates the usage of the W3 HTML Validator, it
## uses ``multipart/form-data`` as the ``Content-Type`` to send the HTML to be ## uses `multipart/form-data` as the `Content-Type` to send the HTML to be
## validated to the server. ## validated to the server.
## ##
## .. code-block:: Nim ## .. code-block:: Nim
@ -56,10 +56,10 @@
## ##
## echo client.postContent("http://validator.w3.org/check", multipart=data) ## echo client.postContent("http://validator.w3.org/check", multipart=data)
## ##
## To stream files from disk when performing the request, use ``addFiles``. ## To stream files from disk when performing the request, use `addFiles`.
## ##
## **Note:** This will allocate a new ``Mimetypes`` database every time you call ## **Note:** This will allocate a new `Mimetypes` database every time you call
## it, you can pass your own via the ``mimeDb`` parameter to avoid this. ## it, you can pass your own via the `mimeDb` parameter to avoid this.
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## let mimes = newMimetypes() ## let mimes = newMimetypes()
@ -70,7 +70,7 @@
## echo client.postContent("http://validator.w3.org/check", multipart=data) ## echo client.postContent("http://validator.w3.org/check", multipart=data)
## ##
## You can also make post requests with custom headers. ## You can also make post requests with custom headers.
## This example sets ``Content-Type`` to ``application/json`` ## This example sets `Content-Type` to `application/json`
## and uses a json object for the body ## and uses a json object for the body
## ##
## .. code-block:: Nim ## .. code-block:: Nim
@ -105,23 +105,23 @@
## ##
## waitFor asyncProc() ## waitFor asyncProc()
## ##
## If you would like to remove the callback simply set it to ``nil``. ## If you would like to remove the callback simply set it to `nil`.
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## client.onProgressChanged = nil ## client.onProgressChanged = nil
## ##
## **Warning:** The ``total`` reported by httpclient may be 0 in some cases. ## **Warning:** The `total` reported by httpclient may be 0 in some cases.
## ##
## ##
## SSL/TLS support ## SSL/TLS support
## =============== ## ===============
## This requires the OpenSSL library, fortunately it's widely used and installed ## This requires the OpenSSL library, fortunately it's widely used and installed
## on many operating systems. httpclient will use SSL automatically if you give ## on many operating systems. httpclient will use SSL automatically if you give
## any of the functions a url with the ``https`` schema, for example: ## any of the functions a url with the `https` schema, for example:
## ``https://github.com/``. ## `https://github.com/`.
## ##
## You will also have to compile with ``ssl`` defined like so: ## You will also have to compile with `ssl` defined like so:
## ``nim c -d:ssl ...``. ## `nim c -d:ssl ...`.
## ##
## Certificate validation is NOT performed by default. ## Certificate validation is NOT performed by default.
## This will change in the future. ## This will change in the future.
@ -144,9 +144,9 @@
## individual internal calls on the socket are affected. In practice this means ## individual internal calls on the socket are affected. In practice this means
## that as long as the server is sending data an exception will not be raised, ## that as long as the server is sending data an exception will not be raised,
## if however data does not reach the client within the specified timeout a ## if however data does not reach the client within the specified timeout a
## ``TimeoutError`` exception will be raised. ## `TimeoutError` exception will be raised.
## ##
## Here is how to set a timeout when creating an ``HttpClient`` instance: ## Here is how to set a timeout when creating an `HttpClient` instance:
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## import httpclient ## import httpclient
@ -157,10 +157,10 @@
## ===== ## =====
## ##
## A proxy can be specified as a param to any of the procedures defined in ## A proxy can be specified as a param to any of the procedures defined in
## this module. To do this, use the ``newProxy`` constructor. Unfortunately, ## this module. To do this, use the `newProxy` constructor. Unfortunately,
## only basic authentication is supported at the moment. ## only basic authentication is supported at the moment.
## ##
## Some examples on how to configure a Proxy for ``HttpClient``: ## Some examples on how to configure a Proxy for `HttpClient`:
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## import httpclient ## import httpclient
@ -188,11 +188,11 @@
## Redirects ## Redirects
## ========= ## =========
## ##
## The maximum redirects can be set with the ``maxRedirects`` of ``int`` type, ## The maximum redirects can be set with the `maxRedirects` of `int` type,
## it specifies the maximum amount of redirects to follow, ## it specifies the maximum amount of redirects to follow,
## it defaults to ``5``, you can set it to ``0`` to disable redirects. ## it defaults to `5`, you can set it to `0` to disable redirects.
## ##
## Here you can see an example about how to set the ``maxRedirects`` of ``HttpClient``: ## Here you can see an example about how to set the `maxRedirects` of `HttpClient`:
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## import httpclient ## import httpclient
@ -207,7 +207,7 @@ import net, strutils, uri, parseutils, base64, os, mimetypes, streams,
import asyncnet, asyncdispatch, asyncfile import asyncnet, asyncdispatch, asyncfile
import nativesockets import nativesockets
export httpcore except parseHeader # TODO: The ``except`` doesn't work export httpcore except parseHeader # TODO: The `except` doesn't work
type type
Response* = ref object Response* = ref object
@ -226,10 +226,10 @@ type
proc code*(response: Response | AsyncResponse): HttpCode proc code*(response: Response | AsyncResponse): HttpCode
{.raises: [ValueError, OverflowDefect].} = {.raises: [ValueError, OverflowDefect].} =
## Retrieves the specified response's ``HttpCode``. ## Retrieves the specified response's `HttpCode`.
## ##
## Raises a ``ValueError`` if the response's ``status`` does not have a ## Raises a `ValueError` if the response's `status` does not have a
## corresponding ``HttpCode``. ## corresponding `HttpCode`.
return response.status[0 .. 2].parseInt.HttpCode return response.status[0 .. 2].parseInt.HttpCode
proc contentType*(response: Response | AsyncResponse): string {.inline.} = proc contentType*(response: Response | AsyncResponse): string {.inline.} =
@ -243,7 +243,7 @@ proc contentLength*(response: Response | AsyncResponse): int =
## ##
## This is effectively the value of the "Content-Length" header. ## This is effectively the value of the "Content-Length" header.
## ##
## A ``ValueError`` exception will be raised if the value is not an integer. ## A `ValueError` exception will be raised if the value is not an integer.
var contentLengthHeader = response.headers.getOrDefault("Content-Length") var contentLengthHeader = response.headers.getOrDefault("Content-Length")
result = contentLengthHeader.parseInt() result = contentLengthHeader.parseInt()
doAssert(result >= 0 and result <= high(int32)) doAssert(result >= 0 and result <= high(int32))
@ -253,7 +253,7 @@ proc lastModified*(response: Response | AsyncResponse): DateTime =
## ##
## This is effectively the value of the "Last-Modified" header. ## This is effectively the value of the "Last-Modified" header.
## ##
## Raises a ``ValueError`` if the parsing fails or the value is not a correctly ## Raises a `ValueError` if the parsing fails or the value is not a correctly
## formatted time. ## formatted time.
var lastModifiedHeader = response.headers.getOrDefault("last-modified") var lastModifiedHeader = response.headers.getOrDefault("last-modified")
result = parse(lastModifiedHeader, "ddd, dd MMM yyyy HH:mm:ss 'GMT'", utc()) result = parse(lastModifiedHeader, "ddd, dd MMM yyyy HH:mm:ss 'GMT'", utc())
@ -295,8 +295,8 @@ type
## does not conform to the implemented ## does not conform to the implemented
## protocol ## protocol
HttpRequestError* = object of IOError ## Thrown in the ``getContent`` proc HttpRequestError* = object of IOError ## Thrown in the `getContent` proc
## and ``postContent`` proc, ## and `postContent` proc,
## when the server returns an error ## when the server returns an error
const defUserAgent* = "Nim httpclient/" & NimVersion const defUserAgent* = "Nim httpclient/" & NimVersion
@ -326,15 +326,15 @@ proc getDefaultSSL(): SslContext =
doAssert result != nil, "failure to initialize the SSL context" doAssert result != nil, "failure to initialize the SSL context"
proc newProxy*(url: string; auth = ""): Proxy = proc newProxy*(url: string; auth = ""): Proxy =
## Constructs a new ``TProxy`` object. ## Constructs a new `TProxy` object.
result = Proxy(url: parseUri(url), auth: auth) result = Proxy(url: parseUri(url), auth: auth)
proc newProxy*(url: Uri; auth = ""): Proxy = proc newProxy*(url: Uri; auth = ""): Proxy =
## Constructs a new ``TProxy`` object. ## Constructs a new `TProxy` object.
result = Proxy(url: url, auth: auth) result = Proxy(url: url, auth: auth)
proc newMultipartData*: MultipartData {.inline.} = proc newMultipartData*: MultipartData {.inline.} =
## Constructs a new ``MultipartData`` object. ## Constructs a new `MultipartData` object.
MultipartData() MultipartData()
proc `$`*(data: MultipartData): string {.since: (1, 1).} = proc `$`*(data: MultipartData): string {.since: (1, 1).} =
@ -353,10 +353,10 @@ proc add*(p: MultipartData, name, content: string, filename: string = "",
contentType: string = "", useStream = true) = contentType: string = "", useStream = true) =
## Add a value to the multipart data. ## Add a value to the multipart data.
## ##
## When ``useStream`` is ``false``, the file will be read into memory. ## When `useStream` is `false`, the file will be read into memory.
## ##
## Raises a ``ValueError`` exception if ## Raises a `ValueError` exception if
## ``name``, ``filename`` or ``contentType`` contain newline characters. ## `name`, `filename` or `contentType` contain newline characters.
if {'\c', '\L'} in name: if {'\c', '\L'} in name:
raise newException(ValueError, "name contains a newline character") raise newException(ValueError, "name contains a newline character")
if {'\c', '\L'} in filename: if {'\c', '\L'} in filename:
@ -379,7 +379,7 @@ proc add*(p: MultipartData, name, content: string, filename: string = "",
proc add*(p: MultipartData, xs: MultipartEntries): MultipartData proc add*(p: MultipartData, xs: MultipartEntries): MultipartData
{.discardable.} = {.discardable.} =
## Add a list of multipart entries to the multipart data ``p``. All values are ## Add a list of multipart entries to the multipart data `p`. All values are
## added without a filename and without a content type. ## added without a filename and without a content type.
## ##
## .. code-block:: Nim ## .. code-block:: Nim
@ -389,7 +389,7 @@ proc add*(p: MultipartData, xs: MultipartEntries): MultipartData
result = p result = p
proc newMultipartData*(xs: MultipartEntries): MultipartData = proc newMultipartData*(xs: MultipartEntries): MultipartData =
## Create a new multipart data object and fill it with the entries ``xs`` ## Create a new multipart data object and fill it with the entries `xs`
## directly. ## directly.
## ##
## .. code-block:: Nim ## .. code-block:: Nim
@ -402,11 +402,11 @@ proc addFiles*(p: MultipartData, xs: openArray[tuple[name, file: string]],
mimeDb = newMimetypes(), useStream = true): mimeDb = newMimetypes(), useStream = true):
MultipartData {.discardable.} = MultipartData {.discardable.} =
## Add files to a multipart data object. The files will be streamed from disk ## Add files to a multipart data object. The files will be streamed from disk
## when the request is being made. When ``stream`` is ``false``, the files are ## when the request is being made. When `stream` is `false`, the files are
## instead read into memory, but beware this is very memory ineffecient even ## instead read into memory, but beware this is very memory ineffecient even
## for small files. The MIME types will automatically be determined. ## for small files. The MIME types will automatically be determined.
## Raises an ``IOError`` if the file cannot be opened or reading fails. To ## Raises an `IOError` if the file cannot be opened or reading fails. To
## manually specify file content, filename and MIME type, use ``[]=`` instead. ## manually specify file content, filename and MIME type, use `[]=` instead.
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## data.addFiles({"uploaded_file": "public/test.html"}) ## data.addFiles({"uploaded_file": "public/test.html"})
@ -420,7 +420,7 @@ proc addFiles*(p: MultipartData, xs: openArray[tuple[name, file: string]],
result = p result = p
proc `[]=`*(p: MultipartData, name, content: string) {.inline.} = proc `[]=`*(p: MultipartData, name, content: string) {.inline.} =
## Add a multipart entry to the multipart data ``p``. The value is added ## Add a multipart entry to the multipart data `p`. The value is added
## without a filename and without a content type. ## without a filename and without a content type.
## ##
## .. code-block:: Nim ## .. code-block:: Nim
@ -429,7 +429,7 @@ proc `[]=`*(p: MultipartData, name, content: string) {.inline.} =
proc `[]=`*(p: MultipartData, name: string, proc `[]=`*(p: MultipartData, name: string,
file: tuple[name, contentType, content: string]) {.inline.} = file: tuple[name, contentType, content: string]) {.inline.} =
## Add a file to the multipart data ``p``, specifying filename, contentType ## Add a file to the multipart data `p`, specifying filename, contentType
## and content manually. ## and content manually.
## ##
## .. code-block:: Nim ## .. code-block:: Nim
@ -526,11 +526,11 @@ type
connected: bool connected: bool
currentURL: Uri ## Where we are currently connected. currentURL: Uri ## Where we are currently connected.
headers*: HttpHeaders ## Headers to send in requests. headers*: HttpHeaders ## Headers to send in requests.
maxRedirects: Natural ## Maximum redirects, set to ``0`` to disable. maxRedirects: Natural ## Maximum redirects, set to `0` to disable.
userAgent: string userAgent: string
timeout*: int ## Only used for blocking HttpClient for now. timeout*: int ## Only used for blocking HttpClient for now.
proxy: Proxy proxy: Proxy
## ``nil`` or the callback to call when request progress changes. ## `nil` or the callback to call when request progress changes.
when SocketType is Socket: when SocketType is Socket:
onProgressChanged*: ProgressChangedProc[void] onProgressChanged*: ProgressChangedProc[void]
else: else:
@ -556,22 +556,22 @@ proc newHttpClient*(userAgent = defUserAgent, maxRedirects = 5,
timeout = -1, headers = newHttpHeaders()): HttpClient = timeout = -1, headers = newHttpHeaders()): HttpClient =
## Creates a new HttpClient instance. ## Creates a new HttpClient instance.
## ##
## ``userAgent`` specifies the user agent that will be used when making ## `userAgent` specifies the user agent that will be used when making
## requests. ## requests.
## ##
## ``maxRedirects`` specifies the maximum amount of redirects to follow, ## `maxRedirects` specifies the maximum amount of redirects to follow,
## default is 5. ## default is 5.
## ##
## ``sslContext`` specifies the SSL context to use for HTTPS requests. ## `sslContext` specifies the SSL context to use for HTTPS requests.
## See `SSL/TLS support <#sslslashtls-support>`_ ## See `SSL/TLS support <#sslslashtls-support>`_
## ##
## ``proxy`` specifies an HTTP proxy to use for this HTTP client's ## `proxy` specifies an HTTP proxy to use for this HTTP client's
## connections. ## connections.
## ##
## ``timeout`` specifies the number of milliseconds to allow before a ## `timeout` specifies the number of milliseconds to allow before a
## ``TimeoutError`` is raised. ## `TimeoutError` is raised.
## ##
## ``headers`` specifies the HTTP Headers. ## `headers` specifies the HTTP Headers.
runnableExamples: runnableExamples:
import asyncdispatch, httpclient, strutils import asyncdispatch, httpclient, strutils
@ -603,18 +603,18 @@ proc newAsyncHttpClient*(userAgent = defUserAgent, maxRedirects = 5,
headers = newHttpHeaders()): AsyncHttpClient = headers = newHttpHeaders()): AsyncHttpClient =
## Creates a new AsyncHttpClient instance. ## Creates a new AsyncHttpClient instance.
## ##
## ``userAgent`` specifies the user agent that will be used when making ## `userAgent` specifies the user agent that will be used when making
## requests. ## requests.
## ##
## ``maxRedirects`` specifies the maximum amount of redirects to follow, ## `maxRedirects` specifies the maximum amount of redirects to follow,
## default is 5. ## default is 5.
## ##
## ``sslContext`` specifies the SSL context to use for HTTPS requests. ## `sslContext` specifies the SSL context to use for HTTPS requests.
## ##
## ``proxy`` specifies an HTTP proxy to use for this HTTP client's ## `proxy` specifies an HTTP proxy to use for this HTTP client's
## connections. ## connections.
## ##
## ``headers`` specifies the HTTP Headers. ## `headers` specifies the HTTP Headers.
new result new result
result.headers = headers result.headers = headers
result.userAgent = userAgent result.userAgent = userAgent
@ -1034,17 +1034,17 @@ proc request*(client: HttpClient | AsyncHttpClient, url: Uri | string,
multipart: MultipartData = nil): Future[Response | AsyncResponse] multipart: MultipartData = nil): Future[Response | AsyncResponse]
{.multisync.} = {.multisync.} =
## Connects to the hostname specified by the URL and performs a request ## Connects to the hostname specified by the URL and performs a request
## using the custom method string specified by ``httpMethod``. ## using the custom method string specified by `httpMethod`.
## ##
## Connection will be kept alive. Further requests on the same ``client`` to ## Connection will be kept alive. Further requests on the same `client` to
## the same hostname will not require a new connection to be made. The ## the same hostname will not require a new connection to be made. The
## connection can be closed by using the ``close`` procedure. ## connection can be closed by using the `close` procedure.
## ##
## This procedure will follow redirects up to a maximum number of redirects ## This procedure will follow redirects up to a maximum number of redirects
## specified in ``client.maxRedirects``. ## specified in `client.maxRedirects`.
## ##
## You need to make sure that the ``url`` doesn't contain any newline ## You need to make sure that the `url` doesn't contain any newline
## characters. Failing to do so will raise ``AssertionDefect``. ## characters. Failing to do so will raise `AssertionDefect`.
## ##
## `headers` are HTTP headers that override the `client.headers` for ## `headers` are HTTP headers that override the `client.headers` for
## this specific request only and will not be persisted. ## this specific request only and will not be persisted.
@ -1133,7 +1133,7 @@ proc request*(client: HttpClient | AsyncHttpClient, url: Uri | string,
proc responseContent(resp: Response | AsyncResponse): Future[string] {.multisync.} = proc responseContent(resp: Response | AsyncResponse): Future[string] {.multisync.} =
## Returns the content of a response as a string. ## Returns the content of a response as a string.
## ##
## A ``HttpRequestError`` will be raised if the server responds with a ## A `HttpRequestError` will be raised if the server responds with a
## client error (status code 4xx) or a server error (status code 5xx). ## client error (status code 4xx) or a server error (status code 5xx).
if resp.code.is4xx or resp.code.is5xx: if resp.code.is4xx or resp.code.is5xx:
raise newException(HttpRequestError, resp.status) raise newException(HttpRequestError, resp.status)
@ -1144,14 +1144,14 @@ proc head*(client: HttpClient | AsyncHttpClient,
url: Uri | string): Future[Response | AsyncResponse] {.multisync.} = url: Uri | string): Future[Response | AsyncResponse] {.multisync.} =
## Connects to the hostname specified by the URL and performs a HEAD request. ## Connects to the hostname specified by the URL and performs a HEAD request.
## ##
## This procedure uses httpClient values such as ``client.maxRedirects``. ## This procedure uses httpClient values such as `client.maxRedirects`.
result = await client.request(url, HttpHead) result = await client.request(url, HttpHead)
proc get*(client: HttpClient | AsyncHttpClient, proc get*(client: HttpClient | AsyncHttpClient,
url: Uri | string): Future[Response | AsyncResponse] {.multisync.} = url: Uri | string): Future[Response | AsyncResponse] {.multisync.} =
## Connects to the hostname specified by the URL and performs a GET request. ## Connects to the hostname specified by the URL and performs a GET request.
## ##
## This procedure uses httpClient values such as ``client.maxRedirects``. ## This procedure uses httpClient values such as `client.maxRedirects`.
result = await client.request(url, HttpGet) result = await client.request(url, HttpGet)
proc getContent*(client: HttpClient | AsyncHttpClient, proc getContent*(client: HttpClient | AsyncHttpClient,
@ -1163,7 +1163,7 @@ proc getContent*(client: HttpClient | AsyncHttpClient,
proc delete*(client: HttpClient | AsyncHttpClient, proc delete*(client: HttpClient | AsyncHttpClient,
url: Uri | string): Future[Response | AsyncResponse] {.multisync.} = url: Uri | string): Future[Response | AsyncResponse] {.multisync.} =
## Connects to the hostname specified by the URL and performs a DELETE request. ## Connects to the hostname specified by the URL and performs a DELETE request.
## This procedure uses httpClient values such as ``client.maxRedirects``. ## This procedure uses httpClient values such as `client.maxRedirects`.
result = await client.request(url, HttpDelete) result = await client.request(url, HttpDelete)
proc deleteContent*(client: HttpClient | AsyncHttpClient, proc deleteContent*(client: HttpClient | AsyncHttpClient,
@ -1176,7 +1176,7 @@ proc post*(client: HttpClient | AsyncHttpClient, url: Uri | string, body = "",
multipart: MultipartData = nil): Future[Response | AsyncResponse] multipart: MultipartData = nil): Future[Response | AsyncResponse]
{.multisync.} = {.multisync.} =
## Connects to the hostname specified by the URL and performs a POST request. ## Connects to the hostname specified by the URL and performs a POST request.
## This procedure uses httpClient values such as ``client.maxRedirects``. ## This procedure uses httpClient values such as `client.maxRedirects`.
result = await client.request(url, HttpPost, body, multipart=multipart) result = await client.request(url, HttpPost, body, multipart=multipart)
proc postContent*(client: HttpClient | AsyncHttpClient, url: Uri | string, body = "", proc postContent*(client: HttpClient | AsyncHttpClient, url: Uri | string, body = "",
@ -1190,7 +1190,7 @@ proc put*(client: HttpClient | AsyncHttpClient, url: Uri | string, body = "",
multipart: MultipartData = nil): Future[Response | AsyncResponse] multipart: MultipartData = nil): Future[Response | AsyncResponse]
{.multisync.} = {.multisync.} =
## Connects to the hostname specified by the URL and performs a PUT request. ## Connects to the hostname specified by the URL and performs a PUT request.
## This procedure uses httpClient values such as ``client.maxRedirects``. ## This procedure uses httpClient values such as `client.maxRedirects`.
result = await client.request(url, HttpPut, body, multipart=multipart) result = await client.request(url, HttpPut, body, multipart=multipart)
proc putContent*(client: HttpClient | AsyncHttpClient, url: Uri | string, body = "", proc putContent*(client: HttpClient | AsyncHttpClient, url: Uri | string, body = "",
@ -1203,7 +1203,7 @@ proc patch*(client: HttpClient | AsyncHttpClient, url: Uri | string, body = "",
multipart: MultipartData = nil): Future[Response | AsyncResponse] multipart: MultipartData = nil): Future[Response | AsyncResponse]
{.multisync.} = {.multisync.} =
## Connects to the hostname specified by the URL and performs a PATCH request. ## Connects to the hostname specified by the URL and performs a PATCH request.
## This procedure uses httpClient values such as ``client.maxRedirects``. ## This procedure uses httpClient values such as `client.maxRedirects`.
result = await client.request(url, HttpPatch, body, multipart=multipart) result = await client.request(url, HttpPatch, body, multipart=multipart)
proc patchContent*(client: HttpClient | AsyncHttpClient, url: Uri | string, body = "", proc patchContent*(client: HttpClient | AsyncHttpClient, url: Uri | string, body = "",
@ -1214,7 +1214,7 @@ proc patchContent*(client: HttpClient | AsyncHttpClient, url: Uri | string, body
return await responseContent(resp) return await responseContent(resp)
proc downloadFile*(client: HttpClient, url: Uri | string, filename: string) = proc downloadFile*(client: HttpClient, url: Uri | string, filename: string) =
## Downloads ``url`` and saves it to ``filename``. ## Downloads `url` and saves it to `filename`.
client.getBody = false client.getBody = false
defer: defer:
client.getBody = true client.getBody = true
@ -1231,7 +1231,7 @@ proc downloadFile*(client: HttpClient, url: Uri | string, filename: string) =
proc downloadFileEx(client: AsyncHttpClient, proc downloadFileEx(client: AsyncHttpClient,
url: Uri | string, filename: string): Future[void] {.async.} = url: Uri | string, filename: string): Future[void] {.async.} =
## Downloads ``url`` and saves it to ``filename``. ## Downloads `url` and saves it to `filename`.
client.getBody = false client.getBody = false
let resp = await client.get(url) let resp = await client.get(url)

View file

@ -8,7 +8,7 @@
# #
## Profiling support for Nim. This is an embedded profiler that requires ## Profiling support for Nim. This is an embedded profiler that requires
## ``--profiler:on``. You only need to import this module to get a profiling ## `--profiler:on`. You only need to import this module to get a profiling
## report at program exit. ## report at program exit.
when not defined(profiler) and not defined(memProfiler): when not defined(profiler) and not defined(memProfiler):

View file

@ -7,7 +7,7 @@
# distribution, for details about the copyright. # distribution, for details about the copyright.
# #
## This module is deprecated, ``import os`` instead. ## This module is deprecated, `import os` instead.
{.deprecated: "import os.nim instead".} {.deprecated: "import os.nim instead".}
import os import os
export PathComponent, walkDir, walkDirRec export PathComponent, walkDir, walkDirRec

View file

@ -32,7 +32,7 @@
## var e = next(p) ## var e = next(p)
## case e.kind ## case e.kind
## of cfgEof: break ## of cfgEof: break
## of cfgSectionStart: ## a ``[section]`` has been parsed ## of cfgSectionStart: ## a `[section]` has been parsed
## echo("new section: " & e.section) ## echo("new section: " & e.section)
## of cfgKeyValuePair: ## of cfgKeyValuePair:
## echo("key-value-pair: " & e.key & ": " & e.value) ## echo("key-value-pair: " & e.key & ": " & e.value)

View file

@ -7,7 +7,7 @@
# distribution, for details about the copyright. # distribution, for details about the copyright.
# #
## The ``parsesql`` module implements a high performance SQL file ## The `parsesql` module implements a high performance SQL file
## parser. It parses PostgreSQL syntax and the SQL ANSI standard. ## parser. It parses PostgreSQL syntax and the SQL ANSI standard.
## ##
## Unstable API. ## Unstable API.