summary refs log tree commit diff stats
path: root/lib/std
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/cmdline.nim9
-rw-r--r--lib/std/private/digitsutils.nim3
-rw-r--r--lib/std/private/since.nim8
-rw-r--r--lib/std/socketstreams.nim57
-rw-r--r--lib/std/typedthreads.nim32
5 files changed, 57 insertions, 52 deletions
diff --git a/lib/std/cmdline.nim b/lib/std/cmdline.nim
index 6788dacde..e545ac599 100644
--- a/lib/std/cmdline.nim
+++ b/lib/std/cmdline.nim
@@ -163,11 +163,12 @@ when defined(nimdoc):
     ##

     ## **Examples:**

     ##

-    ## .. code-block:: nim

+    ##   ```nim

     ##   when declared(paramCount):

     ##     # Use paramCount() here

     ##   else:

     ##     # Do something else!

+    ##   ```

 

   proc paramStr*(i: int): string {.tags: [ReadIOEffect].} =

     ## Returns the `i`-th `command line argument`:idx: given to the application.

@@ -195,11 +196,12 @@ when defined(nimdoc):
     ##

     ## **Examples:**

     ##

-    ## .. code-block:: nim

+    ##   ```nim

     ##   when declared(paramStr):

     ##     # Use paramStr() here

     ##   else:

     ##     # Do something else!

+    ##   ```

 

 elif defined(nimscript): discard

 elif defined(nodejs):

@@ -296,11 +298,12 @@ when declared(paramCount) or defined(nimdoc):
     ##

     ## **Examples:**

     ##

-    ## .. code-block:: nim

+    ##   ```nim

     ##   when declared(commandLineParams):

     ##     # Use commandLineParams() here

     ##   else:

     ##     # Do something else!

+    ##   ```

     result = @[]

     for i in 1..paramCount():

       result.add(paramStr(i))

diff --git a/lib/std/private/digitsutils.nim b/lib/std/private/digitsutils.nim
index 55ace3500..f2d0d25cb 100644
--- a/lib/std/private/digitsutils.nim
+++ b/lib/std/private/digitsutils.nim
@@ -19,7 +19,7 @@ const
 
 # Inspired by https://engineering.fb.com/2013/03/15/developer-tools/three-optimization-tips-for-c
 # Generates:
-# .. code-block:: nim
+#   ```nim
 #   var res = ""
 #   for i in 0 .. 99:
 #     if i < 10:
@@ -27,6 +27,7 @@ const
 #     else:
 #       res.add $i
 #   doAssert res == digits100
+#   ```
 
 proc utoa2Digits*(buf: var openArray[char]; pos: int; digits: uint32) {.inline.} =
   buf[pos] = digits100[2 * digits]
diff --git a/lib/std/private/since.nim b/lib/std/private/since.nim
index 1a6dd02cb..720120f11 100644
--- a/lib/std/private/since.nim
+++ b/lib/std/private/since.nim
@@ -15,19 +15,19 @@ The emulation cannot be 100% faithful and to avoid adding too much complexity,
 template since*(version: (int, int), body: untyped) {.dirty.} =
   ## Evaluates `body` if the ``(NimMajor, NimMinor)`` is greater than
   ## or equal to `version`. Usage:
-  ##
-  ## .. code-block:: Nim
+  ##   ```Nim
   ##   proc fun*() {.since: (1, 3).}
   ##   since (1, 3): fun()
+  ##   ```
   when (NimMajor, NimMinor) >= version:
     body
 
 template since*(version: (int, int, int), body: untyped) {.dirty.} =
   ## Evaluates `body` if ``(NimMajor, NimMinor, NimPatch)`` is greater than 
   ## or equal to `version`. Usage:
-  ##
-  ## .. code-block:: Nim
+  ##   ```Nim
   ##   proc fun*() {.since: (1, 3, 1).}
   ##   since (1, 3, 1): fun()
+  ##   ```
   when (NimMajor, NimMinor, NimPatch) >= version:
     body
diff --git a/lib/std/socketstreams.nim b/lib/std/socketstreams.nim
index b53d6a5d3..41d46e58a 100644
--- a/lib/std/socketstreams.nim
+++ b/lib/std/socketstreams.nim
@@ -31,37 +31,38 @@
 ## Examples
 ## ========
 ##
