mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-26 10:16:32 +00:00
Improved LaTeX writer's handling of dashes:
+ Recognize a double hyphen as an Em-dash, even when it occurs next to punctuation (e.g. a quotation mark). + Collapse space around Em-dashes. + Process quotes before dashes. This way (foo -- 'bar') will turn into (foo---`bar') instead of (foo---'bar'). git-svn-id: https://pandoc.googlecode.com/svn/trunk@49 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
@@ -78,10 +78,10 @@ escapeSingleQuotes =
|
||||
escapeEllipses = gsub "\\.\\.\\.|\\. \\. \\." "\\ldots{}"
|
||||
|
||||
escapeDashes = gsub "([0-9])-([0-9])" "\\1--\\2" .
|
||||
gsub " -- " "---" .
|
||||
gsub "([^[:punct:][:space:]])--([^[:punct:][:space:]])" "\\1---\\2"
|
||||
gsub " *--- *" "---" .
|
||||
gsub "([^-])--([^-])" "\\1---\\2"
|
||||
|
||||
escapeSmart = escapeSingleQuotes . escapeDoubleQuotes . escapeDashes . escapeEllipses
|
||||
escapeSmart = escapeDashes . escapeSingleQuotes . escapeDoubleQuotes . escapeEllipses
|
||||
|
||||
-- | Escape string for LaTeX (including smart quotes, dashes, ellipses)
|
||||
stringToLaTeX :: String -> String
|
||||
|
||||
+1
-1
@@ -383,7 +383,7 @@ This is code: \verb!>!, \verb!$!, \verb!\!, \verb!\$!, \verb!<html>!.
|
||||
|
||||
Here is some quoted `\verb!code!' and a ``\href{http://example.com/?foo=1&bar=2}{quoted link}''.
|
||||
|
||||
Some dashes: one---two --- three---four---five.
|
||||
Some dashes: one---two---three---four---five.
|
||||
|
||||
Dashes between numbers: 5--7, 255--66, 1987--1999.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user