commit
b18f4e52ed
|
@ -128,7 +128,7 @@ def addHeadingAttributes (el : Element) (modifyElement : Element → HtmlM Eleme
|
||||||
|>.insert "class" "markdown-heading"
|
|>.insert "class" "markdown-heading"
|
||||||
let newContents := (←
|
let newContents := (←
|
||||||
contents.mapM (λ c => match c with
|
contents.mapM (λ c => match c with
|
||||||
| Content.Element e => (modifyElement e).map (Content.Element)
|
| Content.Element e => return Content.Element (← modifyElement e)
|
||||||
| _ => pure c))
|
| _ => pure c))
|
||||||
|>.push (Content.Character " ")
|
|>.push (Content.Character " ")
|
||||||
|>.push (Content.Element anchor)
|
|>.push (Content.Element anchor)
|
||||||
|
@ -138,8 +138,8 @@ def addHeadingAttributes (el : Element) (modifyElement : Element → HtmlM Eleme
|
||||||
def extendAnchor (el : Element) : HtmlM Element := do
|
def extendAnchor (el : Element) : HtmlM Element := do
|
||||||
match el with
|
match el with
|
||||||
| Element.Element name attrs contents =>
|
| Element.Element name attrs contents =>
|
||||||
let newAttrs ← match (attrs.find? "href").map extendLink with
|
let newAttrs ← match attrs.find? "href" with
|
||||||
| some href => href.map (attrs.insert "href")
|
| some href => pure (attrs.insert "href" (← extendLink href))
|
||||||
| none => pure attrs
|
| none => pure attrs
|
||||||
pure ⟨ name, newAttrs, contents⟩
|
pure ⟨ name, newAttrs, contents⟩
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ partial def modifyElement (element : Element) : HtmlM Element :=
|
||||||
-- recursively modify
|
-- recursively modify
|
||||||
else
|
else
|
||||||
let newContents ← contents.mapM λ c => match c with
|
let newContents ← contents.mapM λ c => match c with
|
||||||
| Content.Element e => (modifyElement e).map Content.Element
|
| Content.Element e => return Content.Element (← modifyElement e)
|
||||||
| _ => pure c
|
| _ => pure c
|
||||||
pure ⟨ name, attrs, newContents ⟩
|
pure ⟨ name, attrs, newContents ⟩
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
leanprover/lean4:nightly-2022-08-09
|
leanprover/lean4:nightly-2022-08-18
|
||||||
|
|
Loading…
Reference in New Issue