citeproc - improved removal of final period...
...in citations inside notes in note-based styles. These citations are put in parentheses, but the final period must be removed. See jgm/citeproc#20
This commit is contained in:
parent
76315d99ca
commit
f9c6167ad1
2 changed files with 33 additions and 5 deletions
|
@ -524,11 +524,14 @@ deNote (Note bs) = Note $ walk go bs
|
|||
go x = x
|
||||
deNote x = x
|
||||
|
||||
-- Note: we can't use dropTextWhileEnd because this would
|
||||
-- remove the final period on abbreviations like Ibid.
|
||||
-- But removing a final Str "." is safe.
|
||||
-- Note: we can't use dropTextWhileEnd indiscriminately,
|
||||
-- because this would remove the final period on abbreviations like Ibid.
|
||||
-- But it turns out that when the note citation ends with Ibid.
|
||||
-- (or Ed. etc.), the last inline will be Str "" as a result of
|
||||
-- the punctuation-fixing mechanism that removes the double '.'.
|
||||
removeFinalPeriod :: [Inline] -> [Inline]
|
||||
removeFinalPeriod ils =
|
||||
case lastMay ils of
|
||||
Just (Str ".") -> initSafe ils
|
||||
_ -> ils
|
||||
Just (Str t)
|
||||
| T.takeEnd 1 t == "." -> initSafe ils ++ [Str (T.dropEnd 1 t)]
|
||||
_ -> ils
|
||||
|
|
25
test/command/citeproc-20.md
Normal file
25
test/command/citeproc-20.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
```
|
||||
% pandoc --citeproc -t plain
|
||||
Lorem ipsum dolor sit amet^[Consectetur adipisicing elit: «sed do eiusmod tempor incididunt» [@doe_1989, 15].].
|
||||
|
||||
---
|
||||
csl: command/chicago-fullnote-bibliography.csl
|
||||
suppress-bibliography: true
|
||||
references:
|
||||
- id: doe_1989
|
||||
author:
|
||||
- family: Doe
|
||||
given: John
|
||||
issued:
|
||||
- year: 1989
|
||||
publisher: ABC
|
||||
publisher-place: New York
|
||||
title: Tempor
|
||||
type: book
|
||||
...
|
||||
^D
|
||||
Lorem ipsum dolor sit amet[1].
|
||||
|
||||
[1] Consectetur adipisicing elit: «sed do eiusmod tempor incididunt»
|
||||
(John Doe, Tempor (New York: ABC, 1989), 15).
|
||||
```
|
Loading…
Reference in a new issue