Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RST: improve simple tables #19859

Merged
merged 3 commits into from
Jun 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/docgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ template declareClosures =
of meExpected: k = errXExpected
of meGridTableNotImplemented: k = errRstGridTableNotImplemented
of meMarkdownIllformedTable: k = errRstMarkdownIllformedTable
of meIllformedTable: k = errRstIllformedTable
of meNewSectionExpected: k = errRstNewSectionExpected
of meGeneralParseError: k = errRstGeneralParseError
of meInvalidDirective: k = errRstInvalidDirectiveX
Expand Down
2 changes: 2 additions & 0 deletions compiler/lineinfos.nim
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type
errXExpected,
errRstGridTableNotImplemented,
errRstMarkdownIllformedTable,
errRstIllformedTable,
errRstNewSectionExpected,
errRstGeneralParseError,
errRstInvalidDirectiveX,
Expand Down Expand Up @@ -106,6 +107,7 @@ const
errXExpected: "'$1' expected",
errRstGridTableNotImplemented: "grid table is not implemented",
errRstMarkdownIllformedTable: "illformed delimiter row of a markdown table",
errRstIllformedTable: "Illformed table: $1",
errRstNewSectionExpected: "new section expected $1",
errRstGeneralParseError: "general parse error",
errRstInvalidDirectiveX: "invalid directive: '$1'",
Expand Down
6 changes: 3 additions & 3 deletions doc/apis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ been renamed to fit this scheme. The ultimate goal is that the programmer can
*guess* a name.


------------------- ------------ --------------------------------------
=================== ============ ======================================
English word To use Notes
------------------- ------------ --------------------------------------
=================== ============ ======================================
initialize initT `init` is used to create a
value type `T`
new newP `new` is used to create a
Expand Down Expand Up @@ -82,4 +82,4 @@ literal lit
string str
identifier ident
indentation indent
------------------- ------------ --------------------------------------
=================== ============ ======================================
12 changes: 6 additions & 6 deletions doc/astspec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ A leaf of the AST often corresponds to a terminal symbol in the concrete
syntax. Note that the default ``float`` in Nim maps to ``float64`` such that
the default AST for a float is ``nnkFloat64Lit`` as below.

----------------- ---------------------------------------------
================= =============================================
Nim expression Corresponding AST
----------------- ---------------------------------------------
================= =============================================
``42`` ``nnkIntLit(intVal = 42)``
``42'i8`` ``nnkInt8Lit(intVal = 42)``
``42'i16`` ``nnkInt16Lit(intVal = 42)``
Expand All @@ -72,7 +72,7 @@ Nim expression Corresponding AST
``nil`` ``nnkNilLit()``
``myIdentifier`` ``nnkIdent(strVal = "myIdentifier")``
``myIdentifier`` after lookup pass: ``nnkSym(strVal = "myIdentifier", ...)``
----------------- ---------------------------------------------
================= =============================================

Identifiers are ``nnkIdent`` nodes. After the name lookup pass these nodes
get transferred into ``nnkSym`` nodes.
Expand Down Expand Up @@ -1211,9 +1211,9 @@ AST:
In general, declaring types mirrors this syntax (i.e., ``nnkStaticTy`` for
``static``, etc.). Examples follow (exceptions marked by ``*``):

------------- ---------------------------------------------
============= =============================================
Nim type Corresponding AST
------------- ---------------------------------------------
============= =============================================
``static`` ``nnkStaticTy``
``tuple`` ``nnkTupleTy``
``var`` ``nnkVarTy``
Expand All @@ -1226,7 +1226,7 @@ Nim type Corresponding AST
``proc`` ``nnkProcTy``
``iterator`` ``nnkIteratorTy``
``object`` ``nnkObjectTy``
------------- ---------------------------------------------
============= =============================================

Take special care when declaring types as ``proc``. The behavior is similar
to ``Procedure declaration``, below, but does not treat ``nnkGenericParams``.
Expand Down
2 changes: 1 addition & 1 deletion doc/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ contain the following `escape sequences`:idx:\ :
``\\`` `backslash`:idx:
``\"`` `quotation mark`:idx:
``\'`` `apostrophe`:idx:
``\`` '0'..'9'+ `character with decimal value d`:idx:;
``\`` '0'..'9'+ `character with decimal value d`:idx:;
all decimal digits directly
following are used for the character
``\a`` `alert`:idx:
Expand Down
6 changes: 3 additions & 3 deletions doc/nep1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ The library uses a simple naming scheme that makes use of common abbreviations
to keep the names short but meaningful.


