-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathTutorialMain.lean
More file actions
204 lines (172 loc) · 5.36 KB
/
TutorialMain.lean
File metadata and controls
204 lines (172 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/-
Copyright (c) 2024-2025 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import VersoTutorial
import VersoBlog
import Tutorial
import Tutorial.Meta.Theme
import VersoWeb.Theme
open Verso.Genre.Manual
open Verso.Genre.Tutorial
open Verso.Genre.Blog (Page)
open Verso.Output.Html in
def plausible := {{
<script defer="defer" data-domain="lean-lang.org" src="https://plausible.io/js/script.outbound-links.js"></script>
}}
def version (_content : Array (Verso.Doc.Inline g)) : Verso.Doc.Inline g := .text Lean.versionString
def manualLink (args : Array (Verso.Doc.Inline g)) : Verso.Doc.Inline g:=
Verso.Doc.Inline.link args Lean.manualRoot
open Verso.Doc Concrete in
def tutorials : Tutorials where
content :=
(verso (Page) "Tutorials"
:::::::
These tutorials cover version {version}[] of Lean.
While the {manualLink}[reference manual] describes the system and its features in detail, these tutorials provide focused introductions to specific tools.
:::::::).toPart
topics := #[
{ title := #[inlines!"Tactics"],
titleString := "Tactics"
description := #[blocks!"These tutorials demonstrate Lean's advanced proof automation."]
tutorials := #[%doc Tutorial.VCGen, %doc Tutorial.Grind.IndexMap]
}
]
open Verso.Genre.Blog Site.Syntax in
open Verso.Doc in
def leanSite : Site :=
site home /
"install" install
"learn" learn
"community" community
"use-cases" «use-cases»
"fro" fro
where
placeholder title : Part Page := { title := #[.text title], titleString := title, metadata := none, content := #[], subParts := #[] }
home : VersoDoc Page := { construct := fun _ => placeholder "Lean" }
install : VersoDoc Page := { construct := fun _ => placeholder "Install" }
learn : VersoDoc Page := { construct := fun _ => placeholder "Learn" }
community : VersoDoc Page := { construct := fun _ => placeholder "Community" }
«use-cases» : VersoDoc Page := { construct := fun _ => placeholder "Use Cases" }
«trademark-policy» : VersoDoc Page := { construct := fun _ => placeholder "Trademark Policy" }
privacy : VersoDoc Page := { construct := fun _ => placeholder "Privacy" }
terms : VersoDoc Page := { construct := fun _ => placeholder "Terms" }
logos : VersoDoc Page := { construct := fun _ => placeholder "Logos" }
fro : VersoDoc Page := { construct := fun _ => placeholder "FRO" }
documentation : VersoDoc Page := { construct := fun _ => placeholder "Documentation" }
examples : VersoDoc Page :={ construct := fun _ => placeholder "Examples" }
publications : VersoDoc Page := { construct := fun _ => placeholder "Publications" }
links : VersoDoc Page := { construct := fun _ => placeholder "Links" }
people : VersoDoc Page := { construct := fun _ => placeholder "People" }
def codeColors := r#"
:root {
--verso-code-color: var(--color-text) !important;
}
"#
def localToCStyle := r#"
/*
nav.local-toc {
position: fixed;
top: calc(var(--nav-height) + 1rem + 60px);
right: calc((100vw - var(--container-width)) / 2 - 15rem - 2rem);
width: 15rem;
font-size: 0.875rem;
max-height: calc(100vh - 2rem - var(--nav-height) - 60px);
overflow-y: auto;
}
*/
nav.local-toc h1 {
display: none;
}
nav.local-toc ol {
list-style: none;
margin: 0;
padding: 0;
display: none;
}
nav.local-toc li {
margin: 0.5rem 0;
}
nav.local-toc a {
color: var(--verso-text-color);
text-decoration: none;
}
nav.local-toc a:hover {
color: var(--color-accent);
}
/* On smaller screens, display normally */
/*
@media (max-width: 90rem) {
nav.local-toc {
position: static;
right: auto;
width: auto;
max-height: none;
border-left: 3px solid var(--color-border);
padding-left: 1rem;
margin-bottom: 1rem;
}
}
*/
nav.local-toc ol ol {
padding-left: 1rem;
margin-top: 0.25rem;
}
nav.local-toc ol ol li {
margin: 0.25rem 0;
}
/*******/
nav.local-toc > div:first-child {
margin-bottom: 1rem;
}
nav.local-toc h1 {
font-size: 1rem;
margin: 0 0 0.5rem 0;
font-weight: 600;
}
nav.local-toc .code-links {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
nav.local-toc .code-link {
font-size: 0.8125rem;
padding: 0.25rem 0.5rem;
border: 1px solid var(--color-border);
border-radius: 6px;
color: var(--verso-text-color);
text-decoration: none;
display: inline-block;
}
nav.local-toc .code-link:hover {
background: var(--verso-selected-color);
border-color: var(--color-accent);
}
nav.local-toc .code-link code {
background: none;
padding: 0;
font-size: inherit;
}
nav.local-toc .code-link.live::before {
content: "↪ ";
margin-right: 0.25rem;
}
nav.local-toc .code-link.download::before {
content: "📦 ";
margin-right: 0.25rem;
}
"#
open Verso.Genre.Blog.Template in
open Verso.Output Html in
def theme :=
{ LeanLangOrg.theme with
pageTemplate := do
let tutorialNav : Option Html ← param? "tutorialNav"
let content : Html ← param "content"
let content := tutorialNav.getD .empty ++ content
withTheReader Context (fun ρ => { ρ with params := ρ.params.insert "content" content }) LeanLangOrg.theme.pageTemplate
cssFiles := LeanLangOrg.theme.cssFiles.push ("code-colors.css", codeColors) |>.push ("local-toc.css", localToCStyle)
}
def main :=
tutorialsMain tutorials (config := {destination := "_tutorial-out"}) (theme := theme) (navSite := leanSite)