diff options
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/asyncdispatch.nim | 12 | ||||
-rw-r--r-- | lib/pure/asyncftpclient.nim | 6 | ||||
-rw-r--r-- | lib/pure/asynchttpserver.nim | 3 | ||||
-rw-r--r-- | lib/pure/asyncmacro.nim | 2 | ||||
-rw-r--r-- | lib/pure/asyncnet.nim | 8 | ||||
-rw-r--r-- | lib/pure/base64.nim | 1 | ||||
-rw-r--r-- | lib/pure/dynlib.nim | 4 | ||||
-rw-r--r-- | lib/pure/htmlgen.nim | 3 | ||||
-rw-r--r-- | lib/pure/parsecfg.nim | 84 | ||||
-rw-r--r-- | lib/pure/times.nim | 13 | ||||
-rw-r--r-- | lib/pure/unittest.nim | 4 |
11 files changed, 68 insertions, 72 deletions
diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index b68653277..2fb00d6a7 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -65,7 +65,7 @@ ## error), if there is no error however it returns the value of the future. ## ## Asynchronous procedures -## ----------------------- +## ======================= ## ## Asynchronous procedures remove the pain of working with callbacks. They do ## this by allowing you to write asynchronous code the same way as you would @@ -99,7 +99,7 @@ ## exceptions in async procs. ## ## Handling Exceptions -## ~~~~~~~~~~~~~~~~~~~ +## ------------------- ## ## The most reliable way to handle exceptions is to use ``yield`` on a future ## then check the future's ``failed`` property. For example: @@ -125,7 +125,7 @@ ## ## ## Discarding futures -## ------------------ +## ================== ## ## Futures should **never** be discarded. This is because they may contain ## errors. If you do not care for the result of a Future then you should @@ -134,14 +134,14 @@ ## ``waitFor`` for that purpose. ## ## Examples -## -------- +## ======== ## ## For examples take a look at the documentation for the modules implementing ## asynchronous IO. A good place to start is the ## `asyncnet module <asyncnet.html>`_. ## ## Limitations/Bugs -## ---------------- +## ================ ## ## * The effect system (``raises: []``) does not work with async procedures. @@ -1824,4 +1824,4 @@ proc setEvent*(ev: AsyncEvent) {.deprecated.} = ## Set event ``ev`` to signaled state. ## ## **Deprecated since v0.18.0:** Use ``trigger`` instead. - ev.trigger() \ No newline at end of file + ev.trigger() diff --git a/lib/pure/asyncftpclient.nim b/lib/pure/asyncftpclient.nim index d28e9fb57..3e741c304 100644 --- a/lib/pure/asyncftpclient.nim +++ b/lib/pure/asyncftpclient.nim @@ -16,7 +16,7 @@ ## * Navigation through the FTP server's directories. ## ## Connecting to an FTP server -## ------------------------ +## =========================== ## ## In order to begin any sort of transfer of files you must first ## connect to an FTP server. You can do so with the ``connect`` procedure. @@ -34,7 +34,7 @@ ## client will be connected after the ``await ftp.connect()`` call. ## ## Uploading a new file -## -------------------- +## ==================== ## ## After a connection is made you can use the ``store`` procedure to upload ## a new file to the FTP server. Make sure to check you are in the correct @@ -53,7 +53,7 @@ ## waitFor(main()) ## ## Checking the progress of a file transfer -## ---------------------------------------- +## ======================================== ## ## The progress of either a file upload or a file download can be checked ## by specifying a ``onProgressChanged`` procedure to the ``store`` or diff --git a/lib/pure/asynchttpserver.nim b/lib/pure/asynchttpserver.nim index 4aed42683..4045609a4 100644 --- a/lib/pure/asynchttpserver.nim +++ b/lib/pure/asynchttpserver.nim @@ -14,9 +14,8 @@ ## application you should use a reverse proxy (for example nginx) instead of ## allowing users to connect directly to this server. ## -## ## Basic usage -## ----------- +## =========== ## ## This example will create an HTTP server on port 8080. The server will ## respond to all requests with a ``200 OK`` response code and "Hello World" diff --git a/lib/pure/asyncmacro.nim b/lib/pure/asyncmacro.nim index 23ddf4777..d2750f728 100644 --- a/lib/pure/asyncmacro.nim +++ b/lib/pure/asyncmacro.nim @@ -7,8 +7,6 @@ # distribution, for details about the copyright. # -## AsyncMacro -## ************* ## `asyncdispatch` module depends on the `asyncmacro` module to work properly. import macros, strutils, asyncfutures diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index 94429a657..d7cb5a18a 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -11,7 +11,7 @@ ## asynchronous dispatcher defined in the ``asyncdispatch`` module. ## ## Asynchronous IO in Nim -## ---------------------- +## ====================== ## ## Async IO in Nim consists of multiple layers (from highest to lowest): ## @@ -49,7 +49,7 @@ ## over all the layers, providing some extra features such as buffering. ## ## SSL -## ---- +## === ## ## SSL can be enabled by compiling with the ``-d:ssl`` flag. ## @@ -58,10 +58,10 @@ ## the newly created SSL context to get an SSL socket. ## ## Examples -## -------- +## ======== ## ## Chat server -## ^^^^^^^^^^^ +## ----------- ## ## The following example demonstrates a simple chat server. ## diff --git a/lib/pure/base64.nim b/lib/pure/base64.nim index 427f93926..5985592ff 100644 --- a/lib/pure/base64.nim +++ b/lib/pure/base64.nim @@ -15,7 +15,6 @@ ## bytes (i.e., a total of 24 bits) can therefore be represented by ## four 6-bit Base64 digits. ## -## ## Basic usage ## =========== ## diff --git a/lib/pure/dynlib.nim b/lib/pure/dynlib.nim index 97bc51bc5..ff12be90f 100644 --- a/lib/pure/dynlib.nim +++ b/lib/pure/dynlib.nim @@ -12,10 +12,10 @@ ## Windows ``LoadLibrary``. ## ## Examples -## -------- +## ======== ## ## Loading a simple C function -## ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +## --------------------------- ## ## The following example demonstrates loading a function called 'greet' ## from a library that is determined at runtime based upon a language choice. diff --git a/lib/pure/htmlgen.nim b/lib/pure/htmlgen.nim index fca78fb0f..fd6432bae 100644 --- a/lib/pure/htmlgen.nim +++ b/lib/pure/htmlgen.nim @@ -16,7 +16,8 @@ ## generator. Each commonly used HTML tag has a corresponding macro ## that generates a string with its HTML representation. ## -## Example: +## Examples +## ======== ## ## .. code-block:: Nim ## var nim = "Nim" diff --git a/lib/pure/parsecfg.nim b/lib/pure/parsecfg.nim index d043cd321..b6fd820ff 100644 --- a/lib/pure/parsecfg.nim +++ b/lib/pure/parsecfg.nim @@ -12,48 +12,46 @@ ## format, but much more powerful, as it is not a line based parser. String ## literals, raw string literals and triple quoted string literals are supported ## as in the Nim programming language. - -## This is an example of how a configuration file may look like: +## +## Example of how a configuration file may look like: ## ## .. include:: ../../doc/mytest.cfg ## :literal: ## - -##[ Here is an example of how to use the configuration file parser: - -.. code-block:: nim - - import - os, parsecfg, strutils, streams - - var f = newFileStream(paramStr(1), fmRead) - if f != nil: - var p: CfgParser - open(p, f, paramStr(1)) - while true: - var e = next(p) - case e.kind - of cfgEof: break - of cfgSectionStart: ## a ``[section]`` has been parsed - echo("new section: " & e.section) - of cfgKeyValuePair: - echo("key-value-pair: " & e.key & ": " & e.value) - of cfgOption: - echo("command: " & e.key & ": " & e.value) - of cfgError: - echo(e.msg) - close(p) - else: - echo("cannot open: " & paramStr(1)) - -]## - +## Here is an example of how to use the configuration file parser: +## +## .. code-block:: nim +## +## import os, parsecfg, strutils, streams +## +## var f = newFileStream(paramStr(1), fmRead) +## if f != nil: +## var p: CfgParser +## open(p, f, paramStr(1)) +## while true: +## var e = next(p) +## case e.kind +## of cfgEof: break +## of cfgSectionStart: ## a ``[section]`` has been parsed +## echo("new section: " & e.section) +## of cfgKeyValuePair: +## echo("key-value-pair: " & e.key & ": " & e.value) +## of cfgOption: +## echo("command: " & e.key & ": " & e.value) +## of cfgError: +## echo(e.msg) +## close(p) +## else: +## echo("cannot open: " & paramStr(1)) +## +## ## Examples -## -------- +## ======== ## -## This is an example of a configuration file. +## Configuration file example +## -------------------------- ## -## :: +## .. code-block:: nim ## ## charset = "utf-8" ## [Package] @@ -64,8 +62,8 @@ ## qq = "10214028" ## email = "lihaifeng@wxm.com" ## -## Creating a configuration file. -## ============================== +## Creating a configuration file +## ----------------------------- ## .. code-block:: nim ## ## import parsecfg @@ -78,8 +76,8 @@ ## dict.setSectionKey("Author","email","lihaifeng@wxm.com") ## dict.writeConfig("config.ini") ## -## Reading a configuration file. -## ============================= +## Reading a configuration file +## ---------------------------- ## .. code-block:: nim ## ## import parsecfg @@ -92,8 +90,8 @@ ## var email = dict.getSectionValue("Author","email") ## echo pname & "\n" & name & "\n" & qq & "\n" & email ## -## Modifying a configuration file. -## =============================== +## Modifying a configuration file +## ------------------------------ ## .. code-block:: nim ## ## import parsecfg @@ -101,8 +99,8 @@ ## dict.setSectionKey("Author","name","lhf") ## dict.writeConfig("config.ini") ## -## Deleting a section key in a configuration file. -## =============================================== +## Deleting a section key in a configuration file +## ---------------------------------------------- ## .. code-block:: nim ## ## import parsecfg diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 8074c09e8..6dc56b08a 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -17,7 +17,8 @@ resolution used by ``getTime()`` depends on the platform and backend (JS is limited to millisecond precision). - Examples: + Examples + ======== .. code-block:: nim import times, os @@ -38,7 +39,7 @@ echo "One month from now : ", now() + 1.months Parsing and Formatting Dates - ---------------------------- + ============================ The ``DateTime`` type can be parsed and formatted using the different ``parse`` and ``format`` procedures. @@ -128,7 +129,7 @@ only for years in the range 1..9999). Duration vs TimeInterval - ---------------------------- + ============================ The ``times`` module exports two similiar types that are both used to represent some amount of time: `Duration <#Duration>`_ and `TimeInterval <#TimeInterval>`_. @@ -137,7 +138,7 @@ needed). Duration - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ---------------------------- A ``Duration`` represents a duration of time stored as seconds and nanoseconds. A ``Duration`` is always fully normalized, so ``initDuration(hours = 1)`` and ``initDuration(minutes = 60)`` are equivilant. @@ -147,7 +148,7 @@ is more performant and easier to understand it should generally prefered. TimeInterval - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ---------------------------- A ``TimeInterval`` represents some amount of time expressed in calendar units, for example "1 year and 2 days". Since some units cannot be normalized (the length of a year is different for leap years for example), @@ -164,7 +165,7 @@ ``Duration`` doesn't have. How long is a day? - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ---------------------------- It should be especially noted that the handling of days differs between ``TimeInterval`` and ``Duration``. The ``Duration`` type always treats a day as exactly 86400 seconds. For ``TimeInterval``, it's more complex. diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index ce147cccc..446ead86c 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -57,8 +57,8 @@ ## # Run suites starting with 'bug #' and standalone tests starting with '#' ## nim c -r test 'bug #*::' '::#*' ## -## Example -## ------- +## Examples +## ======== ## ## .. code:: nim ## |