Skip to content

Commit

Permalink
fix: correctly split whitespace (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
cppio authored Dec 18, 2024
1 parent e473211 commit 70fca3c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions DocGen4/Output/Base.lean
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,12 @@ only `+` should be linked, taking care of this is what this function is
responsible for.
-/
def splitWhitespaces (s : String) : (String × String × String) := Id.run do
let front := "".pushn ' ' <| s.offsetOfPos (s.find (!Char.isWhitespace ·))
let mut length := s.length
let mut s := s.trimLeft
let back := "".pushn ' ' (s.length - s.offsetOfPos (s.find Char.isWhitespace))
let front := "".pushn ' ' (length - s.length)
length := s.length
s := s.trimRight
let back := "".pushn ' ' (length - s.length)
(front, s, back)

/--
Expand Down

0 comments on commit 70fca3c

Please sign in to comment.