Fix word wrapping

This commit is contained in:
Jjp137 2019-10-17 20:13:04 -07:00
commit 3ad48069d3
18 changed files with 146 additions and 125 deletions

View file

@ -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 <docgen.html#related-options-index-switch>`_.
## <#writeIndexFile,RstGenerator,string>`_. The purpose of the index is
## documented in the `docgen tools guide
## <docgen.html#related-options-index-switch>`_.
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

View file

@ -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 <math.html#nextPowerOfTwo,int>`_ or `rightSize proc
## <#rightSize,Natural>`_ from this module.
## `math.nextPowerOfTwo proc <math.html#nextPowerOfTwo,int>`_ 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 <math.html#nextPowerOfTwo,int>`_ or `rightSize proc
## <#rightSize,Natural>`_ from this module.
## `math.nextPowerOfTwo proc <math.html#nextPowerOfTwo,int>`_ 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.

View file

@ -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

View file

@ -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) <io.html#readLine,File,TaintedString>`_.
## `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) <io.html#lines.i,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:
##

View file

@ -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 <manual.html#lexical-analysis-character-literals>`_ 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 <manual.html#lexical-analysis-character-literals>`_
## 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>`_

View file

@ -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 <nimc.html#compiler-usage-compile-time-symbols>`_ to enable build time
## conditionals:
## `-d:x switch <nimc.html#compiler-usage-compile-time-symbols>`_ 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 <assertions.html#assert.t,untyped,string>`_.
## Usually the result of using the `assert() template
## <assertions.html#assert.t,untyped,string>`_.
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
## <manual_experimental.html#taint-mode>`_ for
## details. It is an alias for
## <manual_experimental.html#taint-mode>`_
## 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
## <manual_experimental.html#taint-mode>`_ for
## details. It is an alias for
## <manual_experimental.html#taint-mode>`_
## 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
## <manual.html#pragmas-nosideeffect-pragma>`_ you can use `debugEcho <#debugEcho,varargs[typed,]>`_
## instead.
## <manual.html#pragmas-nosideeffect-pragma>`_ 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 <manual.html#pragmas-nosideeffect-pragma>`_.
## 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
## <manual.html#pragmas-nosideeffect-pragma>`_.
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 <manual.html#implementation-specific-pragmas-passc-pragma>`_ or `passl <manual.html#implementation-specific-pragmas-passl-pragma>`_.
## `passc <manual.html#implementation-specific-pragmas-passc-pragma>`_ or
## `passl <manual.html#implementation-specific-pragmas-passl-pragma>`_.
##
## If ``cache`` is not empty, the results of ``staticExec`` are cached within
## the ``nimcache`` directory. Use ``--forceBuild`` to get rid of this caching

View file

@ -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()
## <os.html#setCurrentDir,string>`_ . Use the `withDir()
## <#withDir.t,string,untyped>`_ template if you want to perform a temporary change only.
## a shortcut for `os.setCurrentDir() <os.html#setCurrentDir,string>`_ . 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":