From c4afbbd47aa46030dfe9ee45517d7a1d7bf7b0ae Mon Sep 17 00:00:00 2001 From: Wojciech Nawrocki Date: Thu, 27 Aug 2026 04:09:29 +0000 Subject: [PATCH 1/2] chore: switch to upstream Html type --- doc/UsersGuide/Output/HTML.lean | 11 +- doc/UsersGuide/Websites.lean | 2 +- src/tests/Tests/GenericCode.lean | 18 +- src/tests/Tests/HoverMerge.lean | 51 +-- src/tests/Tests/Html.lean | 42 +-- src/tests/Tests/NestedTacticHtml.lean | 22 +- src/tests/Tests/Serialization.lean | 25 +- src/verso-blog/VersoBlog.lean | 2 +- src/verso-blog/VersoBlog/Basic.lean | 2 +- src/verso-blog/VersoBlog/Component.lean | 1 + src/verso-blog/VersoBlog/Generate.lean | 1 + src/verso-blog/VersoBlog/Template.lean | 17 +- src/verso-blog/VersoBlog/Theme.lean | 5 +- src/verso-html/VersoHtmlMain.lean | 4 +- .../VersoLiterateCode.lean | 8 +- src/verso-literate-html/LiterateHtmlMain.lean | 4 +- src/verso-manual/VersoManual.lean | 5 +- src/verso-manual/VersoManual/Basic.lean | 32 +- src/verso-manual/VersoManual/Diagrams.lean | 4 +- src/verso-manual/VersoManual/Docstring.lean | 2 +- src/verso-manual/VersoManual/Glossary.lean | 2 +- src/verso-manual/VersoManual/Html.lean | 15 +- src/verso-manual/VersoManual/Html/Config.lean | 6 +- .../VersoManual/Html/SoftHyphenate.lean | 17 +- src/verso-manual/VersoManual/Index.lean | 6 +- src/verso-manual/VersoManual/License.lean | 6 +- src/verso-manual/VersoManual/Literate.lean | 2 +- .../VersoManual/LocalContents.lean | 2 +- src/verso-manual/VersoManual/Row.lean | 2 +- src/verso-manual/VersoManual/Table.lean | 4 +- .../VersoSearch/DomainSearch.lean | 2 +- src/verso/Verso/Code/Highlighted.lean | 20 +- src/verso/Verso/Doc/Html.lean | 11 +- src/verso/Verso/Output/Html.lean | 301 ++++-------------- test-projects/custom-genre/SimplePage.lean | 2 +- test-projects/website/DemoSiteMain.lean | 1 + 36 files changed, 251 insertions(+), 406 deletions(-) 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/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 := {{ }} /-- -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 testAttrsAntiquotes @@ -51,27 +52,26 @@ private def test : Html := {{ }} /-- -info: Verso.Output.Html.tag +info: Lean.Html.element "html" #[] - (Verso.Output.Html.seq - #[Verso.Output.Html.tag + (Lean.Html.seq + #[Lean.Html.element "head" #[] - (Verso.Output.Html.seq - #[Verso.Output.Html.tag "meta" #[("charset", "UTF-8")] (Verso.Output.Html.seq #[]), - Verso.Output.Html.tag "script" #[] (Verso.Output.Html.seq #[])]), - Verso.Output.Html.tag + (Lean.Html.seq + #[Lean.Html.element "meta" #[("charset", "UTF-8")] (Lean.Html.seq #[]), + Lean.Html.element "script" #[] (Lean.Html.seq #[])]), + Lean.Html.element "body" #[("lang", "en"), ("class", "thing"), ("data-foo", "data foo")] - (Verso.Output.Html.seq - #[Verso.Output.Html.tag "input" #[("type", "checkbox"), ("checked", "")] (Verso.Output.Html.seq #[]), - Verso.Output.Html.tag + (Lean.Html.seq + #[Lean.Html.element "input" #[("type", "checkbox"), ("checked", "")] (Lean.Html.seq #[]), + Lean.Html.element "p" #[] - (Verso.Output.Html.seq - #[Verso.Output.Html.text true "foo bar", Verso.Output.Html.tag "br" #[] (Verso.Output.Html.seq #[]), - Verso.Output.Html.text true "hey"])])]) + (Lean.Html.seq + #[Lean.Html.text "foo bar", Lean.Html.element "br" #[] (Lean.Html.seq #[]), Lean.Html.text "hey"])])]) -/ #guard_msgs in #eval test @@ -80,7 +80,7 @@ private def leanKwTest : Html := {{ }} -/-- info: Verso.Output.Html.tag "label" #[("for", "foo")] (Verso.Output.Html.text true "Blah") -/ +/-- info: Lean.Html.element "label" #[("for", "foo")] (Lean.Html.text "Blah") -/ #guard_msgs in #eval leanKwTest @@ -118,7 +118,7 @@ info: | /-- info: "