------------------- ------------ --------------------------------------
=================== ============ ======================================
English word To use Notes
------------------- ------------ --------------------------------------
=================== ============ ======================================
initialize initFoo initializes a value type `Foo`
new newFoo initializes a reference type `Foo`
via `new` or a value type `Foo`
Expand Down Expand Up @@ -220,7 +220,7 @@ literal lit
string str
identifier ident
indentation indent
------------------- ------------ --------------------------------------
=================== ============ ======================================


Coding Conventions
Expand Down
8 changes: 7 additions & 1 deletion doc/nimdoc.cls
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

\usepackage{scrextend} % for the `addmargin` environment

\usepackage{xcolor}
\usepackage[table]{xcolor}
\usepackage[urlbordercolor=blue,linkbordercolor=cyan,
pdfborderstyle={/S/U/W 1}]{hyperref}
\usepackage{enumitem} % for option list, enumList, and rstfootnote
Expand All @@ -84,6 +84,11 @@

\definecolor{rstframecolor}{rgb}{0.85, 0.8, 0.6}

\usepackage{booktabs}
\belowrulesep=0ex
\aboverulesep=0ex
\renewcommand{\arraystretch}{1.1}

\newtcolorbox{rstprebox}[1][]{blanker, breakable,
left=3mm, right=3mm, top=1mm, bottom=1mm,
borderline ={0.1em}{0pt}{rstframecolor},
Expand Down Expand Up @@ -127,6 +132,7 @@
\newenvironment{rstoptlist}{%
\begin{description}[font=\sffamily\bfseries,style=nextline,leftmargin=\rstoptleftmargin,labelwidth=\rstoptlabelwidth]}{\end{description}}

\usepackage{multirow}
\usepackage{tabulary} % tables with adjustable cell width and no overflow
% make tabulary prevent overflows (https://tex.stackexchange.com/a/195088)
\tymin=60pt
Expand Down
22 changes: 11 additions & 11 deletions doc/niminst.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ contain the following key-value pairs:
==================== =======================================================
Key description
==================== =======================================================
`Name` the project's name; this needs to be a single word
`DisplayName` the project's long name; this can contain spaces. If
`Name` the project's name; this needs to be a single word
`DisplayName` the project's long name; this can contain spaces. If
not specified, this is the same as `Name`.
`Version` the project's version
`OS` the OSes to generate C code for; for example:
`Version` the project's version
`OS` the OSes to generate C code for; for example:
`"windows;linux;macosx"`
`CPU` the CPUs to generate C code for; for example:
`CPU` the CPUs to generate C code for; for example:
`"i386;amd64;powerpc"`
`Authors` the project's authors
`Description` the project's description
`App` the application's type: "Console" or "GUI". If
`Authors` the project's authors
`Description` the project's description
`App` the application's type: "Console" or "GUI". If
"Console", niminst generates a special batch file
for Windows to open up the command-line shell.
`License` the filename of the application's license
`License` the filename of the application's license
==================== =======================================================


Expand Down Expand Up @@ -149,9 +149,9 @@ Possible options are:
==================== =======================================================
Key description
==================== =======================================================
`InstallScript` boolean flag whether an installation shell script
`InstallScript` boolean flag whether an installation shell script
should be generated. Example: `InstallScript: "Yes"`
`UninstallScript` boolean flag whether a de-installation shell script
`UninstallScript` boolean flag whether a de-installation shell script
should be generated.
Example: `UninstallScript: "Yes"`
==================== =======================================================
Expand Down
6 changes: 3 additions & 3 deletions doc/tut1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1185,9 +1185,9 @@ subranges) are called ordinal types. Ordinal types have quite
a few special operations:


----------------- --------------------------------------------------------
================= ========================================================
Operation Comment
----------------- --------------------------------------------------------
================= ========================================================
`ord(x)` returns the integer value that is used to
represent `x`'s value
`inc(x)` increments `x` by one
Expand All @@ -1198,7 +1198,7 @@ Operation Comment
`succ(x, n)` returns the `n`'th successor of `x`
`pred(x)` returns the predecessor of `x`
`pred(x, n)` returns the `n`'th predecessor of `x`
----------------- --------------------------------------------------------
================= ========================================================


The `inc <system.html#inc,T,int>`_, `dec <system.html#dec,T,int>`_, `succ
Expand Down
Loading