module Drasil.DocumentLanguage.Notebook.DocumentLanguage(mkNb) where
import Drasil.DocumentLanguage.Notebook.LsnDecl (LsnDecl, mkLsnDesc)
import Drasil.DocumentLanguage.Notebook.Core (LsnDesc, LsnChapter(..),
Intro(..), LearnObj(..), Review(..), CaseProb(..), Example(..), Smmry(..), Apndx(..))
import Language.Drasil hiding (kind)
import SysInfo.Drasil (SystemInformation(SI), _authors, _kind, _sys, citeDB)
import qualified Drasil.DocLang.Notebook as Lsn (intro, learnObj, caseProb, example,
appendix, review, reference, summary)
mkNb :: LsnDecl -> (IdeaDict -> IdeaDict -> Sentence) -> SystemInformation -> Document
mkNb :: LsnDecl
-> (IdeaDict -> IdeaDict -> Sentence)
-> SystemInformation
-> Document
mkNb LsnDecl
dd IdeaDict -> IdeaDict -> Sentence
comb si :: SystemInformation
si@SI {_sys :: ()
_sys = a
sys, _kind :: ()
_kind = b
kind, _authors :: ()
_authors = [c]
authors} =
Sentence -> Sentence -> [Section] -> Document
Notebook (forall c. Idea c => c -> IdeaDict
nw b
kind IdeaDict -> IdeaDict -> Sentence
`comb` forall c. Idea c => c -> IdeaDict
nw a
sys) (SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map (String -> Sentence
S forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n. HasName n => n -> String
name) [c]
authors) forall a b. (a -> b) -> a -> b
$
SystemInformation -> LsnDesc -> [Section]
mkSections SystemInformation
si LsnDesc
l where
l :: LsnDesc
l = SystemInformation -> LsnDecl -> LsnDesc
mkLsnDesc SystemInformation
si LsnDecl
dd
mkSections :: SystemInformation -> LsnDesc -> [Section]
mkSections :: SystemInformation -> LsnDesc -> [Section]
mkSections SystemInformation
si = forall a b. (a -> b) -> [a] -> [b]
map LsnChapter -> Section
doit
where
doit :: LsnChapter -> Section
doit :: LsnChapter -> Section
doit (Intro Intro
i) = Intro -> Section
mkIntro Intro
i
doit (LearnObj LearnObj
lo) = LearnObj -> Section
mkLearnObj LearnObj
lo
doit (Review Review
r) = Review -> Section
mkReview Review
r
doit (CaseProb CaseProb
cp) = CaseProb -> Section
mkCaseProb CaseProb
cp
doit (Example Example
e) = Example -> Section
mkExample Example
e
doit (Smmry Smmry
s) = Smmry -> Section
mkSmmry Smmry
s
doit LsnChapter
BibSec = BibRef -> Section
mkBib (SystemInformation -> BibRef
citeDB SystemInformation
si)
doit (Apndx Apndx
a) = Apndx -> Section
mkAppndx Apndx
a
mkIntro :: Intro -> Section
mkIntro :: Intro -> Section
mkIntro (IntrodProg [Contents]
i) = [Contents] -> [Section] -> Section
Lsn.intro [Contents]
i []
mkLearnObj :: LearnObj -> Section
mkLearnObj :: LearnObj -> Section
mkLearnObj (LrnObjProg [Contents]
cs) = [Contents] -> [Section] -> Section
Lsn.learnObj [Contents]
cs []
mkReview :: Review -> Section
mkReview :: Review -> Section
mkReview (ReviewProg [Contents]
r) = [Contents] -> [Section] -> Section
Lsn.review [Contents]
r []
mkCaseProb :: CaseProb -> Section
mkCaseProb :: CaseProb -> Section
mkCaseProb (CaseProbProg [Contents]
cp) = [Contents] -> [Section] -> Section
Lsn.caseProb [Contents]
cp []
mkExample:: Example -> Section
mkExample :: Example -> Section
mkExample (ExampleProg [Contents]
cs) = [Contents] -> [Section] -> Section
Lsn.example [Contents]
cs []
mkSmmry :: Smmry -> Section
mkSmmry :: Smmry -> Section
mkSmmry (SmmryProg [Contents]
cs) = [Contents] -> [Section] -> Section
Lsn.summary [Contents]
cs []
mkBib :: BibRef -> Section
mkBib :: BibRef -> Section
mkBib BibRef
bib = [Contents] -> [Section] -> Section
Lsn.reference [UnlabelledContent -> Contents
UlC forall a b. (a -> b) -> a -> b
$ RawContent -> UnlabelledContent
ulcc (BibRef -> RawContent
Bib BibRef
bib)] []
mkAppndx :: Apndx -> Section
mkAppndx :: Apndx -> Section
mkAppndx (ApndxProg [Contents]
cs) = [Contents] -> [Section] -> Section
Lsn.appendix [Contents]
cs []