diff --git a/doc/UsersGuide/Output/HTML.lean b/doc/UsersGuide/Output/HTML.lean index adb7d31ec..6658954b7 100644 --- a/doc/UsersGuide/Output/HTML.lean +++ b/doc/UsersGuide/Output/HTML.lean @@ -15,6 +15,7 @@ open InlineLean open Verso.Doc open Verso.Output +open Lean (Html) open Verso.Code @@ -26,23 +27,21 @@ tag := "output-html" While most users of Verso don't need to worry about the specific details of the HTML that it produces, authors of new {tech}[genres] or of substantial extensions to existing genres may need to produce custom HTML. Verso's HTML output follows a number of conventions and uses built-in libraries and features. -Verso's {name}`Html` type represents HTML documents. -They are typically produced using an embedded DSL that is available when the namespace `Verso.Output.Html` is opened. +Lean's {name}`Html` type represents HTML documents. +In Verso, they are typically produced using an embedded DSL that is available when the namespace `Verso.Output.Html` is opened. {docstring Html} {docstring Html.empty} -{docstring Html.fromArray} +{docstring Html.ofArray} -{docstring Html.fromList} +{docstring Html.ofList} {docstring Html.append} {docstring Html.visitM} -{docstring Html.format} - {docstring Html.asString} HTML documents are written in double curly braces, in a syntax very much like HTML itself. diff --git a/doc/UsersGuide/Websites.lean b/doc/UsersGuide/Websites.lean index 116214076..57e48a79a 100644 --- a/doc/UsersGuide/Websites.lean +++ b/doc/UsersGuide/Websites.lean @@ -63,7 +63,7 @@ The URL layout of a site is specified via a {name Blog.Site}`Site`: These are usually constructed using a small embedded configuration language. A blog is rendered using a theme, which is a collection of templates. -Templates are monadic functions that construct {name Verso.Output.Html}`Html` from a set of dynamically-typed parameters. +Templates are monadic functions that construct {name Lean.Html}`Html` from a set of dynamically-typed parameters. {docstring Blog.Theme} diff --git a/lean-toolchain b/lean-toolchain index b8f3deceb..3bfd46501 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-08-27 +leanprover/lean4-pr-releases:pr-release-14935-6b54eee diff --git a/src/tests/Tests/GenericCode.lean b/src/tests/Tests/GenericCode.lean index 478481550..4592ee280 100644 --- a/src/tests/Tests/GenericCode.lean +++ b/src/tests/Tests/GenericCode.lean @@ -44,21 +44,21 @@ info: Verso.Doc.Part.mk #guard_msgs in #eval code1.toPart /-- -info: Verso.Output.Html.tag +info: Lean.Html.element "section" #[] - (Verso.Output.Html.seq - #[Verso.Output.Html.tag "h1" #[] (Verso.Output.Html.seq #[Verso.Output.Html.text true "More writing"]), - Verso.Output.Html.tag + (Lean.Html.seq + #[Lean.Html.element "h1" #[] (Lean.Html.seq #[Lean.Html.text "More writing"]), + Lean.Html.element "section" #[] - (Verso.Output.Html.seq - #[Verso.Output.Html.tag "h2" #[] (Verso.Output.Html.seq #[Verso.Output.Html.text true "Section 1"]), - Verso.Output.Html.tag "p" #[] (Verso.Output.Html.seq #[Verso.Output.Html.text true "Here's some code"]), - Verso.Output.Html.tag + (Lean.Html.seq + #[Lean.Html.element "h2" #[] (Lean.Html.seq #[Lean.Html.text "Section 1"]), + Lean.Html.element "p" #[] (Lean.Html.text "Here's some code"), + Lean.Html.element "pre" #[] - (Verso.Output.Html.text true "(define (zero f z) z)\n(define (succ n) (lambda (f x) (f (n f z))))\n")])]) + (Lean.Html.text "(define (zero f z) z)\n(define (succ n) (lambda (f x) (f (n f z))))\n")])]) -/ #guard_msgs in #eval Doc.Genre.none.toHtml (m := Id) {} () () {} {} {} code1.toPart |>.run .empty |>.fst diff --git a/src/tests/Tests/HoverMerge.lean b/src/tests/Tests/HoverMerge.lean index 43fb72a39..a536a4e98 100644 --- a/src/tests/Tests/HoverMerge.lean +++ b/src/tests/Tests/HoverMerge.lean @@ -10,7 +10,8 @@ meta import SubVerso.Highlighting open SubVerso.Highlighting (Highlighted) open Verso.Code (takeAttrs) -open Verso.Output (Html) +open Verso.Output +open Lean (Html) namespace Verso.HoverMergeTest @@ -20,64 +21,64 @@ shares the token's extent: `Highlighted.normalize` makes the sole-token shape re and `takeAttrs` moves the token's hover attributes up to the span. -/ -def tok : Html := .tag "span" #[("class", "token"), ("data-verso-hover", "5")] (.text true "x") -def tokNoHover : Html := .tag "span" #[("class", "token")] (.text true "x") +def tok : Html := .element "span" #[("class", "token"), ("data-verso-hover", "5")] (.text "x") +def tokNoHover : Html := .element "span" #[("class", "token")] (.text "x") -- The attribute is taken from a bare element. #guard takeAttrs #["data-verso-hover"] tok == (#[("data-verso-hover", "5")], tokNoHover) -- The attribute is found through a wrapping element, such as a link. -#guard takeAttrs #["data-verso-hover"] (.tag "a" #[("href", "x.html")] tok) == - (#[("data-verso-hover", "5")], .tag "a" #[("href", "x.html")] tokNoHover) +#guard takeAttrs #["data-verso-hover"] (.element "a" #[("href", "x.html")] tok) == + (#[("data-verso-hover", "5")], .element "a" #[("href", "x.html")] tokNoHover) -- Attributes are gathered across the wrappers of a sole element: the hover from the token -- and the extra links from the link element around it. #guard takeAttrs #["data-verso-hover", "data-verso-links"] - (.tag "a" #[("data-verso-links", "[]")] tok) == - (#[("data-verso-links", "[]"), ("data-verso-hover", "5")], .tag "a" #[] tokNoHover) + (.element "a" #[("data-verso-links", "[]")] tok) == + (#[("data-verso-links", "[]"), ("data-verso-hover", "5")], .element "a" #[] tokNoHover) -- Only the attributes that are present appear in the result. #guard takeAttrs #["data-verso-hover", "data-verso-links"] - (.tag "a" #[("data-verso-links", "[]")] tokNoHover) == - (#[("data-verso-links", "[]")], .tag "a" #[] tokNoHover) + (.element "a" #[("data-verso-links", "[]")] tokNoHover) == + (#[("data-verso-links", "[]")], .element "a" #[] tokNoHover) def tokLinked : Html := - .tag "span" #[("class", "token"), ("data-verso-hover", "5"), ("data-verso-links", "[2]")] - (.text true "x") + .element "span" #[("class", "token"), ("data-verso-hover", "5"), ("data-verso-links", "[2]")] + (.text "x") -- Each attribute is taken from the outermost element that carries it, and repeats on -- elements nested inside stay in place. #guard takeAttrs #["data-verso-hover", "data-verso-links"] - (.tag "a" #[("data-verso-hover", "9")] tokLinked) == + (.element "a" #[("data-verso-hover", "9")] tokLinked) == (#[("data-verso-hover", "9"), ("data-verso-links", "[2]")], - .tag "a" #[] (.tag "span" #[("class", "token"), ("data-verso-hover", "5")] (.text true "x"))) + .element "a" #[] (.element "span" #[("class", "token"), ("data-verso-hover", "5")] (.text "x"))) #guard takeAttrs #["data-verso-hover", "data-verso-links"] - (.tag "a" #[("data-verso-links", "[1]")] tokLinked) == + (.element "a" #[("data-verso-links", "[1]")] tokLinked) == (#[("data-verso-links", "[1]"), ("data-verso-hover", "5")], - .tag "a" #[] (.tag "span" #[("class", "token"), ("data-verso-links", "[2]")] (.text true "x"))) + .element "a" #[] (.element "span" #[("class", "token"), ("data-verso-links", "[2]")] (.text "x"))) -- The outermost attribute wins, and inner ones are left in place. -#guard takeAttrs #["data-verso-hover"] (.tag "a" #[("data-verso-hover", "9")] tok) == - (#[("data-verso-hover", "9")], .tag "a" #[] tok) +#guard takeAttrs #["data-verso-hover"] (.element "a" #[("data-verso-hover", "9")] tok) == + (#[("data-verso-hover", "9")], .element "a" #[] tok) -- Empty content around a sole element does not block the search. -#guard takeAttrs #["data-verso-hover"] (.seq #[.text true "", tok, .seq #[]]) == +#guard takeAttrs #["data-verso-hover"] (.seq #[.text "", tok, .seq #[]]) == (#[("data-verso-hover", "5")], tokNoHover) -- Adjacent content blocks the search, including whitespace. -#guard takeAttrs #["data-verso-hover"] (.seq #[tok, .text true "y"]) == - (#[], .seq #[tok, .text true "y"]) +#guard takeAttrs #["data-verso-hover"] (.seq #[tok, .text "y"]) == + (#[], .seq #[tok, .text "y"]) #guard takeAttrs #["data-verso-hover"] (.seq #[tok, tokNoHover]) == (#[], .seq #[tok, tokNoHover]) -#guard takeAttrs #["data-verso-hover"] (.seq #[.text true " ", tok]) == - (#[], .seq #[.text true " ", tok]) +#guard takeAttrs #["data-verso-hover"] (.seq #[.text " ", tok]) == + (#[], .seq #[.text " ", tok]) -- Adjacent content inside a wrapper blocks the search. -#guard takeAttrs #["data-verso-hover"] (.tag "a" #[] (.seq #[tok, tokNoHover])) == - (#[], .tag "a" #[] (.seq #[tok, tokNoHover])) +#guard takeAttrs #["data-verso-hover"] (.element "a" #[] (.seq #[tok, tokNoHover])) == + (#[], .element "a" #[] (.seq #[tok, tokNoHover])) -- Content without the attributes is unchanged. #guard takeAttrs #["data-verso-hover"] tokNoHover == (#[], tokNoHover) -#guard takeAttrs #["data-verso-hover"] (.text true "x") == (#[], .text true "x") +#guard takeAttrs #["data-verso-hover"] (.text "x") == (#[], .text "x") #guard takeAttrs #["data-verso-hover"] (.seq #[]) == (#[], .seq #[]) def hlTok : Highlighted := .token ⟨.keyword none none none, "rfl"⟩ diff --git a/src/tests/Tests/Html.lean b/src/tests/Tests/Html.lean index 515cd0150..3de647da0 100644 --- a/src/tests/Tests/Html.lean +++ b/src/tests/Tests/Html.lean @@ -4,11 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Author: David Thrane Christiansen -/ module -meta import all Verso.Output.Html +import Verso.Output.Html +meta import Verso.Output.Html namespace Verso.Tests.Html -open Verso.Output +open Lean (Html) open Verso.Output.Html /-! ## Tests for HTML syntax macros -/ @@ -16,10 +17,10 @@ open Verso.Output.Html private def testAttrs := {{
}} /-- -info: Verso.Output.Html.tag +info: Lean.Html.element "html" #[("charset", "UTF-8"), ("charset", "UTF-8"), ("a", "b"), ("a-b-c", "44"), ("x", "y")] - (Verso.Output.Html.seq #[]) + (Lean.Html.seq #[]) -/ #guard_msgs in #eval testAttrs @@ -28,10 +29,10 @@ private def testAttrsAntiquotes := {{