x & y < z

" -/ #guard_msgs in - #eval Html.asString (.tag "p" #[] (.text false "x & y < z")) (breakLines := false) + #eval Html.asString (.element "p" #[] (.raw "x & y < z")) (breakLines := false) /-- info: "

x

" -/ #guard_msgs in diff --git a/src/tests/Tests/NestedTacticHtml.lean b/src/tests/Tests/NestedTacticHtml.lean index 9eb774e8e..cec6d8b67 100644 --- a/src/tests/Tests/NestedTacticHtml.lean +++ b/src/tests/Tests/NestedTacticHtml.lean @@ -24,7 +24,7 @@ open SubVerso.Compat.Frontend (processCommands) open SubVerso.Highlighting (Highlighted highlightFrontendResult) open Verso.Code (HighlightHtmlM) open Verso.Doc (Genre) -open Verso.Output (Html) +open Verso.Output open Lean Elab Command namespace Verso.NestedTacticHtmlTest @@ -115,8 +115,8 @@ def hasClass (attrs : Array (String × String)) (cls : String) : Bool := /-- The concatenated text content of an HTML fragment. -/ partial def htmlText : Html → String - | .text _ s => s - | .tag _ _ contents => htmlText contents + | .text s | .raw s => s + | .element _ _ contents => htmlText contents | .seq xs => xs.foldl (fun acc x => acc ++ htmlText x) "" /-- The direct children of an HTML fragment. -/ @@ -126,9 +126,9 @@ def directChildren : Html → Array Html /-- Whether an HTML fragment renders as nothing visible (whitespace or empty). -/ partial def htmlInsignificant : Html → Bool - | .text _ s => s.trimAscii.isEmpty + | .text s | .raw s => s.trimAscii.isEmpty | .seq xs => xs.all htmlInsignificant - | .tag .. => false + | .element .. => false /-- The last visible element of an HTML fragment, looking through `.seq` tails. -/ partial def htmlLastVisible? : Html → Option Html @@ -139,12 +139,12 @@ partial def htmlLastVisible? : Html → Option Html def childSpanWithClass (contents : Html) (cls : String) : Option Html := (directChildren contents).find? fun h => match h with - | .tag "span" a _ => hasClass a cls + | .element "span" a _ => hasClass a cls | _ => false /-- Whether `html` is a `` whose own state shows "no goals". -/ def isNoGoalsState : Html → Bool - | .tag "span" attrs contents => + | .element "span" attrs contents => if hasClass attrs "tactic" then match childSpanWithClass contents "tactic-state" with | some s => htmlText s |>.contains "All goals completed" @@ -156,7 +156,7 @@ def isNoGoalsState : Html → Bool def labelContents (contents : Html) : Html := let html? := directChildren contents |>.findSome? fun - | .tag "label" _ c => some c + | .element "label" _ c => some c | _ => none html?.getD .empty @@ -167,15 +167,15 @@ states nested inside each one. A toggle is a `` whose own s -/ partial def proofStates : Html → List ProofState | .seq xs => xs.toList.flatMap proofStates - | .tag name attrs contents => + | .element name attrs contents => if name == "span" && hasClass attrs "tactic" then let label := labelContents contents - [{ noGoals := isNoGoalsState (.tag name attrs contents), + [{ noGoals := isNoGoalsState (.element name attrs contents), endsWithNoGoals := htmlLastVisible? label |>.map isNoGoalsState |>.getD false, children := proofStates label }] else proofStates contents - | .text .. => [] + | _ => [] /-- Whether any proof state with goals ends with a no-goals proof state — the redundant nesting that diff --git a/src/tests/Tests/Serialization.lean b/src/tests/Tests/Serialization.lean index 70729f8af..f980e86b5 100644 --- a/src/tests/Tests/Serialization.lean +++ b/src/tests/Tests/Serialization.lean @@ -260,30 +260,31 @@ where html : Nat → Gen Html | 0 => text | n + 1 => - oneOf #[text, tag n, seq n] (by simp) - text := .text <$> arbitrary <*> arbitrary + oneOf #[text, raw, tag n, seq n] (by simp) + text := .text <$> arbitrary + raw := .raw <$> arbitrary tag n := do let name ← arbitrary let attrs ← sizedArrayOf do return (← arbitrary, ← arbitrary) let content ← (html n).resize (· - 1) - return .tag name attrs content + return .element name attrs content seq n := .seq <$> sizedArrayOf (html n) partial instance : Shrinkable Html where shrink := shrinkHtml where shrinkHtml - | .text true s => - .text false s :: (shrink s |>.map (.text true)) - | .text false s => - shrink s |>.map (.text true) + | .text s => + .raw s :: (shrink s |>.map .text) + | .raw s => + shrink s |>.map .text | .seq xs => have : Shrinkable Html := ⟨shrinkHtml⟩ shrink xs |>.map (.seq) - | .tag name attrs content => - (shrink name |>.map (.tag · attrs content)) ++ - (shrink attrs |>.map (.tag name · content)) ++ - (shrinkHtml content |>.map (.tag name attrs ·)) + | .element name attrs content => + (shrink name |>.map (.element · attrs content)) ++ + (shrink attrs |>.map (.element name · content)) ++ + (shrinkHtml content |>.map (.element name attrs ·)) end section @@ -403,7 +404,7 @@ def testRefObject := testProp <| ∀ (obj : RefObject), roundTripOk obj def testRemoteInfo := testProp <| ∀ (info : RemoteInfo), roundTripOk info def testAllRemotes := testProp <| ∀ (remotes : AllRemotes), roundTripOk remotes def testTraverseState := testProp <| ∀ (st : Verso.Genre.Manual.TraverseState), roundTripOk st -def testHtml := testProp <| ∀ (html : Verso.Output.Html), roundTripOk html +def testHtml := testProp <| ∀ (html : Html), roundTripOk html def testDataFile := testProp <| ∀ (f : Verso.Genre.Manual.DataFile), roundTripOk f def testNumbering := testProp <| ∀ (n : Verso.Genre.Manual.Numbering), roundTripOk n def testXrefSource := testProp <| ∀ (src : XrefSource), isEqOk (XrefSource.fromJson? src.toJson) src diff --git a/src/verso-blog/VersoBlog.lean b/src/verso-blog/VersoBlog.lean index 3faebe463..9cfae33cf 100644 --- a/src/verso-blog/VersoBlog.lean +++ b/src/verso-blog/VersoBlog.lean @@ -892,7 +892,7 @@ where else pure attr rwTag (tag : String) (attrs : Array (String × String)) (content : Html) : ReaderT TraverseContext Id (Option Html) := do - pure <| some <| .tag tag (← attrs.mapM rwAttr) content + pure <| some <| .element tag (← attrs.mapM rwAttr) content open Verso.Code.External diff --git a/src/verso-blog/VersoBlog/Basic.lean b/src/verso-blog/VersoBlog/Basic.lean index d72c4ddfc..13fd2eb81 100644 --- a/src/verso-blog/VersoBlog/Basic.lean +++ b/src/verso-blog/VersoBlog/Basic.lean @@ -24,7 +24,7 @@ public import VersoBlog.LexedText public section open Std (HashSet HashMap) -open Lean (Json ToJson FromJson) +open Lean (Json ToJson FromJson Html) open Verso Doc Output Html Code open Verso.Multi diff --git a/src/verso-blog/VersoBlog/Component.lean b/src/verso-blog/VersoBlog/Component.lean index 9d5bbf696..488259a4d 100644 --- a/src/verso-blog/VersoBlog/Component.lean +++ b/src/verso-blog/VersoBlog/Component.lean @@ -18,6 +18,7 @@ open Verso.Doc open Verso Output Html open Std (HashSet) +open Lean (Html) namespace Verso.Genre.Blog diff --git a/src/verso-blog/VersoBlog/Generate.lean b/src/verso-blog/VersoBlog/Generate.lean index c9ed0c861..72c3db8f2 100644 --- a/src/verso-blog/VersoBlog/Generate.lean +++ b/src/verso-blog/VersoBlog/Generate.lean @@ -15,6 +15,7 @@ public section open Verso Doc Output Html HtmlT FS open Verso.Code.Hover (State) open Verso.Code (LinkTargets) +open Lean (Html) namespace Verso.Genre.Blog diff --git a/src/verso-blog/VersoBlog/Template.lean b/src/verso-blog/VersoBlog/Template.lean index 56aba8ad7..7bb365c26 100644 --- a/src/verso-blog/VersoBlog/Template.lean +++ b/src/verso-blog/VersoBlog/Template.lean @@ -24,6 +24,7 @@ public section open Std (HashSet TreeMap) open Verso Doc Output Html HtmlT +open Lean (Html) open Verso.Genre Blog open SubVerso.Highlighting @@ -47,11 +48,11 @@ def getD [TypeName α] (value : Val) (default : α) : α := end Params.Val instance : Coe String Template.Params.Val where - coe str := ⟨.mk str, #[.mk <| Html.text true str]⟩ + coe str := ⟨.mk str, #[.mk <| Html.text str]⟩ instance : Coe Html Template.Params.Val where coe - | .text true str => ↑str + | .text str => ↑str | other => ⟨.mk other, #[]⟩ @@ -163,7 +164,7 @@ def blockHtml (g : Genre) | .htmlDetails classes summary, contents => do pure {{
{{summary}} {{← contents.mapM goB}}
}} | .htmlWrapper name attrs, contents => do - Html.tag name attrs <$> contents.mapM goB + Html.element name attrs <$> contents.mapM goB | .htmlDiv classes, contents => do pure {{
{{← contents.mapM goB}}
}} | .blob html, _ => pure html @@ -194,7 +195,7 @@ def blockHtml (g : Genre) let contents := contents.extract 1 return {{
- {{ .tag s!"h{lvl + 1}" #[] (← first.mapM goI) }} + {{ .element s!"h{lvl + 1}" #[] (← first.mapM goI) }} {{ ← contents.mapM goB }}
}} @@ -353,9 +354,9 @@ def builtinHeader : TemplateM Html := do -- These should come first so later stylesheets can easily override them. out := out ++ {{}} for style in (← read).builtInStyles do - out := out ++ {{"\n"}} + out := out ++ {{"\n"}} for script in (← read).builtInScripts do - out := out ++ {{"\n"}} + out := out ++ {{"\n"}} for js in (← read).jsFiles do out := out ++ {{}} for css in (← read).cssFiles do @@ -368,9 +369,9 @@ def builtinHeader : TemplateM Html := do -- Components for style in (← get).headerCss do - out := out ++ {{"\n"}} + out := out ++ {{"\n"}} for script in (← get).headerJs do - out := out ++ {{"\n"}} + out := out ++ {{"\n"}} pure out diff --git a/src/verso-blog/VersoBlog/Theme.lean b/src/verso-blog/VersoBlog/Theme.lean index c99c7ffc4..6f433fe59 100644 --- a/src/verso-blog/VersoBlog/Theme.lean +++ b/src/verso-blog/VersoBlog/Theme.lean @@ -11,6 +11,7 @@ public section open Verso.Genre.Blog Template open Verso Doc Output Html +open Lean (Html) namespace Verso.Genre.Blog @@ -307,7 +308,7 @@ def post : Template := do | some md => {{