-## .. code-block:: Nim
-##  import std/socketstreams
+##   ```Nim
+##   import std/socketstreams
 ##
-##  var
-##    socket = newSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
-##    stream = newReadSocketStream(socket)
-##  socket.sendTo("127.0.0.1", Port(12345), "SOME REQUEST")
-##  echo stream.readLine() # Will call `recv`
-##  stream.setPosition(0)
-##  echo stream.readLine() # Will return the read line from the buffer
-##  stream.resetStream() # Buffer is now empty, position is 0
-##  echo stream.readLine() # Will call `recv` again
-##  stream.close() # Closes the socket
+##   var
+##     socket = newSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
+##     stream = newReadSocketStream(socket)
+##   socket.sendTo("127.0.0.1", Port(12345), "SOME REQUEST")
+##   echo stream.readLine() # Will call `recv`
+##   stream.setPosition(0)
+##   echo stream.readLine() # Will return the read line from the buffer
+##   stream.resetStream() # Buffer is now empty, position is 0
+##   echo stream.readLine() # Will call `recv` again
+##   stream.close() # Closes the socket
+##   ```
 ##
-## .. code-block:: Nim
+##   ```Nim
+##   import std/socketstreams
 ##
-##  import std/socketstreams
-##
-##  var socket = newSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
-##  socket.connect("127.0.0.1", Port(12345))
-##  var sendStream = newWriteSocketStream(socket)
-##  sendStream.write "NOM"
-##  sendStream.setPosition(1)
-##  echo sendStream.peekStr(2) # OM
-##  sendStream.write "I"
-##  sendStream.setPosition(0)
-##  echo sendStream.readStr(3) # NIM
-##  echo sendStream.getPosition() # 3
-##  sendStream.flush() # This actually performs the writing to the socket
-##  sendStream.setPosition(1)
-##  sendStream.write "I" # Throws an error as we can't write into an already sent buffer
+##   var socket = newSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
+##   socket.connect("127.0.0.1", Port(12345))
+##   var sendStream = newWriteSocketStream(socket)
+##   sendStream.write "NOM"
+##   sendStream.setPosition(1)
+##   echo sendStream.peekStr(2) # OM
+##   sendStream.write "I"
+##   sendStream.setPosition(0)
+##   echo sendStream.readStr(3) # NIM
+##   echo sendStream.getPosition() # 3
+##   sendStream.flush() # This actually performs the writing to the socket
+##   sendStream.setPosition(1)
+##   sendStream.write "I" # Throws an error as we can't write into an already sent buffer
+##   ```
 
 import net, streams
 
diff --git a/lib/std/typedthreads.nim b/lib/std/typedthreads.nim
index 2c1cf6f1d..501a0d0fa 100644
--- a/lib/std/typedthreads.nim
+++ b/lib/std/typedthreads.nim
@@ -12,27 +12,27 @@
 ## Examples
 ## ========
 ##
-## .. code-block:: Nim
+##   ```Nim
+##   import std/locks
 ##
-##  import std/locks
+##   var
+##     thr: array[0..4, Thread[tuple[a,b: int]]]
+##     L: Lock
 ##
-##  var
-##    thr: array[0..4, Thread[tuple[a,b: int]]]
-##    L: Lock
+##   proc threadFunc(interval: tuple[a,b: int]) {.thread.} =
+##     for i in interval.a..interval.b:
+##       acquire(L) # lock stdout
+##       echo i
+##       release(L)
 ##
-##  proc threadFunc(interval: tuple[a,b: int]) {.thread.} =
-##    for i in interval.a..interval.b:
-##      acquire(L) # lock stdout
-##      echo i
-##      release(L)
+##   initLock(L)
 ##
-##  initLock(L)
+##   for i in 0..high(thr):
+##     createThread(thr[i], threadFunc, (i*10, i*10+5))
+##   joinThreads(thr)
 ##
-##  for i in 0..high(thr):
-##    createThread(thr[i], threadFunc, (i*10, i*10+5))
-##  joinThreads(thr)
-##
-##  deinitLock(L)
+##   deinitLock(L)
+##   ```