diff options
| author | aarne <aarne@chalmers.se> | 2014-10-17 07:04:50 +0000 |
|---|---|---|
| committer | aarne <aarne@chalmers.se> | 2014-10-17 07:04:50 +0000 |
| commit | 2caf6fa125f7f91a7a78b7f0699a43c2d922e687 (patch) | |
| tree | 5c9a27a0ef1bb3ff1bd89e96c67fbc3dc6c13667 /src/runtime/haskell | |
| parent | 42cfacbf867184ae5bc495a247fa6fbeb8c90639 (diff) | |
unlexing latex code: no space between closing $ and punctuation
Diffstat (limited to 'src/runtime/haskell')
| -rw-r--r-- | src/runtime/haskell/PGF/Lexing.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/runtime/haskell/PGF/Lexing.hs b/src/runtime/haskell/PGF/Lexing.hs index d5286a478..b4a3d3fa0 100644 --- a/src/runtime/haskell/PGF/Lexing.hs +++ b/src/runtime/haskell/PGF/Lexing.hs @@ -81,10 +81,13 @@ unlexMixed = capitInit . concat . alternate False where alternate env s = case s of _:_ -> case break (=="$") s of (t,[]) -> unlex env t : [] - (t,c:m) -> unlex env t : sep env c : alternate (not env) m + (t,c:m) -> unlex env t : sep env c m : alternate (not env) m _ -> [] - unlex env = if env then unlexCode else unlexText - sep env c = if env then c ++ " " else " " ++ c + unlex env = if env then unlexCode else (uncapitInit . unlexText) + sep env c m = case (m,env) of + ([p]:_,True) | isPunct p -> c -- closing $ glued to next punct + (_, True) -> c ++ " " -- closing $ otherwise separated by space from what follows + _ -> " " ++ c -- put space before opening $ -- * Additional lexing uitilties |
