aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorNathan Gass <gass@search.ch>2010-12-15 12:06:14 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2010-12-15 10:21:53 -0800
commit8f60176511d006cc1c9fb8146f4e38cb9b760dc6 (patch)
tree757453e22dd396cc0ffe0521206fd122cd4065a5 /src/Text/Pandoc/Writers
parent43fee5e7f797b442e0290e9f6e788a6ad67a18b5 (diff)
downloadpandoc-8f60176511d006cc1c9fb8146f4e38cb9b760dc6.tar.gz
Remove punctuation at start of suffix for natbib and biblatex output.
This is necessary as the latex citation commands include there own punctuation, which resulted in doubled commas for markdown documents where citeproc output works correctly.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 9ddfc8b84..ca7446994 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -33,7 +33,7 @@ import Text.Pandoc.Shared
import Text.Pandoc.Templates
import Text.Printf ( printf )
import Data.List ( (\\), isSuffixOf, isPrefixOf, intersperse, intercalate )
-import Data.Char ( toLower )
+import Data.Char ( toLower, isPunctuation )
import Control.Monad.State
import Text.PrettyPrint.HughesPJ hiding ( Str )
import System.FilePath (dropExtension)
@@ -428,8 +428,12 @@ citeCommand c p s k = do
citeArguments :: [Inline] -> [Inline] -> String -> State WriterState Doc
citeArguments p s k = do
+ let s' = case s of
+ (Str (x:[]) : r) | isPunctuation x -> dropWhile (== Space) r
+ (Str (x:xs) : r) | isPunctuation x -> Str xs : r
+ _ -> s
pdoc <- inlineListToLaTeX p
- sdoc <- inlineListToLaTeX s
+ sdoc <- inlineListToLaTeX s'
let optargs = case (isEmpty pdoc, isEmpty sdoc) of
(True, True ) -> empty
(True, False) -> brackets sdoc