aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-12-14 10:40:24 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-12-14 11:34:32 -0800
commit394fa9d0727a30f540d9c36ccfa68fc942cad587 (patch)
tree0ee3a22b0270979ddd9edf12fa64a63915614196 /test
parentbe0e3f979441176b6d838ff722ae7990940564be (diff)
downloadpandoc-394fa9d0727a30f540d9c36ccfa68fc942cad587.tar.gz
Org reader: parse official org-cite citations.
We also support the older org-ref style as a fallback. We no longer support the "markdown-style" citations. See #7329.
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Readers/Org/Inline/Citation.hs40
-rw-r--r--test/command/7329.md23
2 files changed, 58 insertions, 5 deletions
diff --git a/test/Tests/Readers/Org/Inline/Citation.hs b/test/Tests/Readers/Org/Inline/Citation.hs
index 7eabd9aae..2d0d460a2 100644
--- a/test/Tests/Readers/Org/Inline/Citation.hs
+++ b/test/Tests/Readers/Org/Inline/Citation.hs
@@ -19,9 +19,9 @@ import Text.Pandoc.Builder
tests :: [TestTree]
tests =
- [ testGroup "Markdown-style citations"
+ [ testGroup "Org-cite citations"
[ "Citation" =:
- "[@nonexistent]" =?>
+ "[cite:@nonexistent]" =?>
let citation = Citation
{ citationId = "nonexistent"
, citationPrefix = []
@@ -29,10 +29,10 @@ tests =
, citationMode = NormalCitation
, citationNoteNum = 0
, citationHash = 0}
- in (para $ cite [citation] "[@nonexistent]")
+ in (para $ cite [citation] "[cite:@nonexistent]")
, "Citation containing text" =:
- "[see @item1 p. 34-35]" =?>
+ "[cite:see @item1 p. 34-35]" =?>
let citation = Citation
{ citationId = "item1"
, citationPrefix = [Str "see"]
@@ -40,7 +40,37 @@ tests =
, citationMode = NormalCitation
, citationNoteNum = 0
, citationHash = 0}
- in (para $ cite [citation] "[see @item1 p. 34-35]")
+ in (para $ cite [citation] "[cite:see @item1 p. 34-35]")
+
+ , "Author-in-text citation with locator and suffix" =:
+ "[cite/t:see @item1 p. 34-35 and *passim*; @item2]" =?>
+ let citations =
+ [ Citation
+ { citationId = "item1"
+ , citationPrefix = [ Str "see" ]
+ , citationSuffix =
+ [ Str "p."
+ , Space
+ , Str "34-35"
+ , Space
+ , Str "and"
+ , Space
+ , Strong [ Str "passim" ]
+ ]
+ , citationMode = AuthorInText
+ , citationNoteNum = 0
+ , citationHash = 0
+ }
+ , Citation
+ { citationId = "item2"
+ , citationPrefix = []
+ , citationSuffix = []
+ , citationMode = NormalCitation
+ , citationNoteNum = 0
+ , citationHash = 0
+ }
+ ]
+ in (para $ cite citations "[cite/t:see @item1 p. 34-35 and *passim*; @item2]")
]
, testGroup "org-ref citations"
diff --git a/test/command/7329.md b/test/command/7329.md
index 565241db8..9ed9c52ff 100644
--- a/test/command/7329.md
+++ b/test/command/7329.md
@@ -42,3 +42,26 @@
<<ref-item1>>
Doe, John. 2005. /First Book/. Cambridge: Cambridge University Press.
```
+
+```
+% pandoc -f org -t markdown
+- [cite/t:@item1]
+- [cite/t:@item1 p. 12]
+- [cite/t:@item1 p.12; see also @item2]
+- [cite:@item1]
+- [cite/na:@item1]
+- [cite:see @item1 p. 12]
+- [cite:see @item1 p. 12 and /passim/]
+- [cite:@item1; @item2]
+- [cite:see @item1; @item2]
+^D
+- @item1
+- @item1 [p. 12]
+- @item1 [p.12; see also @item2]
+- [@item1]
+- [-@item1]
+- [see @item1 p. 12]
+- [see @item1 p. 12 and *passim*]
+- [@item1; @item2]
+- [see @item1; @item2]
+```