From bba3a20e7ca50456fa1fc96ec4fa7e917113a840 Mon Sep 17 00:00:00 2001 From: Miran Date: Fri, 8 Mar 2019 13:55:27 +0100 Subject: [PATCH] documentation style tweaks (#10790) * exports are the least important field in the docs: they are put in the last place (at the bottom) * indent text after proc/type declaration for an easier navigation (noticeable difference between declarations and examples) * quickfix invalid style in `asynchttpserver` --- compiler/docgen.nim | 8 ++++---- config/nimdoc.cfg | 6 +++--- lib/pure/asynchttpserver.nim | 8 ++++---- nimdoc/testproject/expected/subdir/subdir_b/utils.html | 6 +++--- nimdoc/testproject/expected/testproject.html | 6 +++--- nimdoc/testproject/expected/theindex.html | 6 +++--- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 7e7666de47..5c3e1af347 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -20,7 +20,7 @@ import pathutils const - exportSection = skTemp + exportSection = skField type TSections = array[TSymKind, Rope] @@ -893,9 +893,9 @@ proc generateTags*(d: PDoc, n: PNode, r: var Rope) = else: discard proc genSection(d: PDoc, kind: TSymKind) = - const sectionNames: array[skTemp..skTemplate, string] = [ - "Exports", "Imports", "Types", "Vars", "Lets", "Consts", "Vars", "Procs", "Funcs", - "Methods", "Iterators", "Converters", "Macros", "Templates" + const sectionNames: array[skModule..skField, string] = [ + "Imports", "Types", "Vars", "Lets", "Consts", "Vars", "Procs", "Funcs", + "Methods", "Iterators", "Converters", "Macros", "Templates", "Exports" ] if d.section[kind] == nil: return var title = sectionNames[kind].rope diff --git a/config/nimdoc.cfg b/config/nimdoc.cfg index c5effd04e7..1e18c050e3 100644 --- a/config/nimdoc.cfg +++ b/config/nimdoc.cfg @@ -533,11 +533,11 @@ dl { dt { margin-bottom: -0.5em; - margin-left: 0.5em; } + margin-left: 0.0em; } dd { - margin-left: 0.5em; - margin-bottom: 2.5em; + margin-left: 2.0em; + margin-bottom: 3.0em; margin-top: 0.5em; } diff --git a/lib/pure/asynchttpserver.nim b/lib/pure/asynchttpserver.nim index edccd6628e..4aed426835 100644 --- a/lib/pure/asynchttpserver.nim +++ b/lib/pure/asynchttpserver.nim @@ -15,8 +15,8 @@ ## allowing users to connect directly to this server. ## ## -## Examples -## -------- +## 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" @@ -85,8 +85,8 @@ proc respond*(req: Request, code: HttpCode, content: string, ## ## This procedure will **not** close the client socket. ## - ## Examples - ## -------- + ## Example: + ## ## .. code-block::nim ## import json ## proc handler(req: Request) {.async.} = diff --git a/nimdoc/testproject/expected/subdir/subdir_b/utils.html b/nimdoc/testproject/expected/subdir/subdir_b/utils.html index 650226c81e..12d98f91c2 100644 --- a/nimdoc/testproject/expected/subdir/subdir_b/utils.html +++ b/nimdoc/testproject/expected/subdir/subdir_b/utils.html @@ -345,11 +345,11 @@ dl { dt { margin-bottom: -0.5em; - margin-left: 0.5em; } + margin-left: 0.0em; } dd { - margin-left: 0.5em; - margin-bottom: 2.5em; + margin-left: 2.0em; + margin-bottom: 3.0em; margin-top: 0.5em; } diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html index 38522d493c..7e62de630b 100644 --- a/nimdoc/testproject/expected/testproject.html +++ b/nimdoc/testproject/expected/testproject.html @@ -345,11 +345,11 @@ dl { dt { margin-bottom: -0.5em; - margin-left: 0.5em; } + margin-left: 0.0em; } dd { - margin-left: 0.5em; - margin-bottom: 2.5em; + margin-left: 2.0em; + margin-bottom: 3.0em; margin-top: 0.5em; } diff --git a/nimdoc/testproject/expected/theindex.html b/nimdoc/testproject/expected/theindex.html index f4d052c5a1..47d34be0a6 100644 --- a/nimdoc/testproject/expected/theindex.html +++ b/nimdoc/testproject/expected/theindex.html @@ -345,11 +345,11 @@ dl { dt { margin-bottom: -0.5em; - margin-left: 0.5em; } + margin-left: 0.0em; } dd { - margin-left: 0.5em; - margin-bottom: 2.5em; + margin-left: 2.0em; + margin-bottom: 3.0em; margin-top: 0.5em; }