diff --git a/DocGen4/Output/Base.lean b/DocGen4/Output/Base.lean index 60923d2..4aef3b9 100644 --- a/DocGen4/Output/Base.lean +++ b/DocGen4/Output/Base.lean @@ -66,10 +66,10 @@ def declNameToLink (name : Name) : HtmlM String := do pure $ (←moduleNameToLink module) ++ "#" ++ name.toString def splitWhitespaces (s : String) : (String × String × String) := Id.run do - let front := "".pushn ' ' (s.find (!Char.isWhitespace ·)) + let front := "".pushn ' ' $ s.offsetOfPos (s.find (!Char.isWhitespace ·)) let mut s := s.trimLeft let back := "".pushn ' ' (s.length - s.offsetOfPos (s.find Char.isWhitespace)) - s:= s.trimRight + s := s.trimRight (front, s, back) partial def infoFormatToHtml (i : CodeWithInfos) : HtmlM (Array Html) := do diff --git a/DocGen4/Output/DocString.lean b/DocGen4/Output/DocString.lean index 32fe1af..d729d38 100644 --- a/DocGen4/Output/DocString.lean +++ b/DocGen4/Output/DocString.lean @@ -17,7 +17,7 @@ namespace Output let c := s.get i if p c then let i := s.next i - splitAroundAux s p i i (c.toString::s.extract b (i-1)::r) + splitAroundAux s p i i (c.toString::s.extract b (i-⟨1⟩)::r) else splitAroundAux s p b (s.next i) r diff --git a/DocGen4/ToHtmlFormat.lean b/DocGen4/ToHtmlFormat.lean index 64e9b6a..c8f83d1 100644 --- a/DocGen4/ToHtmlFormat.lean +++ b/DocGen4/ToHtmlFormat.lean @@ -81,8 +81,8 @@ def jsxText : Parser := @[combinatorFormatter DocGen4.Jsx.jsxText] def jsxText.formatter : Formatter := pure () @[combinatorParenthesizer DocGen4.Jsx.jsxText] def jsxText.parenthesizer : Parenthesizer := pure () -syntax jsxAttrName := ident <|> strLit -syntax jsxAttrVal := strLit <|> group("{" term "}") +syntax jsxAttrName := ident <|> str +syntax jsxAttrVal := str <|> group("{" term "}") syntax jsxSimpleAttr := jsxAttrName "=" jsxAttrVal syntax jsxAttrSpread := "[" term "]" syntax jsxAttr := jsxSimpleAttr <|> jsxAttrSpread @@ -103,12 +103,12 @@ def translateAttrs (attrs : Array Syntax) : MacroM Syntax := do as ← match attr with | `(jsxAttr| $n:jsxAttrName=$v:jsxAttrVal) => let n ← match n with - | `(jsxAttrName| $n:strLit) => pure n + | `(jsxAttrName| $n:str) => pure n | `(jsxAttrName| $n:ident) => pure $ quote (toString n.getId) | _ => Macro.throwUnsupported let v ← match v with | `(jsxAttrVal| {$v}) => pure v - | `(jsxAttrVal| $v:strLit) => pure v + | `(jsxAttrVal| $v:str) => pure v | _ => Macro.throwUnsupported `(($as).push ($n, ($v : String))) | `(jsxAttr| [$t]) => `($as ++ ($t : Array (String × String))) diff --git a/lakefile.lean b/lakefile.lean index d18d59c..d7d73b6 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -19,7 +19,7 @@ package «doc-gen4» { }, { name := `lake - src := Source.git "https://github.com/leanprover/lake" "9378575b5575f49a185d50130743a190a9be2f82" + src := Source.git "https://github.com/leanprover/lake" "d961d8cfaa1c354c10f3fed55b32de85c205f4ab" } ] } diff --git a/lean-toolchain b/lean-toolchain index 8e380ba..4b053c2 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2022-03-06 +leanprover/lean4:nightly-2022-04-04