Skip to content

Commit ee1b0d5

Browse files
Merge remote-tracking branch 'upstream/main' into docgen-dump-docstrings
2 parents fc90e29 + ddb8dbc commit ee1b0d5

15 files changed

Lines changed: 143 additions & 43 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ jobs:
196196

197197
- name: Upload docs to artifact storage
198198
if: github.ref_type != 'tag' && github.ref != 'refs/heads/main'
199-
uses: actions/upload-artifact@v6
199+
uses: actions/upload-artifact@v7
200200
with:
201201
name: "Verso manual (PDF and HTML)"
202202
path: |
@@ -235,7 +235,7 @@ jobs:
235235
236236
- name: Upload HTML manual for PR deployment
237237
if: github.event_name == 'pull_request'
238-
uses: actions/upload-artifact@v6
238+
uses: actions/upload-artifact@v7
239239
with:
240240
name: html-manual-for-deploy
241241
path: _out/html-multi
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Check PR title follows commit convention
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, reopened]
6+
merge_group:
7+
8+
jobs:
9+
check-pr-title:
10+
name: "PR title follows commit convention"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check PR title
14+
uses: actions/github-script@v8
15+
with:
16+
script: |
17+
let title;
18+
if (context.eventName === 'merge_group') {
19+
// The merge commit message's first line is the commit subject
20+
title = context.payload.merge_group.head_commit.message.split('\n')[0];
21+
} else {
22+
title = context.payload.pull_request.title;
23+
}
24+
25+
const types = ['feat', 'fix', 'doc', 'style', 'refactor', 'test', 'chore', 'perf'];
26+
const typePattern = types.join('|');
27+
const regex = new RegExp(`^(${typePattern}): .+$`);
28+
29+
const errors = [];
30+
31+
if (!regex.test(title)) {
32+
errors.push(`PR title does not match the required format: \`<type>: <subject>\``);
33+
errors.push(`Allowed types: ${types.join(', ')}`);
34+
errors.push(`Example: \`fix: correct typo in documentation\``);
35+
errors.push(`Example: \`feat: add RSS feed support\``);
36+
} else {
37+
// Extract subject (part after ": ")
38+
const colonIndex = title.indexOf(': ');
39+
const subject = title.substring(colonIndex + 2);
40+
41+
if (/^[A-Z]/.test(subject)) {
42+
errors.push(`Subject must not start with a capital letter: \`${subject}\``);
43+
}
44+
45+
if (subject.endsWith('.')) {
46+
errors.push(`Subject must not end with a period: \`${subject}\``);
47+
}
48+
}
49+
50+
if (errors.length > 0) {
51+
const message = [
52+
'PR title does not follow the commit convention.',
53+
'',
54+
`Title: \`${title}\``,
55+
'',
56+
...errors.map(e => `- ${e}`),
57+
'',
58+
'Format: `<type>: <subject>`',
59+
].join('\n');
60+
core.setFailed(message);
61+
} else {
62+
core.info(`PR title is valid: ${title}`);
63+
}

.github/workflows/pr-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
sourceRunId: ${{ github.event.workflow_run.id }}
2727

2828
- name: Download HTML manual artifact
29-
uses: dawidd6/action-download-artifact@v15
29+
uses: dawidd6/action-download-artifact@v16
3030
with:
3131
run_id: ${{ github.event.workflow_run.id }}
3232
name: html-manual-for-deploy

doc/UsersGuide/Releases.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Author: Emilio J. Gallego Arias
66

77
import VersoManual
88

9-
import UsersGuide.Releases.«v4_29_0_rc2»
9+
import UsersGuide.Releases.«v4_29_0»
1010
import UsersGuide.Releases.«v4_28_0»
1111

1212
open Verso Genre Manual
@@ -27,5 +27,5 @@ Verso versioning follows Lean's.
2727
This means that we release a new version for each Lean release, usually once per month.
2828
In particular, note that Verso doesn't follow the [semantic versioning model](https://semver.org/).
2929

30-
{include 0 UsersGuide.Releases.«v4_29_0_rc2»}
30+
{include 0 UsersGuide.Releases.«v4_29_0»}
3131
{include 0 UsersGuide.Releases.«v4_28_0»}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ open Verso.Genre
1111
-- To allow ```` below
1212
set_option linter.verso.markup.codeBlock false
1313

14-
#doc (Manual) "Verso 4.29.0-rc2 (unreleased)" =>
14+
#doc (Manual) "Verso 4.29.0 (unreleased)" =>
1515
%%%
16-
tag := "release-v4.29.0-rc2"
17-
file := "v4.29.0-rc2"
16+
tag := "release-v4.29.0"
17+
file := "v4.29.0"
1818
%%%
1919

