37a82b0b11
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
42 lines
1.1 KiB
Haskell
42 lines
1.1 KiB
Haskell
{-# LANGUAGE NoImplicitPrelude #-}
|
|
{- |
|
|
Module : Tests.Readers.Org.Shared
|
|
Copyright : © 2014-2019 Albert Krewinkel
|
|
License : GNU GPL, version 2 or above
|
|
|
|
Maintainer : Albert Krewinkel <albert@zeitkraut.de>
|
|
Stability : alpha
|
|
Portability : portable
|
|
|
|
Helper functions used by other org tests.
|
|
-}
|
|
module Tests.Readers.Org.Shared
|
|
( (=:)
|
|
, org
|
|
, spcSep
|
|
, tagSpan
|
|
) where
|
|
|
|
import Prelude
|
|
import Data.List (intersperse)
|
|
import Data.Text (Text)
|
|
import Tests.Helpers (ToString, purely, test)
|
|
import Test.Tasty (TestTree)
|
|
import Text.Pandoc (Pandoc, ReaderOptions (readerExtensions),
|
|
def, getDefaultExtensions, readOrg)
|
|
import Text.Pandoc.Builder (Inlines, smallcaps, space, spanWith, str)
|
|
|
|
org :: Text -> Pandoc
|
|
org = purely $ readOrg def{ readerExtensions = getDefaultExtensions "org" }
|
|
|
|
infix 4 =:
|
|
(=:) :: ToString c
|
|
=> String -> (Text, c) -> TestTree
|
|
(=:) = test org
|
|
|
|
spcSep :: [Inlines] -> Inlines
|
|
spcSep = mconcat . intersperse space
|
|
|
|
-- | Create a span for the given tag.
|
|
tagSpan :: String -> Inlines
|
|
tagSpan t = spanWith ("", ["tag"], [("tag-name", t)]) . smallcaps $ str t
|