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.
This commit is contained in:
parent
43fee5e7f7
commit
8f60176511
4 changed files with 15 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
\item
|
||||
A citation group
|
||||
\autocites[see][, p.~34--35]{item1}[also][chap. 3]{item3}.
|
||||
\autocites[see][p.~34--35]{item1}[also][chap. 3]{item3}.
|
||||
|
||||
\item
|
||||
Another one \autocite[see][p.~34--35]{item1}.
|
||||
|
@ -50,10 +50,10 @@
|
|||
|
||||
\item
|
||||
Citation with a suffix and locator
|
||||
\autocite[, pp.~33, 35--37, and nowhere else]{item1}.
|
||||
\autocite[pp.~33, 35--37, and nowhere else]{item1}.
|
||||
|
||||
\item
|
||||
Citation with suffix only \autocite[, and nowhere else]{item1}.
|
||||
Citation with suffix only \autocite[and nowhere else]{item1}.
|
||||
|
||||
\item
|
||||
Now some modifiers.%
|
||||
|
|
|
@ -14,16 +14,16 @@
|
|||
|
||||
- In a note.[^1]
|
||||
|
||||
- A citation group [see @item1, p. 34-35; also @item3 chap. 3].
|
||||
- A citation group [see @item1 p. 34-35; also @item3 chap. 3].
|
||||
|
||||
- Another one [see @item1 p. 34-35].
|
||||
|
||||
- And another one in a note.[^2]
|
||||
|
||||
- Citation with a suffix and locator
|
||||
[@item1, pp. 33, 35-37, and nowhere else].
|
||||
[@item1 pp. 33, 35-37, and nowhere else].
|
||||
|
||||
- Citation with suffix only [@item1, and nowhere else].
|
||||
- Citation with suffix only [@item1 and nowhere else].
|
||||
|
||||
- Now some modifiers.[^3]
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
\item
|
||||
A citation group
|
||||
\citetext{\citealp[see][, p.~34--35]{item1}; \citealp[also][chap. 3]{item3}}.
|
||||
\citetext{\citealp[see][p.~34--35]{item1}; \citealp[also][chap. 3]{item3}}.
|
||||
|
||||
\item
|
||||
Another one \citep[see][p.~34--35]{item1}.
|
||||
|
@ -52,10 +52,10 @@
|
|||
|
||||
\item
|
||||
Citation with a suffix and locator
|
||||
\citep[, pp.~33, 35--37, and nowhere else]{item1}.
|
||||
\citep[pp.~33, 35--37, and nowhere else]{item1}.
|
||||
|
||||
\item
|
||||
Citation with suffix only \citep[, and nowhere else]{item1}.
|
||||
Citation with suffix only \citep[and nowhere else]{item1}.
|
||||
|
||||
\item
|
||||
Now some modifiers.%
|
||||
|
|
Loading…
Add table
Reference in a new issue