Skip to content

Commit 9aa1767

Browse files
chore: improve presentation unconfigured blogs (#484)
1 parent ff321bc commit 9aa1767

22 files changed

Lines changed: 353 additions & 148 deletions

File tree

‎examples/anchor-examples/AnchorExamples.lean‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import AnchorExamples.Basic
99
-- ANCHOR: t
1010
def someTree : Tree Nat :=
1111
-- ANCHOR: tDef
12-
.branch (.branch .leaf 1 .leaf) 2 (.branch (.branch .leaf 3 .leaf) 4 .leaf)
12+
.branch
13+
(.branch .leaf 1 .leaf)
14+
2
15+
(.branch (.branch .leaf 3 .leaf) 4 .leaf)
1316
-- ANCHOR_END: tDef
1417
-- ANCHOR_END: t
1518

@@ -25,7 +28,8 @@ deriving instance Repr for Tree
2528

2629

2730
-- ANCHOR: proof1
28-
theorem Tree.flip_flip_eq_id : flip ∘ flip = (id : Tree α → Tree α) := by
31+
theorem Tree.flip_flip_eq_id :
32+
flip ∘ flip = (id : Tree α → Tree α) := by
2933
funext t
3034
induction t with
3135
| leaf => rfl
@@ -37,7 +41,8 @@ theorem Tree.flip_flip_eq_id : flip ∘ flip = (id : Tree α → Tree α) := by
3741

3842
-- ANCHOR: proof2
3943
-- Show more tactic combinators and placement of proof states
40-
theorem Tree.flip_flip_id' (t : Tree α) : t.flip.flip = t := by
44+
theorem Tree.flip_flip_id' (t : Tree α) :
45+
t.flip.flip = t := by
4146
induction t
4247
case leaf => rfl
4348
next l v r ih1 ih2 =>

‎examples/anchor-examples/lake-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"url": "https://github.com/leanprover/subverso",
77
"type": "git",
88
"subDir": null,
9-
"rev": "6d5c658ad7ae2ee1bf954f2edf0d0252b35f1c76",
9+
"rev": "f174913cae5c976a3bcc218fddb996fe0ab0a28e",
1010
"name": "subverso",
1111
"manifestFile": "lake-manifest.json",
1212
"inputRev": "main",

‎examples/documented-package/lake-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "git",
88
"subDir": null,
99
"scope": "",
10-
"rev": "6d5c658ad7ae2ee1bf954f2edf0d0252b35f1c76",
10+
"rev": "f174913cae5c976a3bcc218fddb996fe0ab0a28e",
1111
"name": "subverso",
1212
"manifestFile": "lake-manifest.json",
1313
"inputRev": "main",

‎examples/textbook/DemoTextbook.lean‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ open DemoTextbook
2424
set_option pp.rawOnError true
2525

2626

27-
2827
#doc (Manual) "A Textbook" =>
2928

3029
%%%

‎examples/website-examples/lake-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"url": "https://github.com/leanprover/subverso",
77
"type": "git",
88
"subDir": null,
9-
"rev": "6d5c658ad7ae2ee1bf954f2edf0d0252b35f1c76",
9+
"rev": "f174913cae5c976a3bcc218fddb996fe0ab0a28e",
1010
"name": "subverso",
1111
"manifestFile": "lake-manifest.json",
1212
"inputRev": "main",

‎examples/website-literate/lake-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "git",
88
"subDir": null,
99
"scope": "",
10-
"rev": "6d5c658ad7ae2ee1bf954f2edf0d0252b35f1c76",
10+
"rev": "f174913cae5c976a3bcc218fddb996fe0ab0a28e",
1111
"name": "subverso",
1212
"manifestFile": "lake-manifest.json",
1313
"inputRev": "main",

‎examples/website/DemoSite/Blog/AnchorBased.lean‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,18 @@ Here's a tree:
3535

3636
```anchor t
3737
def someTree : Tree Nat :=
38-
.branch (.branch .leaf 1 .leaf) 2 (.branch (.branch .leaf 3 .leaf) 4 .leaf)
38+
.branch
39+
(.branch .leaf 1 .leaf)
40+
2
41+
(.branch (.branch .leaf 3 .leaf) 4 .leaf)
3942
```
4043

4144
And here's just part of its definition:
4245
```anchor tDef
43-
.branch (.branch .leaf 1 .leaf) 2 (.branch (.branch .leaf 3 .leaf) 4 .leaf)
46+
.branch
47+
(.branch .leaf 1 .leaf)
48+
2
49+
(.branch (.branch .leaf 3 .leaf) 4 .leaf)
4450
```
4551

4652
It's left branch is {anchorTerm tDef}`.branch .leaf 1 .leaf` which includes a reference to {anchorName tDef}`.leaf`.
@@ -58,7 +64,8 @@ Tree.branch
5864

5965
As does proofs and parts of proofs:
6066
```anchor proof1
61-
theorem Tree.flip_flip_eq_id : flip ∘ flip = (id : Tree α → Tree α) := by
67+
theorem Tree.flip_flip_eq_id :
68+
flip ∘ flip = (id : Tree α → Tree α) := by
6269
funext t
6370
induction t with
6471
| leaf => rfl
@@ -77,7 +84,8 @@ branch l v r ih1 ih2
7784

7885
This rendering of the same proof doesn't have proof states:
7986
```anchor proof1 (showProofStates := false)
80-
theorem Tree.flip_flip_eq_id : flip ∘ flip = (id : Tree α → Tree α) := by
87+
theorem Tree.flip_flip_eq_id :
88+
flip ∘ flip = (id : Tree α → Tree α) := by
8189
funext t
8290
induction t with
8391
| leaf => rfl

‎examples/website/DemoSite/Blog/Conditionals.lean‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,35 +179,43 @@ theorem grow_10_id {α} : grow (α := α) 6 = id := by
179179

180180
Here is a proof with big terms in the context:
181181
```lean demo
182+
section
183+
open Lean
182184

183-
open Lean in
184-
def quotedStx [Monad m] [MonadQuotation m] [MonadRef m] (str : String) : m Syntax := do
185+
variable [Monad m] [MonadQuotation m] [MonadRef m]
186+
187+
def quoted (str : String) : m Syntax := do
185188
let s ← `(a b c #[x, $(quote str), z])
186189
pure s
187190

188-
open Lean in
189-
example [Monad m] [MonadQuotation m] [MonadRef m] : ¬(quotedStx (m := m) = fun (x : String) => pure .missing) := by
190-
unfold quotedStx
191+
example : ¬(quoted (m := m) = fun x => pure .missing) := by
192+
unfold quoted
191193
intro h
192194
let g : String → m Syntax := fun str => do
193195
let s ← `(a b c #[x, $(quote str), z])
194196
pure s
195197
have : g "hello" ≠ pure .missing := by skip; sorry
196198
sorry
199+
200+
end
197201
```
198202

199203
It's possible to render a lot of info on one example:
200204
```lean demo
201-
elab "%much_info(" t:term ")" : term => open Lean Elab Term in do
205+
open Lean Elab Term in
206+
elab "%much_info(" t:term ")" : term => do
202207
for i in [0:20] do
203208
logInfoAt t m!"Hello! ({i})"
204209
logInfoAt t "Some multi-line\ninfo too"
205210
elabTerm t none
206211

207-
elab "%more_info(" t:term ")" : term => open Lean Elab Term in do
212+
open Lean Elab Term in
213+
elab "%more_info(" t:term ")" : term => do
208214
for i in [0:20] do
209215
logInfoAt t m!"Hello again! ({i})"
210-
logErrorAt t "And a great big error, much wider than the other info!"
216+
logErrorAt t <|
217+
"And a great big error, " ++
218+
"much wider than the other info!"
211219
elabTerm t none
212220
```
213221

‎examples/website/DemoSiteMain.lean‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,28 @@ def theme : Theme := { Theme.default with
3232
return {{
3333
<html>
3434
<head>
35-
<meta charset="UTF-8"/>
35+
<meta charset="utf-8"/>
36+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
37+
<meta name="color-scheme" content="light dark"/>
38+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sakura.css/css/sakura.css" type="text/css"/>
3639
<title>{{ (← param (α := String) "title") }} " — Verso "</title>
3740
<link rel="stylesheet" href="/static/style.css"/>
3841
{{← builtinHeader }}
3942
</head>
4043
<body>
4144
<header>
4245
<div class="inner-wrap">
43-
<a class="logo" href="/"><img src="/static/logo.png"/></a>
46+
<a class="logo" href="/"><h1>"A Verso Site"</h1></a>
4447
{{ ← topNav }}
4548
</div>
4649
</header>
47-
<div class="main" role="main">
50+
<main>
4851
<div class="wrap">
4952
{{ (← param "content") }}
5053
{{ postList }}
5154
{{ catList }}
5255
</div>
53-
</div>
56+
</main>
5457
</body>
5558
</html>
5659
}}

‎examples/website/static_files/style.css‎

Lines changed: 18 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,19 @@
11

2-
/* http://meyerweb.com/eric/tools/css/reset/
3-
v2.0 | 20110126
4-
License: none (public domain)
5-
*/
6-
7-
html, body, div, span, applet, object, iframe,
8-
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
9-
a, abbr, acronym, address, big, cite, code,
10-
del, dfn, em, img, ins, kbd, q, s, samp,
11-
small, strike, strong, sub, sup, tt, var,
12-
b, u, i, center,
13-
dl, dt, dd, ol, ul, li,
14-
fieldset, form, label, legend,
15-
table, caption, tbody, tfoot, thead, tr, th, td,
16-
article, aside, canvas, details, embed,
17-
figure, figcaption, footer, header, hgroup,
18-
menu, nav, output, ruby, section, summary,
19-
time, mark, audio, video {
20-
margin: 0;
21-
padding: 0;
22-
border: 0;
23-
font-size: 100%;
24-
font: inherit;
25-
vertical-align: baseline;
26-
}
27-
/* HTML5 display-role reset for older browsers */
28-
article, aside, details, figcaption, figure,
29-
footer, header, hgroup, menu, nav, section {
30-
display: block;
31-
}
32-
body {
33-
line-height: 1;
34-
font-size: 14px;
35-
}
36-
/***********************************/
37-
38-
li {
39-
margin-left: 1.5em;
40-
}
41-
42-
pre {
43-
font-family: monospace;
44-
}
45-
46-
p, pre, code.block {
47-
line-height: 1.25;
48-
}
49-
50-
h1 {
51-
font-size: 150%;
52-
}
53-
54-
h2 {
55-
font-size: 140%;
56-
}
57-
58-
h3 {
59-
font-size: 130%;
60-
}
61-
62-
h4 {
63-
font-size: 120%;
64-
}
65-
66-
h5 {
67-
font-size: 110%;
68-
}
69-
70-
h6 {
71-
font-size: 105%;
72-
}
73-
74-
header, div.main {
75-
margin-left: 4em;
76-
margin-right: 4em;
77-
max-width: 50em;
78-
}
2+
/**************************/
793

80-
header {
81-
margin-bottom: 1.5em;
4+
nav ol {
5+
display: flex;
6+
flex-wrap: wrap; /* Wrap to new lines on small screens */
7+
list-style: none;
8+
margin: 0;
9+
padding: 0;
10+
gap: 3rem;
8211
}
8312

84-
.main p, .main pre, .main code.block {
85-
margin-bottom: 0.5em;
13+
@media (max-width: 600px) {
14+
nav ol {
15+
flex-direction: column; /* Stack vertically on mobile */
16+
}
8617
}
8718

8819
div.metadata {
@@ -154,6 +85,12 @@ code {
15485

15586
/**************************/
15687

88+
.hl.lean.block {
89+
margin-bottom: 2.5rem; /* Match sakura.css's setting for block elements */
90+
}
91+
92+
/**************************/
93+
15794
.lexed.json .brace {
15895
color: #0000aa;
15996
}

0 commit comments

Comments
 (0)