@@ -5,10 +5,10 @@ import Data.List (intersperse)
5import Test.Tasty (TestTree, testGroup)
5import Test.Tasty (TestTree, testGroup)
6import Tests.Helpers ((=?>))
6import Tests.Helpers ((=?>))
7import Tests.Readers.Org.Shared ((=:), spcSep)
7import Tests.Readers.Org.Shared ((=:), spcSep)
9import Text.Pandoc.Builder
8import Text.Pandoc.Builder
10import Text.Pandoc.Shared (underlineSpan)
9import Text.Pandoc.Shared (underlineSpan)
11import qualified Data.Text as T
10import qualified Data.Text as T
11+import qualified Tests.Readers.Org.Inline.Citation as Citation
12import qualified Tests.Readers.Org.Inline.Note as Note
12import qualified Tests.Readers.Org.Inline.Note as Note
13import qualified Tests.Readers.Org.Inline.Smart as Smart
13import qualified Tests.Readers.Org.Inline.Smart as Smart
@@ -288,161 +288,6 @@ tests =
289 "echo $HOME")
289 "echo $HOME")
292− "[@nonexistent]" =?>
293− let citation = Citation
294− { citationId = "nonexistent"
295− , citationPrefix = []
296− , citationSuffix = []
297− , citationMode = NormalCitation
298− , citationNoteNum = 0
300− in (para $ cite [citation] "[@nonexistent]")
302− , "Citation containing text" =:
303− "[see @item1 p. 34-35]" =?>
304− let citation = Citation
305− { citationId = "item1"
306− , citationPrefix = [Str "see"]
307− , citationSuffix = [Space ,Str "p.",Space,Str "34-35"]
308− , citationMode = NormalCitation
309− , citationNoteNum = 0
311− in (para $ cite [citation] "[see @item1 p. 34-35]")
313− , "Org-ref simple citation" =:
315− let citation = Citation
316− { citationId = "pandoc"
317− , citationPrefix = mempty
318− , citationSuffix = mempty
319− , citationMode = AuthorInText
320− , citationNoteNum = 0
323− in (para $ cite [citation] "cite:pandoc")
325− , "Org-ref simple citation with underscores" =:
326− "cite:pandoc_org_ref" =?>
327− let citation = Citation
328− { citationId = "pandoc_org_ref"
329− , citationPrefix = mempty
330− , citationSuffix = mempty
331− , citationMode = AuthorInText
332− , citationNoteNum = 0
335− in (para $ cite [citation] "cite:pandoc_org_ref")
337− , "Org-ref simple citation succeeded by comma" =:
339− let citation = Citation
340− { citationId = "pandoc"
341− , citationPrefix = mempty
342− , citationSuffix = mempty
343− , citationMode = AuthorInText
344− , citationNoteNum = 0
347− in (para $ cite [citation] "cite:pandoc" <> str ",")
349− , "Org-ref simple citation succeeded by dot" =:
351− let citation = Citation
352− { citationId = "pandoc"
353− , citationPrefix = mempty
354− , citationSuffix = mempty
355− , citationMode = AuthorInText
356− , citationNoteNum = 0
359− in (para $ cite [citation] "cite:pandoc" <> str ".")
361− , "Org-ref simple citation succeeded by colon" =:
363− let citation = Citation
364− { citationId = "pandoc"
365− , citationPrefix = mempty
366− , citationSuffix = mempty
367− , citationMode = AuthorInText
368− , citationNoteNum = 0
371− in (para $ cite [citation] "cite:pandoc" <> str ":")
373− , "Org-ref simple citep citation" =:
375− let citation = Citation
376− { citationId = "pandoc"
377− , citationPrefix = mempty
378− , citationSuffix = mempty
379− , citationMode = NormalCitation
380− , citationNoteNum = 0
383− in (para $ cite [citation] "citep:pandoc")
385− , "Org-ref extended citation" =:
386− "[[citep:Dominik201408][See page 20::, for example]]" =?>
387− let citation = Citation
388− { citationId = "Dominik201408"
389− , citationPrefix = toList "See page 20"
390− , citationSuffix = toList ", for example"
391− , citationMode = NormalCitation
392− , citationNoteNum = 0
395− in (para $ cite [citation] "[[citep:Dominik201408][See page 20::, for example]]")
397− , testGroup "Berkeley-style citations" $
398− let pandocCite = Citation
399− { citationId = "Pandoc"
400− , citationPrefix = mempty
401− , citationSuffix = mempty
402− , citationMode = NormalCitation
403− , citationNoteNum = 0
406− pandocInText = pandocCite { citationMode = AuthorInText }
407− dominikCite = Citation
408− { citationId = "Dominik201408"
409− , citationPrefix = mempty
410− , citationSuffix = mempty
411− , citationMode = NormalCitation
412− , citationNoteNum = 0
415− dominikInText = dominikCite { citationMode = AuthorInText }
417− "Berkeley-style in-text citation" =:
418− "See @Dominik201408." =?>
420− <> cite [dominikInText] "@Dominik201408"
423− , "Berkeley-style parenthetical citation list" =:
424− "[(cite): see; @Dominik201408;also @Pandoc; and others]" =?>
425− let pandocCite' = pandocCite {
426− citationPrefix = toList "also"
427− , citationSuffix = toList "and others"
429− dominikCite' = dominikCite {
430− citationPrefix = toList "see"
432− in (para $ cite [dominikCite', pandocCite'] "")
434− , "Berkeley-style plain citation list" =:
435− "[cite: See; @Dominik201408; and @Pandoc; and others]" =?>
436− let pandocCite' = pandocInText {
437− citationPrefix = toList "and"
440− <> cite [dominikInText] ""
442− <> cite [pandocCite'] ""
443− <> "," <> space <> "and others")
446 , "Inline LaTeX symbol" =:
291 , "Inline LaTeX symbol" =:
447 "\\dots" =?>
292 "\\dots" =?>
@@ -483,17 +328,6 @@ tests =
483 "\\ForAll \\Auml" =?>
328 "\\ForAll \\Auml" =?>
484 para "∀ Ä"
329 para "∀ Ä"
486− , "LaTeX citation" =:
487− "\\cite{Coffee}" =?>
488− let citation = Citation
489− { citationId = "Coffee"
490− , citationPrefix = []
491− , citationSuffix = []
492− , citationMode = NormalCitation
493− , citationNoteNum = 0
495− in (para . cite [citation] $ rawInline "latex" "\\cite{Coffee}")
497 , "Macro" =:
331 , "Macro" =:
498 T.unlines [ "#+MACRO: HELLO /Hello, $1/"
332 T.unlines [ "#+MACRO: HELLO /Hello, $1/"
499 , "{{{HELLO(World)}}}"
333 , "{{{HELLO(World)}}}"
@@ -512,6 +346,7 @@ tests =
513 para "Foo Bar"
347 para "Foo Bar"
349+ , testGroup "Citations" Citation.tests
515 , testGroup "Footnotes" Note.tests
350 , testGroup "Footnotes" Note.tests
516 , testGroup "Smart punctuation" Smart.tests
351 , testGroup "Smart punctuation" Smart.tests