git.iko.soy/typeable/pandoc
on master help sign in
Improved LaTeX writer's handling of dashes:
3dbd266fiddlosopher
src/Text/Pandoc/Writers/LaTeX.hs+3−3
@@ -78,10 +78,10 @@ escapeSingleQuotes =
78escapeEllipses = gsub "\\.\\.\\.|\\. \\. \\." "\\ldots{}"
78escapeEllipses = gsub "\\.\\.\\.|\\. \\. \\." "\\ldots{}"
79
79
80escapeDashes = gsub "([0-9])-([0-9])" "\\1--\\2" .
80escapeDashes = gsub "([0-9])-([0-9])" "\\1--\\2" .
81− gsub " -- " "---" .
81+ gsub " *--- *" "---" .
82− gsub "([^[:punct:][:space:]])--([^[:punct:][:space:]])" "\\1---\\2"
82+ gsub "([^-])--([^-])" "\\1---\\2"
83
83
84−escapeSmart = escapeSingleQuotes . escapeDoubleQuotes . escapeDashes . escapeEllipses
84+escapeSmart = escapeDashes . escapeSingleQuotes . escapeDoubleQuotes . escapeEllipses
85
85
86-- | Escape string for LaTeX (including smart quotes, dashes, ellipses)
86-- | Escape string for LaTeX (including smart quotes, dashes, ellipses)
87stringToLaTeX :: String -> String
87stringToLaTeX :: String -> String
tests/writer.latex+1−1
@@ -383,7 +383,7 @@ This is code: \verb!>!, \verb!$!, \verb!\!, \verb!\$!, \verb!<html>!.
383
383
384Here is some quoted `\verb!code!' and a ``\href{http://example.com/?foo=1&bar=2}{quoted link}''.
384Here is some quoted `\verb!code!' and a ``\href{http://example.com/?foo=1&bar=2}{quoted link}''.
385
385
386−Some dashes: one---two --- three---four---five.
386+Some dashes: one---two---three---four---five.
387
387
388Dashes between numbers: 5--7, 255--66, 1987--1999.
388Dashes between numbers: 5--7, 255--66, 1987--1999.
389
389