-- | Defines functions used in the Reference Material section.
module Drasil.Sections.ReferenceMaterial (intro, emptySectSentPlu, emptySectSentSing) where
{-
Depending where this is used, it might be worth combining it with other module(s),
or simply moving it to Data.Drasil.Documentation since it's highly reusable
If anything, this could be called by the recipes that need it
-}
import Language.Drasil
import Language.Drasil.Sentence.Combinators (are, is)

-- | Default Reference Material section introduction.
intro :: Contents
intro :: Contents
intro = Sentence -> Contents
mkParagraph forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"This section records information for easy reference."

data Plurality = Sing | Plu

-- | Helper to create default `Sentence`s for empty sections using `NamedIdea`s
emptySectSent :: NamedIdea n => Plurality -> [n] -> Sentence
emptySectSent :: forall n. NamedIdea n => Plurality -> [n] -> Sentence
emptySectSent Plurality
p [n]
n = [Sentence] -> Sentence
foldlSent [Plurality -> Sentence -> Sentence -> Sentence
verb Plurality
p (String -> Sentence
S String
"There") (String -> Sentence
S String
"no"), SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
Options (forall a b. (a -> b) -> [a] -> [b]
map (forall {n}. NamedIdea n => Plurality -> n -> Sentence
f Plurality
p) [n]
n)]
    where 
        verb :: Plurality -> Sentence -> Sentence -> Sentence
verb Plurality
Sing = Sentence -> Sentence -> Sentence
is
        verb Plurality
Plu  = Sentence -> Sentence -> Sentence
are
        f :: Plurality -> n -> Sentence
f Plurality
Sing = forall n. NamedIdea n => n -> Sentence
phrase
        f Plurality
Plu  = forall n. NamedIdea n => n -> Sentence
plural

-- | Helper for variants of `emptySectSent`
emptySectSentSing, emptySectSentPlu :: NamedIdea n => [n] -> Sentence
emptySectSentSing :: forall n. NamedIdea n => [n] -> Sentence
emptySectSentSing = forall n. NamedIdea n => Plurality -> [n] -> Sentence
emptySectSent Plurality
Sing
emptySectSentPlu :: forall n. NamedIdea n => [n] -> Sentence
emptySectSentPlu  = forall n. NamedIdea n => Plurality -> [n] -> Sentence
emptySectSent Plurality
Plu