20-
* [fix: Verso folding ranges / TOC for Lean.Doc syntax and #doc](https://github.com/leanprover/verso/pull/768)
20+
* Fix Verso folding ranges / TOC for Lean.Doc syntax and #doc (#768)
21+
* Align Blog inline Lean role naming with Manual; add `{lean}` and deprecate `{leanInline}` (#762)

lake-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"type": "git",
3636
"subDir": null,
3737
"scope": "",
38-
"rev": "361b8036c32b1cc18223b295c1e30bbd094688ad",
38+
"rev": "3f5c2d5f84f7575a01b6d92916f4e914cefff51d",
3939
"name": "subverso",
4040
"manifestFile": "lake-manifest.json",
4141
"inputRev": "main",

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:v4.29.0-rc1
1+
leanprover/lean4:v4.29.0-rc2

src/tests/Tests/VersoBlog.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,23 @@ example : base = 40 := rfl
8585
```lean post +error
8686
#check scratch
8787
```
88+
89+
-- Regression test for inline Lean role naming in Blog:
90+
-- canonical `{lean}` works without warnings.
91+
#docs (Post) inlineLeanRoleNames "Inline Lean Role Names" :=
92+
```leanInit post
93+
```
94+
95+
Canonical role: {lean post}`Nat.succ 1`.
96+
97+
/--
98+
warning: `{leanInline}` is deprecated; use `{lean}` instead.
99+
-/
100+
#docs (Post) inlineLeanRoleNamesDeprecated "Inline Lean Role Names (deprecated alias)" :=
101+
```leanInit post2
102+
```
103+
104+
Legacy role: {leanInline post2}`Nat.succ 1`.
105+
106+
#guard inlineLeanRoleNames.toPart.content.size > 0
107+
#guard inlineLeanRoleNamesDeprecated.toPart.content.size > 0

src/verso-blog/VersoBlog.lean

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,7 @@ where
599599
modifyInfoState fun s => { s with trees := f s.trees }
600600

601601
open SubVerso.Highlighting Highlighted in
602-
@[role]
603-
def leanInline : RoleExpanderOf LeanInlineConfig
602+
private def leanInlineImpl : RoleExpanderOf LeanInlineConfig
604603
| config, elts => withTraceNode `Elab.Verso.block.lean (fun _ => pure m!"lean block") <| do
605604
let #[code] := elts
606605
| throwError "Expected precisely one code element"
@@ -675,6 +674,19 @@ def leanInline : RoleExpanderOf LeanInlineConfig
675674

676675
`(Inline.other (Blog.InlineExt.highlightedCode { contextName := $(quote config.exampleContext.getId) } $(quote hls)) #[Inline.code $(quote str.getString)])
677676

677+
@[role lean]
678+
def leanCanonical : RoleExpanderOf LeanInlineConfig :=
679+
leanInlineImpl
680+
681+
@[role]
682+
def leanInline : RoleExpanderOf LeanInlineConfig
683+
| config, elts => do
684+
if h : 0 < elts.size then
685+
logWarningAt elts[0] "`{leanInline}` is deprecated; use `{lean}` instead."
686+
else
687+
logWarning "`{leanInline}` is deprecated; use `{lean}` instead."
688+
leanInlineImpl config elts
689+
678690
open Lean.Elab.Tactic.GuardMsgs
679691
export WhitespaceMode (exact lax normalized)
680692

src/verso-blog/VersoBlog/Component.lean

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -275,19 +275,21 @@ elab_rules : command
275275
let dirName := x.getId ++ `directive |> mkIdentFrom x
276276
let (toHtml?, other) ← splitToHtml contents
277277
let noJson ← argNames.mapM deJson
278-
let arr : TSyntax `Lean.Parser.Term.doSeqItem ←
279-
if !argNames.isEmpty then
280-
`(Lean.Parser.Term.doSeqItem|
281-
let .arr #[$(argNames.map (·.1)),*] := json
282-
| HtmlT.logError s!"Expected array, got {json}"
283-
return .empty)
284-
else `(Lean.Parser.Term.doSeqItem|pure ())
285278
let toHtml ← toHtml?.mapM fun tm =>
286-
`(Lean.Parser.Term.structInstField|
287-
toHtml id json goI goB contents := do
288-
$arr
289-
$noJson*
290-
($tm id json goI goB contents))
279+
if argNames.isEmpty then
280+
`(Lean.Parser.Term.structInstField|
281+
toHtml id json goI goB contents := do
282+
($tm id json goI goB contents))
283+
else
284+
`(Lean.Parser.Term.structInstField|
285+
toHtml id json goI goB contents := do
286+
match json with
287+
| .arr #[$(argNames.map (·.1)),*] => do
288+
$noJson*
289+
($tm id json goI goB contents)
290+
| _ => do
291+
HtmlT.logError s!"Expected array, got {json}"
292+
return .empty)
291293
let other := toHtml.toArray ++ other
292294
let cmd2 ←
293295
`(command|
@@ -325,19 +327,21 @@ elab_rules : command
325327
let compName := x.getId ++ `comp |> mkIdentFrom x
326328
let (toHtml?, other) ← splitToHtml contents
327329
let noJson ← argNames.mapM deJson
328-
let arr : TSyntax `Lean.Parser.Term.doSeqItem ←
329-
if !argNames.isEmpty then
330-
`(Lean.Parser.Term.doSeqItem|
331-
let .arr #[$(argNames.map (·.1)),*] := json
332-
| HtmlT.logError s!"Expected array, got {json}"
333-
return .empty)
334-
else `(Lean.Parser.Term.doSeqItem|pure ())
335330
let toHtml ← toHtml?.mapM fun tm =>
336-
`(Lean.Parser.Term.structInstField|
337-
toHtml id json goI contents := do
338-
$arr
339-
$noJson*
340-
($tm id json goI contents))
331+
if argNames.isEmpty then
332+
`(Lean.Parser.Term.structInstField|
333+
toHtml id json goI contents := do
334+
($tm id json goI contents))
335+
else
336+
`(Lean.Parser.Term.structInstField|
337+
toHtml id json goI contents := do
338+
match json with
339+
| .arr #[$(argNames.map (·.1)),*] => do
340+
$noJson*
341+
($tm id json goI contents)
342+
| _ => do
343+
HtmlT.logError s!"Expected array, got {json}"
344+
return .empty)
341345
let other := toHtml.toArray ++ other
342346
let cmd2 ←
343347
`(command|

0 commit comments

Comments
 (0)