|
Packit Service |
d2f85f |
{-# LANGUAGE OverloadedStrings #-}
|
|
Packit Service |
d2f85f |
module Tests.Readers.Org.Inline (tests) where
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
import Data.List (intersperse)
|
|
Packit Service |
d2f85f |
import Test.Tasty (TestTree, testGroup)
|
|
Packit Service |
d2f85f |
import Tests.Helpers ((=?>))
|
|
Packit Service |
d2f85f |
import Tests.Readers.Org.Shared ((=:), spcSep)
|
|
Packit Service |
d2f85f |
import Text.Pandoc
|
|
Packit Service |
d2f85f |
import Text.Pandoc.Builder
|
|
Packit Service |
d2f85f |
import Text.Pandoc.Shared (underlineSpan)
|
|
Packit Service |
d2f85f |
import qualified Data.Text as T
|
|
Packit Service |
d2f85f |
import qualified Tests.Readers.Org.Inline.Note as Note
|
|
Packit Service |
d2f85f |
import qualified Tests.Readers.Org.Inline.Smart as Smart
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
tests :: [TestTree]
|
|
Packit Service |
d2f85f |
tests =
|
|
Packit Service |
d2f85f |
[ "Plain String" =:
|
|
Packit Service |
d2f85f |
"Hello, World" =?>
|
|
Packit Service |
d2f85f |
para (spcSep [ "Hello,", "World" ])
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Emphasis" =:
|
|
Packit Service |
d2f85f |
"/Planet Punk/" =?>
|
|
Packit Service |
d2f85f |
para (emph . spcSep $ ["Planet", "Punk"])
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Strong" =:
|
|
Packit Service |
d2f85f |
"*Cider*" =?>
|
|
Packit Service |
d2f85f |
para (strong "Cider")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Strong Emphasis" =:
|
|
Packit Service |
d2f85f |
"/*strength*/" =?>
|
|
Packit Service |
d2f85f |
para (emph . strong $ "strength")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Emphasized Strong preceded by space" =:
|
|
Packit Service |
d2f85f |
" */super/*" =?>
|
|
Packit Service |
d2f85f |
para (strong . emph $ "super")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Underline" =:
|
|
Packit Service |
d2f85f |
"_underline_" =?>
|
|
Packit Service |
d2f85f |
para (underlineSpan $ "underline")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Strikeout" =:
|
|
Packit Service |
d2f85f |
"+Kill Bill+" =?>
|
|
Packit Service |
d2f85f |
para (strikeout . spcSep $ [ "Kill", "Bill" ])
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Verbatim" =:
|
|
Packit Service |
d2f85f |
"=Robot.rock()=" =?>
|
|
Packit Service |
d2f85f |
para (code "Robot.rock()")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Code" =:
|
|
Packit Service |
d2f85f |
"~word for word~" =?>
|
|
Packit Service |
d2f85f |
para (code "word for word")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Math $..$" =:
|
|
Packit Service |
d2f85f |
"$E=mc^2$" =?>
|
|
Packit Service |
d2f85f |
para (math "E=mc^2")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Math $$..$$" =:
|
|
Packit Service |
d2f85f |
"$$E=mc^2$$" =?>
|
|
Packit Service |
d2f85f |
para (displayMath "E=mc^2")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Math \\[..\\]" =:
|
|
Packit Service |
d2f85f |
"\\[E=ℎν\\]" =?>
|
|
Packit Service |
d2f85f |
para (displayMath "E=ℎν")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Math \\(..\\)" =:
|
|
Packit Service |
d2f85f |
"\\(σ_x σ_p ≥ \\frac{ℏ}{2}\\)" =?>
|
|
Packit Service |
d2f85f |
para (math "σ_x σ_p ≥ \\frac{ℏ}{2}")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Symbol" =:
|
|
Packit Service |
d2f85f |
"A * symbol" =?>
|
|
Packit Service |
d2f85f |
para (str "A" <> space <> str "*" <> space <> "symbol")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Superscript simple expression" =:
|
|
Packit Service |
d2f85f |
"2^-λ" =?>
|
|
Packit Service |
d2f85f |
para (str "2" <> superscript "-λ")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Superscript multi char" =:
|
|
Packit Service |
d2f85f |
"2^{n-1}" =?>
|
|
Packit Service |
d2f85f |
para (str "2" <> superscript "n-1")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Subscript simple expression" =:
|
|
Packit Service |
d2f85f |
"a_n" =?>
|
|
Packit Service |
d2f85f |
para (str "a" <> subscript "n")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Subscript multi char" =:
|
|
Packit Service |
d2f85f |
"a_{n+1}" =?>
|
|
Packit Service |
d2f85f |
para (str "a" <> subscript "n+1")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Linebreak" =:
|
|
Packit Service |
d2f85f |
"line \\\\ \nbreak" =?>
|
|
Packit Service |
d2f85f |
para ("line" <> linebreak <> "break")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Inline note" =:
|
|
Packit Service |
d2f85f |
"[fn::Schreib mir eine E-Mail]" =?>
|
|
Packit Service |
d2f85f |
para (note $ para "Schreib mir eine E-Mail")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Markup-chars not occuring on word break are symbols" =:
|
|
Packit Service |
d2f85f |
T.unlines [ "this+that+ +so+on"
|
|
Packit Service |
d2f85f |
, "seven*eight* nine*"
|
|
Packit Service |
d2f85f |
, "+not+funny+"
|
|
Packit Service |
d2f85f |
] =?>
|
|
Packit Service |
d2f85f |
para ("this+that+ +so+on" <> softbreak <>
|
|
Packit Service |
d2f85f |
"seven*eight* nine*" <> softbreak <>
|
|
Packit Service |
d2f85f |
strikeout "not+funny")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "No empty markup" =:
|
|
Packit Service |
d2f85f |
"// ** __ <> == ~~ $$" =?>
|
|
Packit Service |
d2f85f |
para (spcSep [ "//", "**", "__", "<>", "==", "~~", "$$" ])
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Adherence to Org's rules for markup borders" =:
|
|
Packit Service |
d2f85f |
"/t/& a/ / ./r/ (*l*) /e/! /b/." =?>
|
|
Packit Service |
d2f85f |
para (spcSep [ emph $ "t/&" <> space <> "a"
|
|
Packit Service |
d2f85f |
, "/"
|
|
Packit Service |
d2f85f |
, "./r/"
|
|
Packit Service |
d2f85f |
, "(" <> strong "l" <> ")"
|
|
Packit Service |
d2f85f |
, emph "e" <> "!"
|
|
Packit Service |
d2f85f |
, emph "b" <> "."
|
|
Packit Service |
d2f85f |
])
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Quotes are allowed border chars" =:
|
|
Packit Service |
d2f85f |
"/'yep/ *sure\"*" =?>
|
|
Packit Service |
d2f85f |
para (emph "'yep" <> space <> strong "sure\"")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Spaces are forbidden border chars" =:
|
|
Packit Service |
d2f85f |
"/nada /" =?>
|
|
Packit Service |
d2f85f |
para "/nada /"
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Markup should work properly after a blank line" =:
|
|
Packit Service |
d2f85f |
T.unlines ["foo", "", "/bar/"] =?>
|
|
Packit Service |
d2f85f |
(para $ text "foo") <> (para $ emph $ text "bar")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Inline math must stay within three lines" =:
|
|
Packit Service |
d2f85f |
T.unlines [ "$a", "b", "c$", "$d", "e", "f", "g$" ] =?>
|
|
Packit Service |
d2f85f |
para ((math "a\nb\nc") <> softbreak <>
|
|
Packit Service |
d2f85f |
"$d" <> softbreak <> "e" <> softbreak <>
|
|
Packit Service |
d2f85f |
"f" <> softbreak <> "g$")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Single-character math" =:
|
|
Packit Service |
d2f85f |
"$a$ $b$! $c$?" =?>
|
|
Packit Service |
d2f85f |
para (spcSep [ math "a"
|
|
Packit Service |
d2f85f |
, "$b$!"
|
|
Packit Service |
d2f85f |
, (math "c") <> "?"
|
|
Packit Service |
d2f85f |
])
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Markup may not span more than two lines" =:
|
|
Packit Service |
d2f85f |
"/this *is +totally\nnice+ not*\nemph/" =?>
|
|
Packit Service |
d2f85f |
para ("/this" <> space <>
|
|
Packit Service |
d2f85f |
strong ("is" <> space <>
|
|
Packit Service |
d2f85f |
strikeout ("totally" <>
|
|
Packit Service |
d2f85f |
softbreak <> "nice") <>
|
|
Packit Service |
d2f85f |
space <> "not") <>
|
|
Packit Service |
d2f85f |
softbreak <> "emph/")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Sub- and superscript expressions" =:
|
|
Packit Service |
d2f85f |
T.unlines [ "a_(a(b)(c)d)"
|
|
Packit Service |
d2f85f |
, "e^(f(g)h)"
|
|
Packit Service |
d2f85f |
, "i_(jk)l)"
|
|
Packit Service |
d2f85f |
, "m^()n"
|
|
Packit Service |
d2f85f |
, "o_{p{q{}r}}"
|
|
Packit Service |
d2f85f |
, "s^{t{u}v}"
|
|
Packit Service |
d2f85f |
, "w_{xy}z}"
|
|
Packit Service |
d2f85f |
, "1^{}2"
|
|
Packit Service |
d2f85f |
, "3_{{}}"
|
|
Packit Service |
d2f85f |
, "4^(a(*b(c*)d))"
|
|
Packit Service |
d2f85f |
] =?>
|
|
Packit Service |
d2f85f |
para (mconcat $ intersperse softbreak
|
|
Packit Service |
d2f85f |
[ "a" <> subscript "(a(b)(c)d)"
|
|
Packit Service |
d2f85f |
, "e" <> superscript "(f(g)h)"
|
|
Packit Service |
d2f85f |
, "i" <> (subscript "(jk)") <> "l)"
|
|
Packit Service |
d2f85f |
, "m" <> (superscript "()") <> "n"
|
|
Packit Service |
d2f85f |
, "o" <> subscript "p{q{}r}"
|
|
Packit Service |
d2f85f |
, "s" <> superscript "t{u}v"
|
|
Packit Service |
d2f85f |
, "w" <> (subscript "xy") <> "z}"
|
|
Packit Service |
d2f85f |
, "1" <> (superscript "") <> "2"
|
|
Packit Service |
d2f85f |
, "3" <> subscript "{}"
|
|
Packit Service |
d2f85f |
, "4" <> superscript ("(a(" <> strong "b(c" <> ")d))")
|
|
Packit Service |
d2f85f |
])
|
|
Packit Service |
d2f85f |
, "Verbatim text can contain equal signes (=)" =:
|
|
Packit Service |
d2f85f |
"=is_subst = True=" =?>
|
|
Packit Service |
d2f85f |
para (code "is_subst = True")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, testGroup "Images"
|
|
Packit Service |
d2f85f |
[ "Image" =:
|
|
Packit Service |
d2f85f |
"[[./sunset.jpg]]" =?>
|
|
Packit Service |
d2f85f |
(para $ image "./sunset.jpg" "" "")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Image with explicit file: prefix" =:
|
|
Packit Service |
d2f85f |
"[[file:sunrise.jpg]]" =?>
|
|
Packit Service |
d2f85f |
(para $ image "sunrise.jpg" "" "")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Multiple images within a paragraph" =:
|
|
Packit Service |
d2f85f |
T.unlines [ "[[file:sunrise.jpg]]"
|
|
Packit Service |
d2f85f |
, "[[file:sunset.jpg]]"
|
|
Packit Service |
d2f85f |
] =?>
|
|
Packit Service |
d2f85f |
(para $ (image "sunrise.jpg" "" "")
|
|
Packit Service |
d2f85f |
<> softbreak
|
|
Packit Service |
d2f85f |
<> (image "sunset.jpg" "" ""))
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Image with html attributes" =:
|
|
Packit Service |
d2f85f |
T.unlines [ "#+ATTR_HTML: :width 50%"
|
|
Packit Service |
d2f85f |
, "[[file:guinea-pig.gif]]"
|
|
Packit Service |
d2f85f |
] =?>
|
|
Packit Service |
d2f85f |
(para $ imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "")
|
|
Packit Service |
d2f85f |
]
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Explicit link" =:
|
|
Packit Service |
d2f85f |
"[[http://zeitlens.com/][pseudo-random /nonsense/]]" =?>
|
|
Packit Service |
d2f85f |
(para $ link "http://zeitlens.com/" ""
|
|
Packit Service |
d2f85f |
("pseudo-random" <> space <> emph "nonsense"))
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Self-link" =:
|
|
Packit Service |
d2f85f |
"[[http://zeitlens.com/]]" =?>
|
|
Packit Service |
d2f85f |
(para $ link "http://zeitlens.com/" "" "http://zeitlens.com/")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Absolute file link" =:
|
|
Packit Service |
d2f85f |
"[[/url][hi]]" =?>
|
|
Packit Service |
d2f85f |
(para $ link "file:///url" "" "hi")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Link to file in parent directory" =:
|
|
Packit Service |
d2f85f |
"[[../file.txt][moin]]" =?>
|
|
Packit Service |
d2f85f |
(para $ link "../file.txt" "" "moin")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Empty link (for gitit interop)" =:
|
|
Packit Service |
d2f85f |
"[[][New Link]]" =?>
|
|
Packit Service |
d2f85f |
(para $ link "" "" "New Link")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Image link" =:
|
|
Packit Service |
d2f85f |
"[[sunset.png][file:dusk.svg]]" =?>
|
|
Packit Service |
d2f85f |
(para $ link "sunset.png" "" (image "dusk.svg" "" ""))
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Image link with non-image target" =:
|
|
Packit Service |
d2f85f |
"[[http://example.com][./logo.png]]" =?>
|
|
Packit Service |
d2f85f |
(para $ link "http://example.com" "" (image "./logo.png" "" ""))
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Plain link" =:
|
|
Packit Service |
d2f85f |
"Posts on http://zeitlens.com/ can be funny at times." =?>
|
|
Packit Service |
d2f85f |
(para $ spcSep [ "Posts", "on"
|
|
Packit Service |
d2f85f |
, link "http://zeitlens.com/" "" "http://zeitlens.com/"
|
|
Packit Service |
d2f85f |
, "can", "be", "funny", "at", "times."
|
|
Packit Service |
d2f85f |
])
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Angle link" =:
|
|
Packit Service |
d2f85f |
"Look at <http://moltkeplatz.de> for fnords." =?>
|
|
Packit Service |
d2f85f |
(para $ spcSep [ "Look", "at"
|
|
Packit Service |
d2f85f |
, link "http://moltkeplatz.de" "" "http://moltkeplatz.de"
|
|
Packit Service |
d2f85f |
, "for", "fnords."
|
|
Packit Service |
d2f85f |
])
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Absolute file link" =:
|
|
Packit Service |
d2f85f |
"[[file:///etc/passwd][passwd]]" =?>
|
|
Packit Service |
d2f85f |
(para $ link "file:///etc/passwd" "" "passwd")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "File link" =:
|
|
Packit Service |
d2f85f |
"[[file:target][title]]" =?>
|
|
Packit Service |
d2f85f |
(para $ link "target" "" "title")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Anchor" =:
|
|
Packit Service |
d2f85f |
"<<anchor>> Link here later." =?>
|
|
Packit Service |
d2f85f |
(para $ spanWith ("anchor", [], []) mempty <>
|
|
Packit Service |
d2f85f |
"Link" <> space <> "here" <> space <> "later.")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Inline code block" =:
|
|
Packit Service |
d2f85f |
"src_emacs-lisp{(message \"Hello\")}" =?>
|
|
Packit Service |
d2f85f |
(para $ codeWith ( ""
|
|
Packit Service |
d2f85f |
, [ "commonlisp" ]
|
|
Packit Service |
d2f85f |
, [ ("org-language", "emacs-lisp") ])
|
|
Packit Service |
d2f85f |
"(message \"Hello\")")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Inline code block with arguments" =:
|
|
Packit Service |
d2f85f |
"src_sh[:export both :results output]{echo 'Hello, World'}" =?>
|
|
Packit Service |
d2f85f |
(para $ codeWith ( ""
|
|
Packit Service |
d2f85f |
, [ "bash" ]
|
|
Packit Service |
d2f85f |
, [ ("org-language", "sh")
|
|
Packit Service |
d2f85f |
, ("export", "both")
|
|
Packit Service |
d2f85f |
, ("results", "output")
|
|
Packit Service |
d2f85f |
]
|
|
Packit Service |
d2f85f |
)
|
|
Packit Service |
d2f85f |
"echo 'Hello, World'")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Inline code block with toggle" =:
|
|
Packit Service |
d2f85f |
"src_sh[:toggle]{echo $HOME}" =?>
|
|
Packit Service |
d2f85f |
(para $ codeWith ( ""
|
|
Packit Service |
d2f85f |
, [ "bash" ]
|
|
Packit Service |
d2f85f |
, [ ("org-language", "sh")
|
|
Packit Service |
d2f85f |
, ("toggle", "yes")
|
|
Packit Service |
d2f85f |
]
|
|
Packit Service |
d2f85f |
)
|
|
Packit Service |
d2f85f |
"echo $HOME")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Citation" =:
|
|
Packit Service |
d2f85f |
"[@nonexistent]" =?>
|
|
Packit Service |
d2f85f |
let citation = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "nonexistent"
|
|
Packit Service |
d2f85f |
, citationPrefix = []
|
|
Packit Service |
d2f85f |
, citationSuffix = []
|
|
Packit Service |
d2f85f |
, citationMode = NormalCitation
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0}
|
|
Packit Service |
d2f85f |
in (para $ cite [citation] "[@nonexistent]")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Citation containing text" =:
|
|
Packit Service |
d2f85f |
"[see @item1 p. 34-35]" =?>
|
|
Packit Service |
d2f85f |
let citation = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "item1"
|
|
Packit Service |
d2f85f |
, citationPrefix = [Str "see"]
|
|
Packit Service |
d2f85f |
, citationSuffix = [Space ,Str "p.",Space,Str "34-35"]
|
|
Packit Service |
d2f85f |
, citationMode = NormalCitation
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0}
|
|
Packit Service |
d2f85f |
in (para $ cite [citation] "[see @item1 p. 34-35]")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Org-ref simple citation" =:
|
|
Packit Service |
d2f85f |
"cite:pandoc" =?>
|
|
Packit Service |
d2f85f |
let citation = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "pandoc"
|
|
Packit Service |
d2f85f |
, citationPrefix = mempty
|
|
Packit Service |
d2f85f |
, citationSuffix = mempty
|
|
Packit Service |
d2f85f |
, citationMode = AuthorInText
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
in (para $ cite [citation] "cite:pandoc")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Org-ref simple citation with underscores" =:
|
|
Packit Service |
d2f85f |
"cite:pandoc_org_ref" =?>
|
|
Packit Service |
d2f85f |
let citation = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "pandoc_org_ref"
|
|
Packit Service |
d2f85f |
, citationPrefix = mempty
|
|
Packit Service |
d2f85f |
, citationSuffix = mempty
|
|
Packit Service |
d2f85f |
, citationMode = AuthorInText
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
in (para $ cite [citation] "cite:pandoc_org_ref")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Org-ref simple citation succeeded by comma" =:
|
|
Packit Service |
d2f85f |
"cite:pandoc," =?>
|
|
Packit Service |
d2f85f |
let citation = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "pandoc"
|
|
Packit Service |
d2f85f |
, citationPrefix = mempty
|
|
Packit Service |
d2f85f |
, citationSuffix = mempty
|
|
Packit Service |
d2f85f |
, citationMode = AuthorInText
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
in (para $ cite [citation] "cite:pandoc" <> str ",")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Org-ref simple citation succeeded by dot" =:
|
|
Packit Service |
d2f85f |
"cite:pandoc." =?>
|
|
Packit Service |
d2f85f |
let citation = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "pandoc"
|
|
Packit Service |
d2f85f |
, citationPrefix = mempty
|
|
Packit Service |
d2f85f |
, citationSuffix = mempty
|
|
Packit Service |
d2f85f |
, citationMode = AuthorInText
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
in (para $ cite [citation] "cite:pandoc" <> str ".")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Org-ref simple citation succeeded by colon" =:
|
|
Packit Service |
d2f85f |
"cite:pandoc:" =?>
|
|
Packit Service |
d2f85f |
let citation = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "pandoc"
|
|
Packit Service |
d2f85f |
, citationPrefix = mempty
|
|
Packit Service |
d2f85f |
, citationSuffix = mempty
|
|
Packit Service |
d2f85f |
, citationMode = AuthorInText
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
in (para $ cite [citation] "cite:pandoc" <> str ":")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Org-ref simple citep citation" =:
|
|
Packit Service |
d2f85f |
"citep:pandoc" =?>
|
|
Packit Service |
d2f85f |
let citation = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "pandoc"
|
|
Packit Service |
d2f85f |
, citationPrefix = mempty
|
|
Packit Service |
d2f85f |
, citationSuffix = mempty
|
|
Packit Service |
d2f85f |
, citationMode = NormalCitation
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
in (para $ cite [citation] "citep:pandoc")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Org-ref extended citation" =:
|
|
Packit Service |
d2f85f |
"[[citep:Dominik201408][See page 20::, for example]]" =?>
|
|
Packit Service |
d2f85f |
let citation = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "Dominik201408"
|
|
Packit Service |
d2f85f |
, citationPrefix = toList "See page 20"
|
|
Packit Service |
d2f85f |
, citationSuffix = toList ", for example"
|
|
Packit Service |
d2f85f |
, citationMode = NormalCitation
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
in (para $ cite [citation] "[[citep:Dominik201408][See page 20::, for example]]")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, testGroup "Berkeley-style citations" $
|
|
Packit Service |
d2f85f |
let pandocCite = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "Pandoc"
|
|
Packit Service |
d2f85f |
, citationPrefix = mempty
|
|
Packit Service |
d2f85f |
, citationSuffix = mempty
|
|
Packit Service |
d2f85f |
, citationMode = NormalCitation
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
pandocInText = pandocCite { citationMode = AuthorInText }
|
|
Packit Service |
d2f85f |
dominikCite = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "Dominik201408"
|
|
Packit Service |
d2f85f |
, citationPrefix = mempty
|
|
Packit Service |
d2f85f |
, citationSuffix = mempty
|
|
Packit Service |
d2f85f |
, citationMode = NormalCitation
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
dominikInText = dominikCite { citationMode = AuthorInText }
|
|
Packit Service |
d2f85f |
in [
|
|
Packit Service |
d2f85f |
"Berkeley-style in-text citation" =:
|
|
Packit Service |
d2f85f |
"See @Dominik201408." =?>
|
|
Packit Service |
d2f85f |
(para $ "See "
|
|
Packit Service |
d2f85f |
<> cite [dominikInText] "@Dominik201408"
|
|
Packit Service |
d2f85f |
<> ".")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Berkeley-style parenthetical citation list" =:
|
|
Packit Service |
d2f85f |
"[(cite): see; @Dominik201408;also @Pandoc; and others]" =?>
|
|
Packit Service |
d2f85f |
let pandocCite' = pandocCite {
|
|
Packit Service |
d2f85f |
citationPrefix = toList "also"
|
|
Packit Service |
d2f85f |
, citationSuffix = toList "and others"
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
dominikCite' = dominikCite {
|
|
Packit Service |
d2f85f |
citationPrefix = toList "see"
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
in (para $ cite [dominikCite', pandocCite'] "")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Berkeley-style plain citation list" =:
|
|
Packit Service |
d2f85f |
"[cite: See; @Dominik201408; and @Pandoc; and others]" =?>
|
|
Packit Service |
d2f85f |
let pandocCite' = pandocInText {
|
|
Packit Service |
d2f85f |
citationPrefix = toList "and"
|
|
Packit Service |
d2f85f |
}
|
|
Packit Service |
d2f85f |
in (para $ "See "
|
|
Packit Service |
d2f85f |
<> cite [dominikInText] ""
|
|
Packit Service |
d2f85f |
<> "," <> space
|
|
Packit Service |
d2f85f |
<> cite [pandocCite'] ""
|
|
Packit Service |
d2f85f |
<> "," <> space <> "and others")
|
|
Packit Service |
d2f85f |
]
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Inline LaTeX symbol" =:
|
|
Packit Service |
d2f85f |
"\\dots" =?>
|
|
Packit Service |
d2f85f |
para "…"
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Inline LaTeX command" =:
|
|
Packit Service |
d2f85f |
"\\textit{Emphasised}" =?>
|
|
Packit Service |
d2f85f |
para (emph "Emphasised")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Inline LaTeX command with spaces" =:
|
|
Packit Service |
d2f85f |
"\\emph{Emphasis mine}" =?>
|
|
Packit Service |
d2f85f |
para (emph "Emphasis mine")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Inline LaTeX math symbol" =:
|
|
Packit Service |
d2f85f |
"\\tau" =?>
|
|
Packit Service |
d2f85f |
para (emph "τ")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Unknown inline LaTeX command" =:
|
|
Packit Service |
d2f85f |
"\\notacommand{foo}" =?>
|
|
Packit Service |
d2f85f |
para (rawInline "latex" "\\notacommand{foo}")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Export snippet" =:
|
|
Packit Service |
d2f85f |
"@@html:M-x org-agenda@@" =?>
|
|
Packit Service |
d2f85f |
para (rawInline "html" "M-x org-agenda")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "MathML symbol in LaTeX-style" =:
|
|
Packit Service |
d2f85f |
"There is a hackerspace in Lübeck, Germany, called nbsp (unicode symbol: '\\nbsp')." =?>
|
|
Packit Service |
d2f85f |
para ("There is a hackerspace in Lübeck, Germany, called nbsp (unicode symbol: ' ').")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "MathML symbol in LaTeX-style, including braces" =:
|
|
Packit Service |
d2f85f |
"\\Aacute{}stor" =?>
|
|
Packit Service |
d2f85f |
para "Ástor"
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "MathML copy sign" =:
|
|
Packit Service |
d2f85f |
"\\copy" =?>
|
|
Packit Service |
d2f85f |
para "©"
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "MathML symbols, space separated" =:
|
|
Packit Service |
d2f85f |
"\\ForAll \\Auml" =?>
|
|
Packit Service |
d2f85f |
para "∀ Ä"
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "LaTeX citation" =:
|
|
Packit Service |
d2f85f |
"\\cite{Coffee}" =?>
|
|
Packit Service |
d2f85f |
let citation = Citation
|
|
Packit Service |
d2f85f |
{ citationId = "Coffee"
|
|
Packit Service |
d2f85f |
, citationPrefix = []
|
|
Packit Service |
d2f85f |
, citationSuffix = []
|
|
Packit Service |
d2f85f |
, citationMode = NormalCitation
|
|
Packit Service |
d2f85f |
, citationNoteNum = 0
|
|
Packit Service |
d2f85f |
, citationHash = 0}
|
|
Packit Service |
d2f85f |
in (para . cite [citation] $ rawInline "latex" "\\cite{Coffee}")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Macro" =:
|
|
Packit Service |
d2f85f |
T.unlines [ "#+MACRO: HELLO /Hello, $1/"
|
|
Packit Service |
d2f85f |
, "{{{HELLO(World)}}}"
|
|
Packit Service |
d2f85f |
] =?>
|
|
Packit Service |
d2f85f |
para (emph "Hello, World")
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Macro repeting its argument" =:
|
|
Packit Service |
d2f85f |
T.unlines [ "#+MACRO: HELLO $1$1"
|
|
Packit Service |
d2f85f |
, "{{{HELLO(moin)}}}"
|
|
Packit Service |
d2f85f |
] =?>
|
|
Packit Service |
d2f85f |
para "moinmoin"
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, "Macro called with too few arguments" =:
|
|
Packit Service |
d2f85f |
T.unlines [ "#+MACRO: HELLO Foo $1 $2 Bar"
|
|
Packit Service |
d2f85f |
, "{{{HELLO()}}}"
|
|
Packit Service |
d2f85f |
] =?>
|
|
Packit Service |
d2f85f |
para "Foo Bar"
|
|
Packit Service |
d2f85f |
|
|
Packit Service |
d2f85f |
, testGroup "Footnotes" Note.tests
|
|
Packit Service |
d2f85f |
, testGroup "Smart punctuation" Smart.tests
|
|
Packit Service |
d2f85f |
]
|