skylighting-core 0.8.1 → 0.8.1.1
raw patch · 3 files changed
+21/−8 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +4/−0
- skylighting-core.cabal +1/−1
- src/Skylighting/Format/LaTeX.hs +16/−7
changelog.md view
@@ -1,5 +1,9 @@ # Revision history for skylighting and skylighting-core +## 0.8.1.1 -- 2019-06-13++ * Improved LaTeX escaping (#78).+ ## 0.8.1 -- 2019-06-04 * Added support for stata (#74).
skylighting-core.cabal view
@@ -1,5 +1,5 @@ name: skylighting-core-version: 0.8.1+version: 0.8.1.1 synopsis: syntax highlighting library description: Skylighting is a syntax highlighting library. It derives its tokenizers from XML syntax
src/Skylighting/Format/LaTeX.hs view
@@ -38,13 +38,22 @@ escapeLaTeX :: Bool -> Text -> Text escapeLaTeX inline = Text.concatMap escapeLaTeXChar- where escapeLaTeXChar '\\' = "\\textbackslash{}"- escapeLaTeXChar '{' = "\\{"- escapeLaTeXChar '}' = "\\}"- escapeLaTeXChar '|' = if inline- then "\\VerbBar{}" -- used in inline verbatim- else "|"- escapeLaTeXChar x = Text.singleton x+ where escapeLaTeXChar c =+ case c of+ '\\' -> "\\textbackslash{}"+ '{' -> "\\{"+ '}' -> "\\}"+ '|' | inline -> "\\VerbBar{}" -- used in inline verbatim+ '_' -> "\\_"+ '&' -> "\\&"+ '%' -> "\\%"+ '#' -> "\\#"+ '`' -> "\\textasciigrave{}"+ '\'' -> "\\textquotesingle{}"+ '-' -> "{-}" -- prevent ligatures+ '~' -> "\\textasciitilde{}"+ '^' -> "\\^{}"+ _ -> Text.singleton c -- LaTeX