From 93461aee34244a6c004a5572f31a50ff4fad280d Mon Sep 17 00:00:00 2001 From: Jjp137 Date: Thu, 17 Oct 2019 14:45:23 -0700 Subject: Fix many broken links Note that contrary to what docgen.rst currently says, the ids have to match exactly or else most web browsers will not jump to the intended symbol. --- lib/pure/collections/tables.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/pure/collections/tables.nim') diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 3c91ba9c7..a5ee74f8b 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -134,7 +134,7 @@ ## # 'a': 5, 'b': 2, 'c': 1, 'd': 1, 'r': 2} ## ## The same could have been achieved by manually iterating over a container -## and increasing each key's value with `inc proc<#inc,CountTable[A],A,int>`_: +## and increasing each key's value with `inc proc<#inc,CountTable[A],A,Positive>`_: ## ## .. code-block:: ## import tables @@ -2236,7 +2236,7 @@ proc `[]=`*[A](t: var CountTable[A], key: A, val: int) = ## ## See also: ## * `[] proc<#[],CountTable[A],A>`_ for retrieving a value of a key - ## * `inc proc<#inc,CountTable[A],A,int>`_ for incrementing a + ## * `inc proc<#inc,CountTable[A],A,Positive>`_ for incrementing a ## value of a key assert(not t.isSorted, "CountTable must not be used after sorting") assert val >= 0 -- cgit 1.4.1-2-gfad0 From 3ad48069d37d42cc56e48399bb429dc50416e556 Mon Sep 17 00:00:00 2001 From: Jjp137 Date: Thu, 17 Oct 2019 20:13:04 -0700 Subject: Fix word wrapping --- doc/backends.rst | 45 +++++++++++++++-------------- doc/contributing.rst | 3 +- doc/docgen.rst | 20 +++++++------ doc/gc.rst | 3 +- doc/idetools.rst | 9 +++--- doc/koch.rst | 3 +- doc/manual.rst | 17 +++++------ doc/manual_experimental.rst | 7 +++-- doc/nimc.rst | 10 ++++--- doc/nimsuggest.rst | 6 ++-- doc/tut1.rst | 62 +++++++++++++++++++++------------------- lib/packages/docutils/rstgen.nim | 18 +++++++----- lib/pure/collections/sets.nim | 8 +++--- lib/pure/collections/tables.nim | 3 +- lib/pure/memfiles.nim | 8 +++--- lib/pure/strutils.nim | 11 +++---- lib/system.nim | 29 ++++++++++--------- lib/system/nimscript.nim | 9 +++--- 18 files changed, 146 insertions(+), 125 deletions(-) (limited to 'lib/pure/collections/tables.nim') diff --git a/doc/backends.rst b/doc/backends.rst index b003a274c..2fee1ab9b 100644 --- a/doc/backends.rst +++ b/doc/backends.rst @@ -107,12 +107,13 @@ Nim code calling the backend Nim code can interface with the backend through the `Foreign function interface `_ mainly through the -`importc pragma `_. The ``importc`` pragma is the -*generic* way of making backend symbols available in Nim and is available -in all the target backends (JavaScript too). The C++ or Objective-C backends -have their respective `ImportCpp `_ and -`ImportObjC `_ pragmas to call methods from -classes. +`importc pragma `_. +The ``importc`` pragma is the *generic* way of making backend symbols available +in Nim and is available in all the target backends (JavaScript too). The C++ +or Objective-C backends have their respective `ImportCpp +`_ and +`ImportObjC `_ +pragmas to call methods from classes. Whenever you use any of these pragmas you need to integrate native code into your final binary. In the case of JavaScript this is no problem at all, the @@ -124,16 +125,16 @@ statically or dynamically. The preferred way of integrating native code is to use dynamic linking because it allows you to compile Nim programs without the need for having the related development libraries installed. This is done through the `dynlib pragma for import -`_, though more specific control can be -gained using the `dynlib module `_. +`_, though +more specific control can be gained using the `dynlib module `_. The `dynlibOverride `_ command line switch allows to avoid dynamic linking if you need to statically link something instead. Nim wrappers designed to statically link source files can use the `compile -pragma `_ if there are few sources or providing -them along the Nim code is easier than using a system library. Libraries -installed on the host system can be linked in with the `PassL pragma -`_. +pragma `_ if +there are few sources or providing them along the Nim code is easier than using +a system library. Libraries installed on the host system can be linked in with +the `PassL pragma `_. To wrap native code, take a look at the `c2nim tool `_ which helps with the process of scanning and transforming header files into a Nim @@ -215,12 +216,12 @@ Backend code calling Nim ------------------------ Backend code can interface with Nim code exposed through the `exportc -pragma `_. The ``exportc`` pragma is the *generic* -way of making Nim symbols available to the backends. By default the Nim -compiler will mangle all the Nim symbols to avoid any name collision, so -the most significant thing the ``exportc`` pragma does is maintain the Nim -symbol name, or if specified, use an alternative symbol for the backend in -case the symbol rules don't match. +pragma `_. The +``exportc`` pragma is the *generic* way of making Nim symbols available to +the backends. By default the Nim compiler will mangle all the Nim symbols to +avoid any name collision, so the most significant thing the ``exportc`` pragma +does is maintain the Nim symbol name, or if specified, use an alternative +symbol for the backend in case the symbol rules don't match. The JavaScript target doesn't have any further interfacing considerations since it also has garbage collection, but the C targets require you to @@ -329,8 +330,8 @@ Nimcache naming logic The `nimcache`:idx: directory is generated during compilation and will hold either temporary or final files depending on your backend target. The default name for the directory depends on the used backend and on your OS but you can -use the ``--nimcache`` `compiler switch `_ to -change it. +use the ``--nimcache`` `compiler switch +`_ to change it. Memory management @@ -384,8 +385,8 @@ the backend will need careful consideration of who controls who. If you want to hand a Nim reference to C code, you will need to use `GC_ref `_ to mark the reference as used, so it does not get freed. And for the C backend you will need to expose the `GC_unref -`_ proc to clean up this memory when it is not required -any more. +`_ proc to clean up this memory when it is not +required any more. Again, if you are wrapping a library which *mallocs* and *frees* data structures, you need to expose the appropriate *free* function to Nim so diff --git a/doc/contributing.rst b/doc/contributing.rst index b558b4277..ff623d8cf 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -213,8 +213,7 @@ as well as ``testament`` and guarantee they stay in sync. assert "baz".addBar == "bazBar" result = a & "Bar" -See `parentDir `_ -example. +See `parentDir `_ example. The RestructuredText Nim uses has a special syntax for including code snippets embedded in documentation; these are not run by ``nim doc`` and therefore are diff --git a/doc/docgen.rst b/doc/docgen.rst index 9607089d8..4c05702ea 100644 --- a/doc/docgen.rst +++ b/doc/docgen.rst @@ -307,7 +307,8 @@ symbols in the `system module `_. `#len,seq[T] `_ * ``iterator pairs[T](a: seq[T]): tuple[key: int, val: T] {.inline.}`` **=>** `#pairs.i,seq[T] `_ -* ``template newException[](exceptn: typedesc; message: string; parentException: ref Exception = nil): untyped`` **=>** +* ``template newException[](exceptn: typedesc; message: string; + parentException: ref Exception = nil): untyped`` **=>** `#newException.t,typedesc,string,ref.Exception `_ @@ -316,14 +317,15 @@ Index (idx) file format ======================= Files with the ``.idx`` extension are generated when you use the `Index -switch <#related-options-index-switch>`_ along with commands to generate documentation from source or text -files. You can programatically generate indices with the `setIndexTerm() -`_ and `writeIndexFile() -`_ procs. The purpose of ``idx`` files is to hold -the interesting symbols and their HTML references so they can be later -concatenated into a big index file with `mergeIndexes() -`_. This section documents the file format in -detail. +switch <#related-options-index-switch>`_ along with commands to generate +documentation from source or text files. You can programatically generate +indices with the `setIndexTerm() +`_ +and `writeIndexFile() `_ procs. +The purpose of ``idx`` files is to hold the interesting symbols and their HTML +references so they can be later concatenated into a big index file with +`mergeIndexes() `_. This section documents +the file format in detail. Index files are line oriented and tab separated (newline and tab characters have to be escaped). Each line represents a record with at least two fields, diff --git a/doc/gc.rst b/doc/gc.rst index 77f5fce09..a41a30588 100644 --- a/doc/gc.rst +++ b/doc/gc.rst @@ -164,7 +164,8 @@ you can pass ``--gc:`` on the compile command with the choosed garbage collector The same Nim code can be compiled to use any of the garbage collectors; the Nim syntax generally will not change from one garbage collector to another. -No garbage collector is used for `JavaScript and NodeJS `_ compilation targets. +No garbage collector is used for `JavaScript and NodeJS +`_ compilation targets. `NimScript `_ target uses Nim VM garbage collector. If you are new to Nim and just starting, the default garbage collector is balanced to fit most common use cases. diff --git a/doc/idetools.rst b/doc/idetools.rst index 6b97ab932..ebb140c5c 100644 --- a/doc/idetools.rst +++ b/doc/idetools.rst @@ -124,9 +124,9 @@ separators!). The typical usage scenario for this option is to call it after the user has typed the dot character for `the object oriented call -syntax `_. Idetools will try to return -the suggestions sorted first by scope (from innermost to outermost) -and then by item name. +syntax `_. +Idetools will try to return the suggestions sorted first by scope +(from innermost to outermost) and then by item name. Invocation context @@ -359,7 +359,8 @@ defined, since at that point in the file the parser hasn't processed the full line yet. The signature will be returned complete in posterior instances of the method. -Methods imply `dynamic dispatch `_ and +Methods imply `dynamic dispatch +`_ and idetools performs a static analysis on the code. For this reason idetools may not return the definition of the correct method you are querying because it may be impossible to know until the code diff --git a/doc/koch.rst b/doc/koch.rst index b468ca05b..0f8434064 100644 --- a/doc/koch.rst +++ b/doc/koch.rst @@ -47,7 +47,8 @@ csource command --------------- The `csource`:idx: command builds the C sources for installation. It accepts -the same options as you would pass to the `boot command <#commands-boot-command>`_. +the same options as you would pass to the `boot command +<#commands-boot-command>`_. temp command ------------ diff --git a/doc/manual.rst b/doc/manual.rst index fb33b3f7f..f8f45b9dc 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -1482,7 +1482,8 @@ order. The *names* of the fields also have to be identical. The assignment operator for tuples copies each component. The default assignment operator for objects copies each component. Overloading -of the assignment operator is described `here `_. +of the assignment operator is described `here +`_. .. code-block:: nim @@ -3484,8 +3485,8 @@ more argument in this case: assert x == y The command invocation syntax also can't have complex expressions as arguments. -For example: (`anonymous procs <#procedures-anonymous-procs>`_), ``if``, ``case`` or ``try``. -Function calls with no arguments still needs () to +For example: (`anonymous procs <#procedures-anonymous-procs>`_), ``if``, +``case`` or ``try``. Function calls with no arguments still needs () to distinguish between a call and the function itself as a first class value. @@ -3505,8 +3506,8 @@ Creating closures in loops ~~~~~~~~~~~~~~~~~~~~~~~~~~ Since closures capture local variables by reference it is often not wanted -behavior inside loop bodies. See `closureScope `_ -for details on how to change this behavior. +behavior inside loop bodies. See `closureScope +`_ for details on how to change this behavior. Anonymous Procs --------------- @@ -5895,9 +5896,9 @@ or ``ref T`` or ``ptr T`` this means no locations are modified. It is a static error to mark a proc/iterator to have no side effect if the compiler cannot verify this. -As a special semantic rule, the built-in `debugEcho `_ -pretends to be free of side effects, so that it can be used for debugging -routines marked as ``noSideEffect``. +As a special semantic rule, the built-in `debugEcho +`_ pretends to be free of side effects, +so that it can be used for debugging routines marked as ``noSideEffect``. ``func`` is syntactic sugar for a proc with no side effects: diff --git a/doc/manual_experimental.rst b/doc/manual_experimental.rst index 55bef76c5..e0f4831d6 100644 --- a/doc/manual_experimental.rst +++ b/doc/manual_experimental.rst @@ -203,9 +203,10 @@ useful only when interfacing with imported types having such semantics. Automatic dereferencing ======================= -If the `experimental mode `_ is active and no other match -is found, the first argument ``a`` is dereferenced automatically if it's a -pointer type and overloading resolution is tried with ``a[]`` instead. +If the `experimental mode `_ is active +and no other match is found, the first argument ``a`` is dereferenced +automatically if it's a pointer type and overloading resolution is tried +with ``a[]`` instead. Automatic self insertions diff --git a/doc/nimc.rst b/doc/nimc.rst index 78eeaffec..c59653b34 100644 --- a/doc/nimc.rst +++ b/doc/nimc.rst @@ -114,7 +114,8 @@ Level Description ===== ============================================ 0 Minimal output level for the compiler. 1 Displays compilation of all the compiled files, including those imported - by other modules or through the `compile pragma`_. + by other modules or through the `compile pragma + `_. This is the default level. 2 Displays compilation statistics, enumerates the dynamic libraries that will be loaded by the final binary and dumps to @@ -130,9 +131,10 @@ Compile time symbols Through the ``-d:x`` or ``--define:x`` switch you can define compile time symbols for conditional compilation. The defined switches can be checked in -source code with the `when statement `_ and -`defined proc `_. The typical use of this switch is to -enable builds in release mode (``-d:release``) where optimizations are +source code with the `when statement +`_ and +`defined proc `_. The typical use of this switch is +to enable builds in release mode (``-d:release``) where optimizations are enabled for better performance. Another common use is the ``-d:ssl`` switch to activate SSL sockets. diff --git a/doc/nimsuggest.rst b/doc/nimsuggest.rst index 51e6e7f06..a5d0d65b9 100644 --- a/doc/nimsuggest.rst +++ b/doc/nimsuggest.rst @@ -105,9 +105,9 @@ completion symbols at some point in the file. The typical usage scenario for this option is to call it after the user has typed the dot character for `the object oriented call -syntax `_. Nimsuggest will try to return -the suggestions sorted first by scope (from innermost to outermost) -and then by item name. +syntax `_. +Nimsuggest will try to return the suggestions sorted first by scope +(from innermost to outermost) and then by item name. Invocation context diff --git a/doc/tut1.rst b/doc/tut1.rst index 66d156511..bfe87a40e 100644 --- a/doc/tut1.rst +++ b/doc/tut1.rst @@ -326,10 +326,11 @@ the compiler that for every other value nothing should be done: of 3, 8: echo "The number is 3 or 8" else: discard -The empty `discard statement <#procedures-discard-statement>`_ is a *do nothing* statement. The compiler knows -that a case statement with an else part cannot fail and thus the error -disappears. Note that it is impossible to cover all possible string values: -that is why string cases always need an ``else`` branch. +The empty `discard statement <#procedures-discard-statement>`_ is a *do +nothing* statement. The compiler knows that a case statement with an else part +cannot fail and thus the error disappears. Note that it is impossible to cover +all possible string values: that is why string cases always need an ``else`` +branch. In general the case statement is used for subrange types or enumerations where it is of great help that the compiler checks that you covered any possible @@ -359,8 +360,8 @@ For statement ------------- The ``for`` statement is a construct to loop over any element an *iterator* -provides. The example uses the built-in `countup `_ -iterator: +provides. The example uses the built-in `countup +`_ iterator: .. code-block:: nim :test: "nim c $1" @@ -371,8 +372,8 @@ iterator: The variable ``i`` is implicitly declared by the ``for`` loop and has the type ``int``, because that is what `countup -`_ returns. ``i`` runs through the values 1, 2, .., 10. -Each value is ``echo``-ed. This code does the same: +`_ returns. ``i`` runs through the values +1, 2, .., 10. Each value is ``echo``-ed. This code does the same: .. code-block:: nim echo "Counting to 10: " @@ -570,10 +571,10 @@ an expression is allowed: Procedures ========== -To define new commands like `echo `_ and `readLine -`_ in the examples, the concept of a `procedure` -is needed. (Some languages call them *methods* or *functions*.) In Nim new -procedures are defined with the ``proc`` keyword: +To define new commands like `echo `_ +and `readLine `_ in the examples, the concept of a +`procedure` is needed. (Some languages call them *methods* or *functions*.) +In Nim new procedures are defined with the ``proc`` keyword: .. code-block:: nim :test: "nim c $1" @@ -845,8 +846,8 @@ Let's return to the simple counting example: for i in countup(1, 10): echo i -Can a `countup `_ proc be written that supports this -loop? Lets try: +Can a `countup `_ proc be written that +supports this loop? Lets try: .. code-block:: nim proc countup(a, b: int): int = @@ -1010,8 +1011,8 @@ floats and follow the IEEE-754 standard. Automatic type conversion in expressions with different kinds of floating point types is performed: the smaller type is converted to the larger. Integer types are **not** converted to floating point types automatically, nor vice -versa. Use the `toInt `_ and `toFloat `_ -procs for these conversions. +versa. Use the `toInt `_ and +`toFloat `_ procs for these conversions. Type Conversion @@ -1128,8 +1129,8 @@ Operation Comment ----------------- -------------------------------------------------------- The `inc `_, `dec `_, `succ -`_ and `pred `_ operations can fail by -raising an `EOutOfRange` or `EOverflow` exception. (If the code has been +`_ and `pred `_ operations can +fail by raising an `EOutOfRange` or `EOverflow` exception. (If the code has been compiled with the proper runtime checks turned on.) @@ -1150,8 +1151,8 @@ compile-time or runtime error. Assignments from the base type to one of its subrange types (and vice versa) are allowed. The ``system`` module defines the important `Natural `_ -type as ``range[0..high(int)]`` (`high `_ returns the -maximal value). Other programming languages may suggest the use of unsigned +type as ``range[0..high(int)]`` (`high `_ returns +the maximal value). Other programming languages may suggest the use of unsigned integers for natural numbers. This is often **unwise**: you don't want unsigned arithmetic (which wraps around) just because the numbers cannot be negative. Nim's ``Natural`` type helps to avoid this common programming error. @@ -1189,8 +1190,9 @@ Arrays are value types, like any other Nim type. The assignment operator copies the whole array contents. The built-in `len `_ proc returns the array's -length. `low(a) `_ returns the lowest valid index for the -array `a` and `high(a) `_ the highest valid index. +length. `low(a) `_ returns the lowest valid index +for the array `a` and `high(a) `_ the highest +valid index. .. code-block:: nim :test: "nim c $1" @@ -1266,8 +1268,8 @@ allocated on the heap and garbage collected. Sequences are always indexed with an ``int`` starting at position 0. The `len `_, `low `_ and `high -`_ operations are available for sequences too. The notation -``x[i]`` can be used to access the i-th element of ``x``. +`_ operations are available for sequences too. +The notation ``x[i]`` can be used to access the i-th element of ``x``. Sequences can be constructed by the array constructor ``[]`` in conjunction with the array to sequence operator ``@``. Another way to allocate space for @@ -1318,10 +1320,10 @@ Open arrays Often fixed size arrays turn out to be too inflexible; procedures should be able to deal with arrays of different sizes. The `openarray`:idx: type allows this. Openarrays are always indexed with an ``int`` starting at position 0. -The `len `_, `low `_ and `high -`_ operations are available for open arrays too. Any array -with a compatible base type can be passed to an openarray parameter, the index -type does not matter. +The `len `_, `low `_ +and `high `_ operations are available for open +arrays too. Any array with a compatible base type can be passed to an +openarray parameter, the index type does not matter. .. code-block:: nim :test: "nim c $1" @@ -1561,8 +1563,8 @@ having the same field types. Tuples can be *unpacked* during variable assignment (and only then!). This can be handy to assign directly the fields of the tuples to individually named -variables. An example of this is the `splitFile `_ proc -from the `os module `_ which returns the directory, name and +variables. An example of this is the `splitFile `_ +proc from the `os module `_ which returns the directory, name and extension of a path at the same time. For tuple unpacking to work you must use parentheses around the values you want to assign the unpacking to, otherwise you will be assigning the same value to all the individual diff --git a/lib/packages/docutils/rstgen.nim b/lib/packages/docutils/rstgen.nim index 5a77ab618..f9fd9e32b 100644 --- a/lib/packages/docutils/rstgen.nim +++ b/lib/packages/docutils/rstgen.nim @@ -154,7 +154,8 @@ proc writeIndexFile*(g: var RstGenerator, outfile: string) = ## Writes the current index buffer to the specified output file. ## ## You previously need to add entries to the index with the `setIndexTerm() - ## <#setIndexTerm,RstGenerator,string,string,string,string,string>`_ proc. If the index is empty the file won't be created. + ## <#setIndexTerm,RstGenerator,string,string,string,string,string>`_ proc. + ## If the index is empty the file won't be created. if g.theIndex.len > 0: writeFile(outfile, g.theIndex) proc addXmlChar(dest: var string, c: char) = @@ -318,8 +319,9 @@ proc setIndexTerm*(d: var RstGenerator, htmlFile, id, term: string, ## columns with their contents will be added. ## ## The index won't be written to disk unless you call `writeIndexFile() - ## <#writeIndexFile,RstGenerator,string>`_. The purpose of the index is documented in the `docgen - ## tools guide `_. + ## <#writeIndexFile,RstGenerator,string>`_. The purpose of the index is + ## documented in the `docgen tools guide + ## `_. var entry = term isTitle = false @@ -472,8 +474,8 @@ proc generateSymbolIndex(symbols: seq[IndexEntry]): string = proc isDocumentationTitle(hyperlink: string): bool = ## Returns true if the hyperlink is actually a documentation title. ## - ## Documentation titles lack the hash. See `mergeIndexes() <#mergeIndexes,string>`_ - ## for a more detailed explanation. + ## Documentation titles lack the hash. See `mergeIndexes() + ## <#mergeIndexes,string>`_ for a more detailed explanation. result = hyperlink.find('#') < 0 proc stripTocLevel(s: string): tuple[level: int, text: string] = @@ -650,8 +652,10 @@ proc mergeIndexes*(dir: string): string = ## This proc will first scan `dir` for index files with the ``.idx`` ## extension previously created by commands like ``nim doc|rst2html`` ## which use the ``--index:on`` switch. These index files are the result of - ## calls to `setIndexTerm() <#setIndexTerm,RstGenerator,string,string,string,string,string>`_ and `writeIndexFile() - ## <#writeIndexFile,RstGenerator,string>`_, so they are simple tab separated files. + ## calls to `setIndexTerm() + ## <#setIndexTerm,RstGenerator,string,string,string,string,string>`_ + ## and `writeIndexFile() <#writeIndexFile,RstGenerator,string>`_, so they are + ## simple tab separated files. ## ## As convention this proc will split index files into two categories: ## documentation and API. API indices will be all joined together into a diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim index 431534d1e..930b7f0ed 100644 --- a/lib/pure/collections/sets.nim +++ b/lib/pure/collections/sets.nim @@ -99,8 +99,8 @@ proc init*[A](s: var HashSet[A], initialSize = defaultInitialSize) = ## ## The `initialSize` parameter needs to be a power of two (default: 64). ## If you need to accept runtime values for this, you can use - ## `math.nextPowerOfTwo proc `_ or `rightSize proc - ## <#rightSize,Natural>`_ from this module. + ## `math.nextPowerOfTwo proc `_ or + ## `rightSize proc <#rightSize,Natural>`_ from this module. ## ## Starting from Nim v0.20, sets are initialized by default and it is ## not necessary to call this function explicitly. @@ -645,8 +645,8 @@ proc init*[A](s: var OrderedSet[A], initialSize = defaultInitialSize) = ## ## The `initialSize` parameter needs to be a power of two (default: 64). ## If you need to accept runtime values for this, you can use - ## `math.nextPowerOfTwo proc `_ or `rightSize proc - ## <#rightSize,Natural>`_ from this module. + ## `math.nextPowerOfTwo proc `_ or + ## `rightSize proc <#rightSize,Natural>`_ from this module. ## ## Starting from Nim v0.20, sets are initialized by default and it is ## not necessary to call this function explicitly. diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index a5ee74f8b..7d1633e7d 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -134,7 +134,8 @@ ## # 'a': 5, 'b': 2, 'c': 1, 'd': 1, 'r': 2} ## ## The same could have been achieved by manually iterating over a container -## and increasing each key's value with `inc proc<#inc,CountTable[A],A,Positive>`_: +## and increasing each key's value with `inc proc +## <#inc,CountTable[A],A,Positive>`_: ## ## .. code-block:: ## import tables diff --git a/lib/pure/memfiles.nim b/lib/pure/memfiles.nim index df4a1ee4e..152b03ec6 100644 --- a/lib/pure/memfiles.nim +++ b/lib/pure/memfiles.nim @@ -432,8 +432,8 @@ iterator lines*(mfile: MemFile, buf: var TaintedString, delim = '\l', eat = '\r'): TaintedString {.inline.} = ## Replace contents of passed buffer with each new line, like ## `readLine(File) `_. - ## `delim`, `eat`, and delimiting logic is exactly as for - ## `memSlices <#memSlices.i,MemFile,char,char>`_, but Nim strings are returned. + ## `delim`, `eat`, and delimiting logic is exactly as for `memSlices + ## <#memSlices.i,MemFile,char,char>`_, but Nim strings are returned. ## ## Example: ## @@ -451,8 +451,8 @@ iterator lines*(mfile: MemFile, buf: var TaintedString, delim = '\l', iterator lines*(mfile: MemFile, delim = '\l', eat = '\r'): TaintedString {.inline.} = ## Return each line in a file as a Nim string, like ## `lines(File) `_. - ## `delim`, `eat`, and delimiting logic is exactly as for - ## `memSlices <#memSlices.i,MemFile,char,char>`_, but Nim strings are returned. + ## `delim`, `eat`, and delimiting logic is exactly as for `memSlices + ## <#memSlices.i,MemFile,char,char>`_, but Nim strings are returned. ## ## Example: ## diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index a2bcfd339..e5445fe7e 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -631,10 +631,10 @@ iterator rsplit*(s: string, sep: string, maxsplit: int = -1, iterator splitLines*(s: string, keepEol = false): string = ## Splits the string `s` into its containing lines. ## - ## Every `character literal `_ newline - ## combination (CR, LF, CR-LF) is supported. The result strings contain no - ## trailing end of line characters unless parameter ``keepEol`` is set to - ## ``true``. + ## Every `character literal `_ + ## newline combination (CR, LF, CR-LF) is supported. The result strings + ## contain no trailing end of line characters unless parameter ``keepEol`` + ## is set to ``true``. ## ## Example: ## @@ -2101,7 +2101,8 @@ proc replace*(s: string, sub, by: char): string {.noSideEffect, rtl, extern: "nsuReplaceChar".} = ## Replaces `sub` in `s` by the character `by`. ## - ## Optimized version of `replace <#replace,string,string,string>`_ for characters. + ## Optimized version of `replace <#replace,string,string,string>`_ for + ## characters. ## ## See also: ## * `find proc<#find,string,char,Natural,int>`_ diff --git a/lib/system.nim b/lib/system.nim index 9ecfa1192..198c88e9b 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -112,8 +112,8 @@ proc defined*(x: untyped): bool {.magic: "Defined", noSideEffect, compileTime.} ## defined. ## ## `x` is an external symbol introduced through the compiler's - ## `-d:x switch `_ to enable build time - ## conditionals: + ## `-d:x switch `_ to enable + ## build time conditionals: ## ## .. code-block:: Nim ## when not defined(release): @@ -784,7 +784,8 @@ type AssertionError* = object of Defect ## \ ## Raised when assertion is proved wrong. ## - ## Usually the result of using the `assert() template `_. + ## Usually the result of using the `assert() template + ## `_. ValueError* = object of CatchableError ## \ ## Raised for string and object conversion errors. KeyError* = object of ValueError ## \ @@ -2017,8 +2018,8 @@ when defined(boehmgc): when taintMode: type TaintedString* = distinct string ## A distinct string type that ## is `tainted`:idx:, see `taint mode - ## `_ for - ## details. It is an alias for + ## `_ + ## for details. It is an alias for ## ``string`` if the taint mode is not ## turned on. @@ -2026,8 +2027,8 @@ when taintMode: else: type TaintedString* = string ## A distinct string type that ## is `tainted`:idx:, see `taint mode - ## `_ for - ## details. It is an alias for + ## `_ + ## for details. It is an alias for ## ``string`` if the taint mode is not ## turned on. @@ -3460,14 +3461,15 @@ when defined(nimvarargstyped): ## Unlike other IO operations this is guaranteed to be thread-safe as ## ``echo`` is very often used for debugging convenience. If you want to use ## ``echo`` inside a `proc without side effects - ## `_ you can use `debugEcho <#debugEcho,varargs[typed,]>`_ - ## instead. + ## `_ you can use `debugEcho + ## <#debugEcho,varargs[typed,]>`_ instead. proc debugEcho*(x: varargs[typed, `$`]) {.magic: "Echo", noSideEffect, tags: [], raises: [].} - ## Same as `echo <#echo,varargs[typed,]>`_, but as a special semantic rule, ``debugEcho`` - ## pretends to be free of side effects, so that it can be used for debugging - ## routines marked as `noSideEffect `_. + ## Same as `echo <#echo,varargs[typed,]>`_, but as a special semantic rule, + ## ``debugEcho`` pretends to be free of side effects, so that it can be used + ## for debugging routines marked as `noSideEffect + ## `_. else: proc echo*(x: varargs[untyped, `$`]) {.magic: "Echo", tags: [WriteIOEffect], benign, sideEffect.} @@ -4092,7 +4094,8 @@ proc staticExec*(command: string, input = "", cache = ""): string {. ## `gorge <#gorge,string,string,string>`_ is an alias for ``staticExec``. ## ## Note that you can use this proc inside a pragma like - ## `passc `_ or `passl `_. + ## `passc `_ or + ## `passl `_. ## ## If ``cache`` is not empty, the results of ``staticExec`` are cached within ## the ``nimcache`` directory. Use ``--forceBuild`` to get rid of this caching diff --git a/lib/system/nimscript.nim b/lib/system/nimscript.nim index 7a1a45b1a..719e92c4a 100644 --- a/lib/system/nimscript.nim +++ b/lib/system/nimscript.nim @@ -311,9 +311,9 @@ proc cd*(dir: string) {.raises: [OSError].} = ## Changes the current directory. ## ## The change is permanent for the rest of the execution, since this is just - ## a shortcut for `os.setCurrentDir() - ## `_ . Use the `withDir() - ## <#withDir.t,string,untyped>`_ template if you want to perform a temporary change only. + ## a shortcut for `os.setCurrentDir() `_ . Use + ## the `withDir() <#withDir.t,string,untyped>`_ template if you want to + ## perform a temporary change only. setCurrentDir(dir) checkOsError() @@ -326,7 +326,8 @@ proc findExe*(bin: string): string = template withDir*(dir: string; body: untyped): untyped = ## Changes the current directory temporarily. ## - ## If you need a permanent change, use the `cd() <#cd,string>`_ proc. Usage example: + ## If you need a permanent change, use the `cd() <#cd,string>`_ proc. + ## Usage example: ## ## .. code-block:: nim ## withDir "foo": -- cgit 1.4.1-2-gfad0 previous revision' href='/ahoang/Nim/blame/compiler/nimlexbase.nim?h=devel&id=37fe21b64ac348e7412c524a8a6e05d4fe6f877c'>^
1
2
3
4
5
6
7
8
9
10
11
12
13
14