You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR implements an alternative path to docstring rendering that
reads the necessary data from a doc-gen4 SQLite database, to work
around the fact that docstring info is no longer available in the
environment with the module system and to allow a global view of the
project for things like instance lists.
Copy file name to clipboardExpand all lines: doc/UsersGuide/Manuals.lean
+46-1Lines changed: 46 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,9 @@ Author: David Thrane Christiansen
6
6
import Lean.DocString.Syntax
7
7
import VersoManual
8
8
import VersoBlog
9
+
import VersoManual.DB
9
10
10
-
open Verso Genre Manual
11
+
open Verso Genre Manual DB
11
12
12
13
open InlineLean
13
14
open Verso.Doc
@@ -21,38 +22,66 @@ htmlSplit := .never
21
22
Verso's {name}`Manual` genre can be used to write reference manuals, textbooks, or other book-like documents.
22
23
It supports generating both HTML and PDFs via LaTeX, but the PDF support is relatively immature and untested compared to the HTML support.
23
24
25
+
{dbDocstring Manual}
24
26
{docstring Manual}
25
27
28
+
29
+
30
+
31
+
{dbDocstring Manual.PartMetadata}
26
32
{docstring Manual.PartMetadata}
27
33
34
+
35
+
36
+
{dbDocstring Manual.HtmlSplitMode}
28
37
{docstring Manual.HtmlSplitMode}
29
38
39
+
40
+
30
41
The {name}`Manual` genre's block and inline element types are extensible.
31
42
In the document, they consist of instances of {name}`Manual.Block` and {name}`Manual.Inline`, respectively:
32
43
44
+
{dbDocstring Manual.Block}
33
45
{docstring Manual.Block}
34
46
47
+
48
+
49
+
{dbDocstring Manual.Inline}
35
50
{docstring Manual.Inline}
36
51
52
+
53
+
37
54
The fields {name}`Block.name` and {name Manual.Inline.name}`Inline.name` are used to look up concrete implementations of traversal and output generation in run-time tables that contain descriptions:
38
55
56
+
{dbDocstring Manual.BlockDescr}
39
57
{docstring Manual.BlockDescr}
40
58
59
+
60
+
61
+
{dbDocstring Manual.InlineDescr}
41
62
{docstring Manual.InlineDescr}
42
63
64
+
65
+
43
66
Typically, the `inline_extension` and `block_extension` commands are used to simultaneously define an element and its descriptor, registering them for use by {name}`manualMain`.
44
67
45
68
:::paragraph
46
69
The type {name}`HtmlAssets` contains CSS and JavaScript code.
47
70
{name}`Manual.TraverseState`, {name}`Manual.BlockDescr`, and {name}`Manual.InlineDescr` all inherit from this structure.
48
71
During traversal, HTML assets are collected; they are all included in the final rendered document.
49
72
73
+
{dbDocstring Manual.HtmlAssets}
50
74
{docstring Manual.HtmlAssets}
51
75
76
+
77
+
52
78
Use {name}`HtmlAssets.combine` to combine multiple assets.
53
79
80
+
{dbDocstring Manual.HtmlAssets.combine}
54
81
{docstring Manual.HtmlAssets.combine}
55
82
83
+
84
+
56
85
:::
57
86
58
87
# Tags and References
@@ -92,13 +121,19 @@ tag := "docstrings"
92
121
Docstrings can be included using the `docstring` directive. For instance,
93
122
94
123
```
124
+
{dbDocstring List.forM}
95
125
{docstring List.forM}
126
+
127
+
96
128
```
97
129
98
130
results in
99
131
132
+
{dbDocstring List.forM}
100
133
{docstring List.forM}
101
134
135
+
136
+
102
137
The {name}`docstring` command takes a positional parameter which is the documented name.
103
138
It also accepts the following optional named parameters:
104
139
@@ -154,11 +189,17 @@ Elsewhere in the document, `tech` can be used to annotate a use site of a techni
154
189
A {deftech}_technical term_ is a term with a specific meaning that's used precisely, like this one.
155
190
References to technical terms are valid both before and after their definition sites.
156
191
192
+
{dbDocstring deftech}
157
193
{docstring deftech}
158
194
195
+
196
+
197
+
{dbDocstring tech}
159
198
{docstring tech}
160
199
161
200
201
+
202
+
162
203
# Open-Source Licenses
163
204
%%%
164
205
tag := "oss-licenses"
@@ -168,8 +209,12 @@ To facilitate providing appropriate credit to the authors of open-source JavaScr
168
209
This is done using the {name HtmlAssets.licenseInfo}`licenseInfo` field that {name}`BlockDescr` and {name}`InlineDescr` inherit from {name}`HtmlAssets`.
169
210
These contain a {name}`LicenseInfo`:
170
211
212
+
{dbDocstring LicenseInfo}
171
213
{docstring LicenseInfo}
172
214
215
+
216
+
173
217
The {name}`licenseInfo` command displays the licenses for all components that were included in the generated document:
0 commit comments