- {{ contents }}
+ return html%{
+
+ {← selector id label active options}
+
+ {contents}
- }}
+ }
block_component +directive tabs' (name : String) (label : String) (sameSize : Bool) (active : Nat) (tabClasses : String) where
diff --git a/Lang/Components/Team.lean b/Lang/Components/Team.lean
index c8bcfb5..97395cc 100644
--- a/Lang/Components/Team.lean
+++ b/Lang/Components/Team.lean
@@ -5,7 +5,7 @@ import Lang.Components.Feature
open Verso Genre Blog
open Verso Doc Elab ArgParse
open Lean
-open Verso Output Html
+open Verso Output
open Template
namespace Lang
@@ -22,26 +22,26 @@ structure Member where
def team (member : Member) (showArea : Bool := false) : HtmlM Page Html := do
saveCss (include_str "../../static/css/team.css")
let webLink :=
- if let some link := member.link then {{
-
{{ Icon.link (fill := "var(--color-text)") (width := "18") }}
- }} else ""
+ if let some link := member.link then html%{
+
{Icon.link (fill := "var(--color-text)") (width := "18")}
+ } else ""
let role :=
- if let some role := member.role then {{
{{role}}
}} else ""
+ if let some role := member.role then html%{
{role}
} else ""
let area :=
- if let (true, some area) := (showArea, member.area) then {{
-
{{area}}
- }} else ""
- return {{
+ if let (true, some area) := (showArea, member.area) then html%{
+
{area}
+ } else ""
+ return html%{
-
+
-
{{member.name}} {{webLink}}
- {{role}}
- {{area}}
+
{member.name} {webLink}
+ {role}
+ {area}
- }}
+ }
diff --git a/Lang/Components/TeamData.lean b/Lang/Components/TeamData.lean
index fe74829..a3b8590 100644
--- a/Lang/Components/TeamData.lean
+++ b/Lang/Components/TeamData.lean
@@ -1,7 +1,7 @@
import VersoBlog
import Lang.Components.Team
-open Verso.Output Html
+open Verso.Output
open Lang Components
open Verso.Genre.Blog (Page)
@@ -136,13 +136,11 @@ block_component +directive teamDiv (whichTeam : String) where
let some (_, data) := teamData.find? (·.1 == whichTeam)
| Verso.reportError s!"Didn't find '{whichTeam}'"
return .empty
- return {{
+ return html%{
- {{
- ← data.mapM (Components.team (showArea := whichTeam == "areaMaintainers"))
- }}
+ {← data.mapM (Components.team (showArea := whichTeam == "areaMaintainers"))}
- }}
+ }
end Components
end Lang
diff --git a/Lang/Components/Title.lean b/Lang/Components/Title.lean
index 63734f8..29972c9 100644
--- a/Lang/Components/Title.lean
+++ b/Lang/Components/Title.lean
@@ -3,39 +3,39 @@ import Lean.Elab
import VersoBlog
open Verso Genre
-open Verso.Output Html
+open Verso.Output
open Verso.Genre.Blog Template
namespace Lang
namespace Components
def badge (content : String) : Html :=
- {{
+ html%{
- {{ content }}
+ {content}
- }}
+ }
def sectionTitle [MonadStateOf Component.State m] [Monad m] (tag : Option String) (title : String) (subtitle : Option Html) : m Html := do
- return {{
+ return html%{
- {{ tag <&> badge }}
-
{{title}}
- {{ subtitle <&> ({{
{{·}}
}})}}
+ {tag <&> badge}
+
{title}
+ {subtitle <&> (html%{
{·}
})}
- }}
+ }
block_component +directive sectionTitle' (tagg : Option String) (title : String) (subtitle : Option String) where
toHtml _ _ _ _ _ := sectionTitle tagg title subtitle
block_component +directive pageTitle (level : Nat) (title : String) where
toHtml _ _ _ _ _ := do
- return Html.tag s!"h{level}" #[("class", "page-title")] (.text true title)
+ return Lean.Html.element s!"h{level}" #[("class", "page-title")] (.text title)
block_component +directive header (level : Nat) (title : String) where
toHtml _ _ _ _ _ := do
- return Html.tag s!"h{level}" #[("id", Verso.Genre.Blog.slugifyTitle title)] (.text true title)
+ return Lean.Html.element s!"h{level}" #[("id", Verso.Genre.Blog.slugifyTitle title)] (.text title)
end Components
end Lang
diff --git a/Lang/Components/ZulipInfo.lean b/Lang/Components/ZulipInfo.lean
index d630610..5e30662 100644
--- a/Lang/Components/ZulipInfo.lean
+++ b/Lang/Components/ZulipInfo.lean
@@ -4,7 +4,7 @@ import VersoBlog
import Lang.Components.Icon
import Lang.Components.Title
-open Verso.Output Html
+open Verso.Output
open Verso.Genre.Blog Template
namespace Lang
@@ -15,16 +15,16 @@ block_component +directive zulipBanner where
cssFiles := #[("zulipCard.css", include_str "../../static/css/zulipCard.css")]
toHtml _ _ _ _ _ := do
- return {{
+ return html%{
-
+
-
"Connect with Lean experts!"
-
"The independently-run Lean Community Zulip chat is the central hub for everything Lean. Whether you are a new or experienced Lean user, it’s a welcoming place to ask questions, share ideas, and collaborate with other Lean users."
+
Connect with Lean experts!
+
The independently-run Lean Community Zulip chat is the central hub for everything Lean. Whether you are a new or experienced Lean user, it’s a welcoming place to ask questions, share ideas, and collaborate with other Lean users.
- "Visit Zulip"
+ Visit Zulip
- }}
+ }
end Components
end Lang
diff --git a/Lang/Features.lean b/Lang/Features.lean
index dced9d2..ae11ec1 100644
--- a/Lang/Features.lean
+++ b/Lang/Features.lean
@@ -85,7 +85,7 @@ where
else none
open Lean.Parser in
-open Verso.Output.Html in
+open Verso.Output in
open Lake.Toml in
@[code_block_expander toml]
partial def toml : CodeBlockExpander
@@ -106,14 +106,14 @@ partial def toml : CodeBlockExpander
let #[stx] := s.stxStack.toSubarray.toArray
| throwErrorAt str s!"Internal error parsing TOML - expected one result, got {s.stxStack.toSubarray.toArray}"
let html := highlightToml stx
- pure #[← ``(Block.other (BlockExt.htmlDiv "toml") #[Block.other (BlockExt.blob $(quote {{
{{html}} }})) #[]])]
+ pure #[← ``(Block.other (BlockExt.htmlDiv "toml") #[Block.other (BlockExt.blob $(quote html%{
{html} })) #[]])]
where
infoHtml : SourceInfo → Html → Html
| .original leading _ trailing _, html =>
- .text false leading.toString ++ html ++ .text false trailing.toString
+ .raw leading.toString ++ html ++ .raw trailing.toString
| _, html => html
- hl (cls : String) (html : Html) : Html := {{
{{html}} }}
+ hl (cls : String) (html : Html) : Html := html%{
{html} }
highlightToml : Syntax → Html
| .node info `null elts => infoHtml info <| elts.map highlightToml
@@ -129,7 +129,7 @@ where
| .node info ``Lake.Toml.basicString #[s@(.atom _ str)] =>
if let some str' := Lean.Syntax.decodeStrLit str then
if str'.take 8 == "https://" || str'.take 7 == "http://" then
- infoHtml info <| {{
{{highlightToml s}} }}
+ infoHtml info <| html%{
{highlightToml s} }
else
infoHtml info <| highlightToml s
else
@@ -150,8 +150,8 @@ where
| .node info ``Lake.Toml.decInt elts => infoHtml info <| hl "num" <| elts.map highlightToml
| .node info ``Lake.Toml.array elts => infoHtml info <| elts.map highlightToml
| .node info ``Lake.Toml.inlineTable elts => infoHtml info <| elts.map highlightToml
- | .atom info str => infoHtml info (.text true str)
- | other => {{ "Failed to highlight TOML (probably highlightToml in Lang.Features needs another pattern case): " {{toString other}} }}
+ | .atom info str => infoHtml info (.text str)
+ | other => html%{Failed to highlight TOML (probably highlightToml in Lang.Features needs another pattern case): {toString other}}
/--
@@ -162,14 +162,14 @@ def collapsedDetails : DirectiveExpander
| args, contents => do
let summary ← ArgParse.run (.positional `summary .string) args
let blocks ← contents.mapM elabBlock
- let summary ← ``(Block.other (BlockExt.blob (Html.tag "summary" #[] #[Html.text true $(quote summary)])) #[])
+ let summary ← ``(Block.other (BlockExt.blob (Lean.Html.element "summary" #[] #[Lean.Html.text $(quote summary)])) #[])
pure #[← ``(Block.other (BlockExt.htmlWrapper "details" #[]) #[$summary, $blocks,*])]
@[directive_expander TODO]
def TODO : DirectiveExpander
| _, contents => do
let blocks ← contents.mapM elabBlock
- let header ← ``(Block.other (BlockExt.blob (Html.tag "h3" #[] #[Html.text true "TODO"])) #[])
+ let header ← ``(Block.other (BlockExt.blob (Lean.Html.element "h3" #[] #[Lean.Html.text "TODO"])) #[])
pure #[← ``(Block.other (BlockExt.htmlWrapper "div" #[("class", "TODO")]) #[$header, $blocks,*])]
@[role_expander TODO]
@@ -231,7 +231,7 @@ define_lexed_text sh ← shHl
section
-open Verso.Output Html
+open Verso.Output
@[role_expander kbd]
@@ -245,10 +245,10 @@ def kbd : RoleExpander
if h : strs.size = 0 then throwError "Expected one or more inline code literals"
else
let basic := String.intercalate "+" strs.toList
- let mut keys := {{
{{strs[0]}} }}
+ let mut keys := html%{
{strs[0]} }
for s in strs.drop 1 do
- keys := keys ++ {{"+"
{{s}} }}
- let html : Html := {{
{{keys}} }}
+ keys := keys ++ html%{+
{s} }
+ let html : Html := html%{
{keys} }
return #[← ``(Inline.other (InlineExt.blob $(quote html)) #[Inline.code $(quote basic)])]
@@ -261,7 +261,7 @@ def color : RoleExpander
let `(inline|code( $s:str )) := str
| throwErrorAt str "Expected an inline code element"
let s := s.getString
- let html : Html := {{
{{s}}}}
+ let html : Html := html%{
{s}}
return #[← ``(Inline.other (InlineExt.blob $(quote html)) #[Inline.code $(quote s)])]
end
diff --git a/Lang/Meta/Svg.lean b/Lang/Meta/Svg.lean
index 3ded556..ec98683 100644
--- a/Lang/Meta/Svg.lean
+++ b/Lang/Meta/Svg.lean
@@ -1,7 +1,6 @@
import Lean
import Verso.Doc.Html
-open Verso.Output Html
open Lean Elab Term IO Meta PrettyPrinter Delaborator SubExpr
namespace Lang
@@ -13,9 +12,7 @@ elab "svg(" filePath: str ")" : term => do
let content ← FS.readFile filePath.getString
let env ← getEnv
- let .ok stx := Parser.runParserCategory env `html content
+ let .ok stx := Parser.runParserCategory env `term ("html%{" ++ content ++ "}") filePath.getString
| throwError "Failed to parse SVG file: {filePath.getString}"
- let stx := ⟨stx⟩
-
- elabTerm (← `({{ $stx }})) none
+ elabTerm stx none
diff --git a/Lang/Pages/404.lean b/Lang/Pages/404.lean
index e1fc5c2..f0f16eb 100644
--- a/Lang/Pages/404.lean
+++ b/Lang/Pages/404.lean
@@ -1,30 +1,30 @@
import VersoBlog
open Verso.Genre Blog Theme Template
-open Verso.Output Html
+open Verso.Output
-def notFound : Html := {{
+def notFound : Html := html%{
-
+
-
"Oops! Page not found"
+
Oops! Page not found
- "Looks like this page swam off into the digital ocean. Don’t worry, our hexapus has your back!"
+ Looks like this page swam off into the digital ocean. Don’t worry, our hexapus has your back!
-}}
+}
#doc (Page) "Not Found" =>
diff --git a/Lang/Pages/Contributing.lean b/Lang/Pages/Contributing.lean
index edf7800..44f3c8e 100644
--- a/Lang/Pages/Contributing.lean
+++ b/Lang/Pages/Contributing.lean
@@ -4,7 +4,7 @@ import Lang.Components.Container
import Lang.Components.ZulipInfo
open Verso.Genre Blog Theme Template
-open Verso.Output Html
+open Verso.Output
open Lang.Components
open Verso.Genre.Blog (Page)
diff --git a/Lang/Pages/FORM.lean b/Lang/Pages/FORM.lean
index f5defeb..688617b 100644
--- a/Lang/Pages/FORM.lean
+++ b/Lang/Pages/FORM.lean
@@ -1,19 +1,17 @@
import VersoBlog
import Lang.Components.Team
import Lang.Components.TeamData
-open Verso.Output Html
+open Verso.Output
open Lang Components
open Verso.Genre.Blog (Page)
block_component +directive formWebsite where
toHtml _id _json _goI _goB _contents := do
- return {{
+ return html%{
- "You can read more about FORM on "
- "FORM's official website"
- " (opens in another tab)."
+ You can read more about FORM on FORM's official website (opens in another tab).
- }}
+ }
#doc (Page) "FORM" =>
diff --git a/Lang/Pages/Governance.lean b/Lang/Pages/Governance.lean
index 2b1835b..d1b52b0 100644
--- a/Lang/Pages/Governance.lean
+++ b/Lang/Pages/Governance.lean
@@ -1,7 +1,7 @@
import VersoBlog
import Lang.Components.Team
import Lang.Components.TeamData
-open Verso.Output Html
+open Verso.Output
open Lang Components
open Verso.Genre.Blog (Page page_link)
diff --git a/Lang/Pages/Home.lean b/Lang/Pages/Home.lean
index 85c4d87..f7f4fe1 100644
--- a/Lang/Pages/Home.lean
+++ b/Lang/Pages/Home.lean
@@ -6,7 +6,7 @@ import Lang.Pages.Home.Sponsors
open Verso.Genre.Blog (Page)
open Verso.Genre Blog Theme Template
open Verso.Genre.Blog.Site.Syntax
-open Verso.Output Html
+open Verso.Output
open Verso.Genre.Blog
open Verso.Doc
open Lang.Components
diff --git a/Lang/Pages/Home/Hero.lean b/Lang/Pages/Home/Hero.lean
index 6c4f708..d5a8794 100644
--- a/Lang/Pages/Home/Hero.lean
+++ b/Lang/Pages/Home/Hero.lean
@@ -5,11 +5,11 @@ import Lean
import Lang.Components.Feature
import Lang.Components.CodeBlock
-open Verso.Output Html
+open Verso.Output
open Lang Components Icon
open Lean Elab Term
open Verso Genre Blog ArgParse Doc Elab
-open Verso.Output Html
+open Verso.Output
namespace Lang
namespace Page
@@ -19,47 +19,47 @@ block_component +directive hero where
cssFiles := #[("hero.css", include_str "../../../static/css/hero.css")]
toHtml _id _json _goI _goB _content := do
- return {{
+ return html%{
- {{ Icon.cslibLogo "var(--color-text)" (some 600) (some 240) (strokeWidth := 4) }}
+ {Icon.cslibLogo "var(--color-text)" (some 600) (some 240) (strokeWidth := 4)}
- "An open-source library of reusable components for proving theorems in computer science and writing formally verified code in the Lean programming language and proof assistant."
+ An open-source library of reusable components for proving theorems in computer science and writing formally verified code in the Lean programming language and proof assistant.
- --
"Why CSLib"
+
- {{ Icon.clock (fill := "var(--color-text)") }}
- "Formalized foundations of computer science"
- "Computational models, complexity, and core theory across many areas of CS."
- {{ Icon.link (fill := "var(--color-text)") }}
- "A toolkit for reasoning about programs"
- "Verify properties of your code, building on decades of deductive verification."
- {{ Icon.book (fill := "var(--color-text)") (some 25) }}
- "A repository of verified algorithms and data structures"
- "Reusable, machine-checked implementations you can build on."
- {{ Icon.activity (fill := "var(--color-text)") }}
- "A foundation for trustworthy AI"
- "A shared vocabulary to train models on."
+ {Icon.clock (fill := "var(--color-text)")}
+ Formalized foundations of computer science
+ Computational models, complexity, and core theory across many areas of CS.
+ {Icon.link (fill := "var(--color-text)")}
+ A toolkit for reasoning about programs
+ Verify properties of your code, building on decades of deductive verification.
+ {Icon.book (fill := "var(--color-text)") (some 25)}
+ A repository of verified algorithms and data structures
+ Reusable, machine-checked implementations you can build on.
+ {Icon.activity (fill := "var(--color-text)")}
+ A foundation for trustworthy AI
+ A shared vocabulary to train models on.
- }}
+ }
end Home
end Page
diff --git a/Lang/Pages/Home/Sponsors.lean b/Lang/Pages/Home/Sponsors.lean
index f65c089..80faa87 100644
--- a/Lang/Pages/Home/Sponsors.lean
+++ b/Lang/Pages/Home/Sponsors.lean
@@ -5,7 +5,7 @@ import Lang.Components.Icon
import Lang.Components.Title
import Lang.Components.Sponsor
-open Verso.Output Html
+open Verso.Output
open Lang Components Icon
namespace Lang
@@ -32,14 +32,14 @@ def sponsorsContent : Array Sponsor := #[
block_component +directive sponsors where
toHtml _ _ _ _ _ := do
let sponsors : Array Html ← sponsorsContent.mapM sponsor
- return {{
+ return html%{
- }}
+ }
cssFiles := #[
("title.css", include_str "../../../static/css/title.css"),
diff --git a/Lang/Pages/Initiative.lean b/Lang/Pages/Initiative.lean
index 447e45d..5d5b99b 100644
--- a/Lang/Pages/Initiative.lean
+++ b/Lang/Pages/Initiative.lean
@@ -7,7 +7,7 @@ import Lang.Pages.Initiative.Team
import Lang.Pages.Initiative.Roadmap
import Lang.Pages.Initiative.Contact
-open Verso.Output Html
+open Verso.Output
open Lang Components
open Verso.Genre.Blog (Page page_link)
diff --git a/Lang/Pages/Initiative/Contact.lean b/Lang/Pages/Initiative/Contact.lean
index c94cd32..2d6e633 100644
--- a/Lang/Pages/Initiative/Contact.lean
+++ b/Lang/Pages/Initiative/Contact.lean
@@ -1,7 +1,7 @@
import VersoBlog
import Lang.Components.Team
import Lang.Components.TeamData
-open Verso.Output Html
+open Verso.Output
open Lang Components
open Verso.Genre.Blog (Page)
diff --git a/Lang/Pages/Initiative/Team.lean b/Lang/Pages/Initiative/Team.lean
index f674dd2..5720ec9 100644
--- a/Lang/Pages/Initiative/Team.lean
+++ b/Lang/Pages/Initiative/Team.lean
@@ -1,7 +1,7 @@
import VersoBlog
import Lang.Components.Team
import Lang.Components.TeamData
-open Verso.Output Html
+open Verso.Output
open Lang Components
open Verso.Genre.Blog (Page page_link)
diff --git a/Lang/Pages/Publications.lean b/Lang/Pages/Publications.lean
index 248929e..294ae3d 100644
--- a/Lang/Pages/Publications.lean
+++ b/Lang/Pages/Publications.lean
@@ -2,9 +2,9 @@ import Verso.Doc.Elab
import VersoBlog
open Verso.Genre.Blog (Page blob)
-open Verso.Output Html
+open Verso.Output
-def li (elem : Html) : Html := {{
{{elem}} }}
+def li (elem : Html) : Html := html%{
{elem} }
structure Link where
name : String
@@ -13,7 +13,7 @@ structure Link where
def Link.pdf (url : String) : Link := ⟨"PDF", url⟩
def Link.toHtml (link : Link) : Html :=
- {{
{{link.name}} }}
+ html%{
{link.name} }
structure Author where
name : String
@@ -25,11 +25,11 @@ instance : Coe String Author where
def Author.toHtml (author : Author) : Html :=
match author.url with
| none => author.name
- | some u => {{
{{author.name}} }}
+ | some u => html%{
{author.name} }
def authorList : List Author → Html
| [] => .empty
- | authors => {{
{{authors.toArray.map (li <| ·.toHtml)}} }}
+ | authors => html%{
{authors.toArray.map (li <| ·.toHtml)} }
structure Publication where
title : String
@@ -38,13 +38,13 @@ structure Publication where
/-- Venue, etc -/
info : String
-def Publication.toHtml (pub : Publication) : Html := {{
+def Publication.toHtml (pub : Publication) : Html := html%{
- {{pub.title}} " "{{pub.links.toArray.map (li <| ·.toHtml)}}
- {{authorList pub.authors}}
- {{pub.info}}
+ {pub.title} {pub.links.toArray.map (li <| ·.toHtml)}
+ {authorList pub.authors}
+ {pub.info}
-}}
+}
namespace Authors
@@ -81,19 +81,15 @@ def pubs : Array Publication := #[
}
]
-def pubList : Html := {{
+def pubList : Html := html%{
- {{pubs.map (·.toHtml) |>.map li }}
+ {pubs.map (·.toHtml) |>.map li}
-}}
-
-def videoEmbed : Html := {{
-
VIDEO
-}}
+}
+
+def videoEmbed : Html := html%{
+
VIDEO
+}
#doc (Page) "News & Resources" =>
diff --git a/Lang/Pages/Roadmap.lean b/Lang/Pages/Roadmap.lean
index b36aab5..d4557d4 100644
--- a/Lang/Pages/Roadmap.lean
+++ b/Lang/Pages/Roadmap.lean
@@ -4,7 +4,7 @@ import Lang.Components.Container
import Lang.Components.ZulipInfo
open Verso.Genre Blog Theme Template
-open Verso.Output Html
+open Verso.Output
open Lang.Components
open Verso.Genre.Blog (Page)
diff --git a/Lang/Theme.lean b/Lang/Theme.lean
index 561f936..b581758 100644
--- a/Lang/Theme.lean
+++ b/Lang/Theme.lean
@@ -12,7 +12,7 @@ import Lang.Theme.Blog
import Lang.Theme.Links
import Lang.Theme.NavBar
-open Verso Genre Blog Template Output Doc Output Html Multi
+open Verso Genre Blog Template Output Doc Output Doc.Html Multi
open Lang Theme Components
namespace Lang
@@ -66,23 +66,23 @@ private def primaryTemplate (siteName : String) (extraHead : Html := .empty) : T
Template.saveCss (include_str "../static/css/noJS.css")
let path ← currentPath
- return {{
+ return html%{
- {{ ← head siteName config home extraHead (if path == #["404"] then some "/" else none) }}
+ {← head siteName config home extraHead (if path == #["404"] then some "/" else none)}
- {{ ← Components.noJSBar }}
+ {← Components.noJSBar}
- {{ ← param "content" }}
- {{ ← Components.footer }}
-
-
+ {← param "content"}
+ {← Components.footer}
+
+
- }}
+ }
/--
Templates that are basically pages with markdown content.
@@ -103,31 +103,31 @@ private def markdownPageTemplate : TemplateM Html := do
then "post-grid"
else "post-center"
- let sectionTitle := {{
+ let sectionTitle := html%{
- {{ ← param "title"}}
+ {← param "title"}
- }}
+ }
let postList :=
match (← param? "posts") with
| none => Html.empty
| some html => html
- return {{
-
-
+ return html%{
+
+
- {{ if needsTitle path then sectionTitle else .empty }}
- {{ if isUseCases path then {{
{{ postList }}
}} else postList }}
- {{ addSlug content }}
+ {if needsTitle path then sectionTitle else .empty}
+ {if isUseCases path then html%{
{postList}
} else postList}
+ {addSlug content}
- {{ if indexPage path then aside title <$> nav else .empty }}
+ {if indexPage path then aside title <$> nav else .empty}
- }}
+ }
/--
Pages that have a free design with a lot of custom components, like the home page.
@@ -137,14 +137,14 @@ private def freePageTemplate : TemplateM Html := do
let postList :=
match (← param? "posts") with
| none => Html.empty
- | some html => {{
}}
+ | some html => html%{
}
- return {{
+ return html%{
- {{ ← param "content" }}
- {{ postList }}
+ {← param "content"}
+ {postList}
- }}
+ }
/--
Templates for common pages.
@@ -160,16 +160,16 @@ private def pageTemplate : TemplateM Html := do
Template for category pages, which list posts in a category.
-/
private def categoryTemplate : TemplateM Html := do
- return {{
-
+ return html%{
+
- {{ ← param "title"}}
+ {← param "title"}
- {{ (← param? "posts" : Option Html) }}
+ {(← param? "posts" : Option Html)}
- }}
+ }
/--
The final theme definition for Verso with custom templates.
diff --git a/Lang/Theme/Blog.lean b/Lang/Theme/Blog.lean
index 4c07e9b..afea82e 100644
--- a/Lang/Theme/Blog.lean
+++ b/Lang/Theme/Blog.lean
@@ -7,8 +7,8 @@ import Lang.Components.ArchiveEntry
open Lang Components
open Verso Genre Blog Template
-open Verso Output Html
-open Verso Doc Output Html HtmlT FS
+open Verso Output
+open Verso Doc Output Doc.Html HtmlT FS
namespace Lang
@@ -23,23 +23,24 @@ def archiveEntry : Template := do
return #[Components.archiveEntry target post.contents.metadata post.contents.titleString summary none]
partial def removeWrapper : Html → String
- | .text _ s => s
- | .tag _ _ h => removeWrapper h
+ | .text s | .raw s => s
+ | .element _ _ h => removeWrapper h
| .seq hs => String.intercalate " " (hs.toList.map removeWrapper)
partial def addSlug : Html → Html
- | .text s e => .text s e
- | .tag t a h =>
+ | .text s => .text s
+ | .raw s => .raw s
+ | .element t a h =>
match t with
- | "h1" | "h2" | "h3" | "h4" => .tag t (a.push ("id", createSlug (removeWrapper h))) h
- | _ => .tag t a (addSlug h)
+ | "h1" | "h2" | "h3" | "h4" => .element t (a.push ("id", createSlug (removeWrapper h))) h
+ | _ => .element t a (addSlug h)
| .seq h => .seq (h.map addSlug)
partial def collectH1 (html : Html) (linkPrefix : String := "") : Option Html :=
let res := (collect [] html |>.reverse)
if ¬ res.isEmpty then
let (html, _) := compact 2 res
- Html.tag "ol" #[] #[Html.seq (html.toArray |>.map (Html.tag "li" #[]))]
+ Lean.Html.element "ol" #[] #[Html.seq (html.toArray |>.map (Lean.Html.element "li" #[]))]
else
none
where
@@ -51,8 +52,8 @@ partial def collectH1 (html : Html) (linkPrefix : String := "") : Option Html :=
| _ => 0
collect (col : List (Nat × String)) : Html → List (Nat × String)
- | .text _ _ => col
- | .tag t _ h =>
+ | .text _ | .raw _ => col
+ | .element t _ h =>
match t with
| "h1" | "h2" | "h3" | "h4" => (getLevel t, removeWrapper h) :: col
| _ => collect col h
@@ -62,10 +63,10 @@ partial def collectH1 (html : Html) (linkPrefix : String := "") : Option Html :=
| (level, str) :: xs =>
if level = current then
let slug := createSlug str
- let headingLink := Html.tag "a" #[("href", s!"{linkPrefix}#{slug}")] #[Html.text false str]
+ let headingLink := Lean.Html.element "a" #[("href", s!"{linkPrefix}#{slug}")] #[Lean.Html.raw str]
let (children, remaining) := compactChildren (level + 1) xs
- let item := if children.isEmpty then headingLink else Html.seq #[headingLink, Html.tag "ol" #[] (Html.seq children.toArray)]
+ let item := if children.isEmpty then headingLink else Html.seq #[headingLink, Lean.Html.element "ol" #[] (Html.seq children.toArray)]
let (siblings, final) := compact level remaining
(item :: siblings, final)
@@ -80,7 +81,7 @@ partial def collectH1 (html : Html) (linkPrefix : String := "") : Option Html :=
if level >= minLevel then
let (item, remaining) := compact level ((level, str) :: xs)
let (siblings, final) := compactChildren minLevel remaining
- (item.map (Html.tag "li" #[]) ++ siblings, final)
+ (item.map (Lean.Html.element "li" #[]) ++ siblings, final)
else
([], (level, str) :: xs)
| [] => ([], [])
@@ -90,46 +91,42 @@ def postTemplate : Template := do
let nav := collectH1 content
let metadata ← param? "metadata"
- pure {{
-
-
-
>= (Post.Meta.htmlId)) |>.getD "post"}}>
- {{← param "title"}}
- {{ match metadata with
+ pure html%{
+
+
+
>= (Post.Meta.htmlId)) |>.getD "post"}>
+ {← param "title"}
+ {match metadata with
| none => Html.empty
- | some md => {{
+ | some md => html%{
}}
- }}
- {{ addSlug content }}
+ {addSlug content}
- {{
- if let some nav := nav then
- {{
+ {if let some nav := nav then
+ html%{
- {{← param "title"}}
+ {← param "title"}
- {{ nav }}
+ {nav}
- }}
+ }
else
- .empty
- }}
+ .empty}
- }}
+ }
diff --git a/Lang/Theme/Head.lean b/Lang/Theme/Head.lean
index 864732c..05cc732 100644
--- a/Lang/Theme/Head.lean
+++ b/Lang/Theme/Head.lean
@@ -5,7 +5,7 @@ import Lang.Components.Basic
import Lang.Components.Icon
open Verso.Genre Blog Template
-open Verso.Output Html
+open Verso.Output
namespace Lang
namespace Theme
@@ -55,20 +55,20 @@ structure SocialMeta where
articleCreator : String
def SocialMeta.toHtml (data : SocialMeta) : Html :=
- {{
-
-
-
-
-
-
-
-
-
-
-
+ html%{
+
+
+
+
+
+
+
+
+
+
+
- }}
+ }
/--
The configuration for the head of a page.
@@ -103,12 +103,12 @@ structure HeadConfig where
Builds the HTML for a head config.
-/
def HeadConfig.toHtml (data : HeadConfig) : Html :=
- {{
-
-
-
-
- }}
+ html%{
+
+
+
+
+ }
/--
Builds the HTML for the head of a page.
@@ -117,25 +117,23 @@ def head (siteName : String) (config : HeadConfig) (social : Option SocialMeta :
let title ← param (α := String) "title"
let page ← currentPath
- return {{
+ return html%{
- {{ base.map ({{ }}) }}
+ {base.map (html%{ })}
- {{
- if page == .root
- then {{ "A Focused Effort on Formalizing Computer Science in Lean" }}
- else {{ {{ title }} s!" — {siteName} " }}
- }}
+ {if page == .root
+ then html%{A Focused Effort on Formalizing Computer Science in Lean }
+ else html%{{title}{s!" — {siteName} "} }}
- {{ HeadConfig.toHtml config }}
- {{ SocialMeta.toHtml <$> social |>.getD .empty }}
+ {HeadConfig.toHtml config}
+ {SocialMeta.toHtml <$> social |>.getD .empty}
-
-
-
+
+
+
@@ -147,11 +145,11 @@ def head (siteName : String) (config : HeadConfig) (social : Option SocialMeta :
- {{ extraHead }}
- {{ ← builtinHeader }}
+ {extraHead}
+ {← builtinHeader}
- }}
+ }
end Theme
end Lang
diff --git a/Lang/Theme/Links.lean b/Lang/Theme/Links.lean
index cfd61be..5f2ba37 100644
--- a/Lang/Theme/Links.lean
+++ b/Lang/Theme/Links.lean
@@ -5,7 +5,7 @@ import Lang.Components.NavBar
import Lang.Theme.Head
open Verso.Genre Blog
-open Verso.Output Html
+open Verso.Output
open Lang
namespace Lang
diff --git a/Lang/Theme/NavBar.lean b/Lang/Theme/NavBar.lean
index 8e593c6..fe1530f 100644
--- a/Lang/Theme/NavBar.lean
+++ b/Lang/Theme/NavBar.lean
@@ -7,7 +7,7 @@ import Lang.Theme.Head
import Lang.Theme.Links
open Verso.Genre Blog
-open Verso.Output Html
+open Verso.Output
open Lang Components
open Verso.Multi
diff --git a/lake-manifest.json b/lake-manifest.json
index 6d49f2e..a6d4801 100644
--- a/lake-manifest.json
+++ b/lake-manifest.json
@@ -5,17 +5,17 @@
"type": "git",
"subDir": null,
"scope": "",
- "rev": "fce722add64077cc9770bf9a487225a4894d5eb3",
+ "rev": "6674cf83c82a2c260bf5827d44e58f26568f7cbe",
"name": "verso",
"manifestFile": "lake-manifest.json",
- "inputRev": "main",
+ "inputRev": "v4.36.0",
"inherited": false,
"configFile": "lakefile.lean"},
{"url": "https://github.com/leanprover/lean4-cli",
"type": "git",
"subDir": null,
"scope": "",
- "rev": "843844fa601dd56767b1eb22b7ada5b64d5e567a",
+ "rev": "50810f72af7618bee62fe9800dc26e806c188703",
"name": "Cli",
"manifestFile": "lake-manifest.json",
"inputRev": "main",
@@ -25,7 +25,7 @@
"type": "git",
"subDir": null,
"scope": "",
- "rev": "af451aaa73d8f8025189f228642b6e4fe047ce4f",
+ "rev": "d140dc15f1846fff460118098419154bf6989717",
"name": "illuminate",
"manifestFile": "lake-manifest.json",
"inputRev": "main",
@@ -35,7 +35,7 @@
"type": "git",
"subDir": null,
"scope": "",
- "rev": "fb13df72ecefd8ddbf9291021d7f33a8673eb57b",
+ "rev": "054b228ce0ac61d767c6e71ba73a24728f191b72",
"name": "plausible",
"manifestFile": "lake-manifest.json",
"inputRev": "main",
@@ -55,7 +55,7 @@
"type": "git",
"subDir": null,
"scope": "",
- "rev": "acbaca235b6f905c2ae90c1be2aa62da7014178c",
+ "rev": "f9c40d40521bc71f0c33bff422d085dd86d359bd",
"name": "subverso",
"manifestFile": "lake-manifest.json",
"inputRev": "main",
diff --git a/lakefile.lean b/lakefile.lean
index 13d146a..561ac24 100644
--- a/lakefile.lean
+++ b/lakefile.lean
@@ -1,7 +1,7 @@
import Lake
open Lake DSL
-require verso from git "https://github.com/leanprover/verso"@"main"
+require verso from git "https://github.com/leanprover/verso"@"v4.36.0"
package cslibwebsite where
moreLeancArgs := #["-O0"]
diff --git a/lean-toolchain b/lean-toolchain
index f0e00b3..00f8483 100644
--- a/lean-toolchain
+++ b/lean-toolchain
@@ -1 +1 @@
-leanprover/lean4:v4.35.0-rc3
+leanprover/lean4:v4.36.0