pandoc 1.9.0.4 → 1.9.0.5
raw patch · 3 files changed
+66/−46 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog +8/−0
- pandoc.cabal +26/−26
- src/Text/Pandoc/Writers/LaTeX.hs +32/−20
changelog view
@@ -1,3 +1,11 @@+pandoc (1.9.0.5)++ * Changed cabal file so that build-depends for the test program+ are not required unless the tests flag is used.++ * LaTeX writer: insert `{}` between adjacent hyphens so they don't+ form ligatures (dashes) in code spans.+ pandoc (1.9.0.4) * Raised version bound on test-framework to avoid problems
pandoc.cabal view
@@ -1,5 +1,5 @@ Name: pandoc-Version: 1.9.0.4+Version: 1.9.0.5 Cabal-Version: >= 1.10 Build-Type: Custom License: GPL@@ -391,30 +391,30 @@ FlexibleInstances Hs-Source-Dirs: src -- END DUPLICATED SECTION- if impl(ghc >= 7)- cpp-options: -D_LIT=lit+ if !flag(tests)+ Buildable: False else- cpp-options: -D_LIT=$lit- if flag(tests) Buildable: True- else- Buildable: False- Other-Extensions: TemplateHaskell, QuasiQuotes- Build-Depends: Diff, test-framework >= 0.3 && < 0.6,- test-framework-hunit >= 0.2 && < 0.3,- test-framework-quickcheck2 >= 0.2.9 && < 0.3,- QuickCheck >= 2.4 && < 2.6,- HUnit >= 1.2 && < 1.3,- template-haskell >= 2.4 && < 2.8,- ansi-terminal == 0.5.*- Other-Modules: Tests.Old- Tests.Helpers- Tests.Arbitrary- Tests.Shared- Tests.Readers.LaTeX- Tests.Readers.Markdown- Tests.Readers.RST- Tests.Writers.Native- Tests.Writers.ConTeXt- Tests.Writers.HTML- Tests.Writers.Markdown+ if impl(ghc >= 7)+ cpp-options: -D_LIT=lit+ else+ cpp-options: -D_LIT=$lit+ Other-Extensions: TemplateHaskell, QuasiQuotes+ Build-Depends: Diff, test-framework >= 0.3 && < 0.6,+ test-framework-hunit >= 0.2 && < 0.3,+ test-framework-quickcheck2 >= 0.2.9 && < 0.3,+ QuickCheck >= 2.4 && < 2.6,+ HUnit >= 1.2 && < 1.3,+ template-haskell >= 2.4 && < 2.8,+ ansi-terminal == 0.5.*+ Other-Modules: Tests.Old+ Tests.Helpers+ Tests.Arbitrary+ Tests.Shared+ Tests.Readers.LaTeX+ Tests.Readers.Markdown+ Tests.Readers.RST+ Tests.Writers.Native+ Tests.Writers.ConTeXt+ Tests.Writers.HTML+ Tests.Writers.Markdown
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -170,26 +170,38 @@ -- escape things as needed for LaTeX stringToLaTeX :: Bool -> String -> String-stringToLaTeX isUrl = escapeStringUsing latexEscapes- where latexEscapes = backslashEscapes "{}$%&_#" ++- [ ('~', "\\ensuremath{\\sim}") | not isUrl ] ++- [ ('^', "\\^{}")- , ('\\', "\\textbackslash{}")- , ('€', "\\euro{}")- , ('|', "\\textbar{}")- , ('<', "\\textless{}")- , ('>', "\\textgreater{}")- , ('[', "{[}") -- to avoid interpretation as- , (']', "{]}") -- optional arguments- , ('\160', "~")- , ('\x2018', "`")- , ('\x2019', "'")- , ('\x201C', "``")- , ('\x201D', "''")- , ('\x2026', "\\ldots{}")- , ('\x2014', "---")- , ('\x2013', "--")- ]+stringToLaTeX _ [] = ""+stringToLaTeX isUrl (x:xs) =+ case x of+ '{' -> "\\{" ++ rest+ '}' -> "\\}" ++ rest+ '$' -> "\\$" ++ rest+ '%' -> "\\%" ++ rest+ '&' -> "\\&" ++ rest+ '_' -> "\\_" ++ rest+ '#' -> "\\#" ++ rest+ '-' -> case xs of -- prevent adjacent hyphens from forming ligatures+ ('-':_) -> "-{}" ++ rest+ _ -> '-' : rest+ '~' | not isUrl -> "\\ensuremath{\\sim}"+ '^' -> "\\^{}" ++ rest+ '\\' -> "\\textbackslash{}" ++ rest+ '€' -> "\\euro{}" ++ rest+ '|' -> "\\textbar{}" ++ rest+ '<' -> "\\textless{}" ++ rest+ '>' -> "\\textgreater{}" ++ rest+ '[' -> "{[}" ++ rest -- to avoid interpretation as+ ']' -> "{]}" ++ rest -- optional arguments+ '\160' -> "~" ++ rest+ '\x2018' -> "`" ++ rest+ '\x2019' -> "'" ++ rest+ '\x201C' -> "``" ++ rest+ '\x201D' -> "''" ++ rest+ '\x2026' -> "\\ldots{}" ++ rest+ '\x2014' -> "---" ++ rest+ '\x2013' -> "--" ++ rest+ _ -> x : rest+ where rest = stringToLaTeX isUrl xs -- | Puts contents into LaTeX command. inCmd :: String -> Doc -> Doc