summary refs log tree commit diff stats
path: root/config
diff options
context:
space:
mode:
authorAndrey Makarov <ph.makarov@gmail.com>2021-05-14 08:30:47 +0300
committerGitHub <noreply@github.com>2021-05-14 07:30:47 +0200
commit97970d9dccb24bb290cdba14275acae62602c832 (patch)
treeb4d35aefd2a1a549fdbe5ebd4839bd7e7c165105 /config
parent3c622d799929520ce4f1831ec2b8ba575f21e2e0 (diff)
downloadNim-97970d9dccb24bb290cdba14275acae62602c832.tar.gz
`doc2tex`: generate docs to Latex (#17997)
* `doc2tex`: generate docs to Latex

* address some comments
Diffstat (limited to 'config')
-rw-r--r--config/nimdoc.cfg1
-rw-r--r--config/nimdoc.tex.cfg16
2 files changed, 12 insertions, 5 deletions
diff --git a/config/nimdoc.cfg b/config/nimdoc.cfg
index 82bd9cc21..ed1b346a2 100644
--- a/config/nimdoc.cfg
+++ b/config/nimdoc.cfg
@@ -42,6 +42,7 @@ doc.section.toc2 = """
 # * $itemSymOrID: the symbolic name or the ID if that is not unique.
 # * $itemSymOrIDEnc: quoted version for URLs or attributes.
 # * $name: reduced name of the item.
+# * $uniqueName: name with parameters for routine types or $name for others.
 # * $seeSrc: generated HTML from doc.item.seesrc (if some switches are used).
 
 doc.item = """
diff --git a/config/nimdoc.tex.cfg b/config/nimdoc.tex.cfg
index b1c02c5a0..b19b25678 100644
--- a/config/nimdoc.tex.cfg
+++ b/config/nimdoc.tex.cfg
@@ -8,22 +8,24 @@ split.item.toc = "20"
 # after this number of characters
 
 doc.section = """
-\chapter{$sectionTitle}\label{$sectionID}
-\begin{description}
+\rsthA{$sectionTitle}\label{$sectionID}
 $content
-\end{description}
 """
 
 doc.section.toc = ""
 # $sectionID $sectionTitleID $sectionTitle $content
 
 doc.item = """
-\item[\texttt{$header}\label{$itemID}]\mbox{~}\\*
+
+\phantomsection\addcontentsline{toc}{subsection}{$uniqueName}
+
+\begin{rstpre}
+$header
+\end{rstpre}
 $desc
 """
 
 doc.item.toc = ""
-#  \item $name\ref{$itemID}
 
 doc.toc = r"\tableofcontents \newpage"
 
@@ -38,6 +40,10 @@ $moduledesc
 $content
 """
 
+# $1 - number of listing in document, $2 - language (e.g. langNim), $3 - anchor
+doc.listing_start = "\\begin{rstpre}\n"
+doc.listing_end = "\n\\end{rstpre}\n"
+
 doc.file = """
 % This file was generated by Nim.
 % Generated: $date $time UTC