mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-20 14:25:23 +00:00
[docs minor]space for code-block (#16266)
* [docs minor]space for code-block * correct more errors * to runnableExamples * add newline
This commit is contained in:
@@ -222,9 +222,9 @@ proc getNamedParamFromList*(list: PNode, ident: PIdent): PSym =
|
||||
## gensym'ed and then they have '\`<number>' suffix that we need to
|
||||
## ignore, see compiler / evaltempl.nim, snippet:
|
||||
##
|
||||
##..code-block:: nim
|
||||
## .. code-block:: nim
|
||||
##
|
||||
## result.add newIdentNode(getIdent(c.ic, x.name.s & "\`gensym" & $x.id),
|
||||
## result.add newIdentNode(getIdent(c.ic, x.name.s & "\`gensym" & $x.id),
|
||||
## if c.instLines: actual.info else: templ.info)
|
||||
for i in 1..<list.len:
|
||||
let it = list[i].sym
|
||||
|
||||
@@ -568,9 +568,11 @@ proc inconsistentVarTypes(f, a: PType): bool {.inline.} =
|
||||
|
||||
proc procParamTypeRel(c: var TCandidate, f, a: PType): TTypeRelation =
|
||||
## For example we have:
|
||||
##..code-block:: nim
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## proc myMap[T,S](sIn: seq[T], f: proc(x: T): S): seq[S] = ...
|
||||
## proc innerProc[Q,W](q: Q): W = ...
|
||||
##
|
||||
## And we want to match: myMap(@[1,2,3], innerProc)
|
||||
## This proc (procParamTypeRel) will do the following steps in
|
||||
## three different calls:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# types that use the 'node' field; the reason is that slots are
|
||||
# re-used in a register based VM. Example:
|
||||
#
|
||||
#..code-block:: nim
|
||||
#.. code-block:: nim
|
||||
# let s = a & b # no matter what, create fresh node
|
||||
# s = a & b # no matter what, keep the node
|
||||
#
|
||||
|
||||
@@ -52,15 +52,9 @@ proc loadUnidecodeTable*(datafile = "unidecode.dat") =
|
||||
proc unidecode*(s: string): string =
|
||||
## Finds the sequence of ASCII characters that is the closest approximation
|
||||
## to the UTF-8 string `s`.
|
||||
##
|
||||
## Example:
|
||||
##
|
||||
## ..code-block:: nim
|
||||
##
|
||||
## unidecode("北京")
|
||||
##
|
||||
## Results in: "Bei Jing"
|
||||
##
|
||||
runnableExamples:
|
||||
assert unidecode("北京") == "Bei Jing "
|
||||
|
||||
result = ""
|
||||
for r in runes(s):
|
||||
var c = int(r)
|
||||
|
||||
Reference in New Issue
Block a user