From 5871c4d51f0614ca82c12f6289f8241dfa209e4f Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Thu, 4 Nov 2010 09:11:15 -0700
Subject: [PATCH] Biblio: small fix to detection of punctuation (A. Rossato).

---
 src/Text/Pandoc/Biblio.hs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Text/Pandoc/Biblio.hs b/src/Text/Pandoc/Biblio.hs
index 8a9b21b4e..16215505e 100644
--- a/src/Text/Pandoc/Biblio.hs
+++ b/src/Text/Pandoc/Biblio.hs
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 module Text.Pandoc.Biblio ( processBiblio ) where
 
 import Control.Monad ( when )
-import Data.Char ( toUpper, isPunctuation )
+import Data.Char ( toUpper )
 import Data.List
 import Data.Unique
 import Text.CSL hiding ( Cite(..), Citation(..) )
@@ -129,12 +129,12 @@ mvCiteInNote is = procInlines mvCite
 
       checkPt i
           | Cite c o : xs <- i
-          , headInline xs == lastInline o
+          , endWPt o, startWPt xs
           , endWPt  o = Cite c (initInline o) : checkPt xs
           | x:xs <- i = x : checkPt xs
           | otherwise = []
-      endWPt   = and . map isPunctuation . lastInline
-      startWPt = and . map isPunctuation . headInline
+      endWPt   = and . map (`elem` ".,;:!?") . lastInline
+      startWPt = and . map (`elem` ".,;:!?") . headInline
       checkNt  = processWith $ procInlines checkPt
 
 headInline :: [Inline] -> String