@@ -5,10 +5,10 @@ import Data.List (intersperse)
55import Test.Tasty (TestTree, testGroup)
66import Tests.Helpers ((=?>))
77import Tests.Readers.Org.Shared ((=:), spcSep)
8−import Text.Pandoc
98import Text.Pandoc.Builder
109import Text.Pandoc.Shared (underlineSpan)
1110import qualified Data.Text as T
11+import qualified Tests.Readers.Org.Inline.Citation as Citation
1212import qualified Tests.Readers.Org.Inline.Note as Note
1313import qualified Tests.Readers.Org.Inline.Smart as Smart
1414
@@ -288,161 +288,6 @@ tests =
288288 )
289289 "echo $HOME")
290290
291− , "Citation" =:
292− "[@nonexistent]" =?>
293− let citation = Citation
294− { citationId = "nonexistent"
295− , citationPrefix = []
296− , citationSuffix = []
297− , citationMode = NormalCitation
298− , citationNoteNum = 0
299− , citationHash = 0}
300− in (para $ cite [citation] "[@nonexistent]")
301−
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
310− , citationHash = 0}
311− in (para $ cite [citation] "[see @item1 p. 34-35]")
312−
313− , "Org-ref simple citation" =:
314− "cite:pandoc" =?>
315− let citation = Citation
316− { citationId = "pandoc"
317− , citationPrefix = mempty
318− , citationSuffix = mempty
319− , citationMode = AuthorInText
320− , citationNoteNum = 0
321− , citationHash = 0
322− }
323− in (para $ cite [citation] "cite:pandoc")
324−
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
333− , citationHash = 0
334− }
335− in (para $ cite [citation] "cite:pandoc_org_ref")
336−
337− , "Org-ref simple citation succeeded by comma" =:
338− "cite:pandoc," =?>
339− let citation = Citation
340− { citationId = "pandoc"
341− , citationPrefix = mempty
342− , citationSuffix = mempty
343− , citationMode = AuthorInText
344− , citationNoteNum = 0
345− , citationHash = 0
346− }
347− in (para $ cite [citation] "cite:pandoc" <> str ",")
348−
349− , "Org-ref simple citation succeeded by dot" =:
350− "cite:pandoc." =?>
351− let citation = Citation
352− { citationId = "pandoc"
353− , citationPrefix = mempty
354− , citationSuffix = mempty
355− , citationMode = AuthorInText
356− , citationNoteNum = 0
357− , citationHash = 0
358− }
359− in (para $ cite [citation] "cite:pandoc" <> str ".")
360−
361− , "Org-ref simple citation succeeded by colon" =:
362− "cite:pandoc:" =?>
363− let citation = Citation
364− { citationId = "pandoc"
365− , citationPrefix = mempty
366− , citationSuffix = mempty
367− , citationMode = AuthorInText
368− , citationNoteNum = 0
369− , citationHash = 0
370− }
371− in (para $ cite [citation] "cite:pandoc" <> str ":")
372−
373− , "Org-ref simple citep citation" =:
374− "citep:pandoc" =?>
375− let citation = Citation
376− { citationId = "pandoc"
377− , citationPrefix = mempty
378− , citationSuffix = mempty
379− , citationMode = NormalCitation
380− , citationNoteNum = 0
381− , citationHash = 0
382− }
383− in (para $ cite [citation] "citep:pandoc")
384−
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
393− , citationHash = 0
394− }
395− in (para $ cite [citation] "[[citep:Dominik201408][See page 20::, for example]]")
396−
397− , testGroup "Berkeley-style citations" $
398− let pandocCite = Citation
399− { citationId = "Pandoc"
400− , citationPrefix = mempty
401− , citationSuffix = mempty
402− , citationMode = NormalCitation
403− , citationNoteNum = 0
404− , citationHash = 0
405− }
406− pandocInText = pandocCite { citationMode = AuthorInText }
407− dominikCite = Citation
408− { citationId = "Dominik201408"
409− , citationPrefix = mempty
410− , citationSuffix = mempty
411− , citationMode = NormalCitation
412− , citationNoteNum = 0
413− , citationHash = 0
414− }
415− dominikInText = dominikCite { citationMode = AuthorInText }
416− in [
417− "Berkeley-style in-text citation" =:
418− "See @Dominik201408." =?>
419− para ("See "
420− <> cite [dominikInText] "@Dominik201408"
421− <> ".")
422−
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"
428− }
429− dominikCite' = dominikCite {
430− citationPrefix = toList "see"
431− }
432− in (para $ cite [dominikCite', pandocCite'] "")
433−
434− , "Berkeley-style plain citation list" =:
435− "[cite: See; @Dominik201408; and @Pandoc; and others]" =?>
436− let pandocCite' = pandocInText {
437− citationPrefix = toList "and"
438− }
439− in (para $ "See "
440− <> cite [dominikInText] ""
441− <> "," <> space
442− <> cite [pandocCite'] ""
443− <> "," <> space <> "and others")
444− ]
445−
446291 , "Inline LaTeX symbol" =:
447292 "\\dots" =?>
448293 para "…"
@@ -483,17 +328,6 @@ tests =
483328 "\\ForAll \\Auml" =?>
484329 para "∀ Ä"
485330
486− , "LaTeX citation" =:
487− "\\cite{Coffee}" =?>
488− let citation = Citation
489− { citationId = "Coffee"
490− , citationPrefix = []
491− , citationSuffix = []
492− , citationMode = NormalCitation
493− , citationNoteNum = 0
494− , citationHash = 0}
495− in (para . cite [citation] $ rawInline "latex" "\\cite{Coffee}")
496−
497331 , "Macro" =:
498332 T.unlines [ "#+MACRO: HELLO /Hello, $1/"
499333 , "{{{HELLO(World)}}}"
@@ -512,6 +346,7 @@ tests =
512346 ] =?>
513347 para "Foo Bar"
514348
349+ , testGroup "Citations" Citation.tests
515350 , testGroup "Footnotes" Note.tests
516351 , testGroup "Smart punctuation" Smart.tests
517352 ]