{-# Language TupleSections #-}
module Drasil.Sections.TableOfContents (toToC, findToC) where
import Language.Drasil
import Drasil.DocumentLanguage.Core
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Drasil.DocLang.SRS as SRS
import qualified Data.Drasil.Concepts.Documentation as Doc
import qualified Data.Drasil.TheoryConcepts as Doc (dataDefn, genDefn, inModel, thModel)
toToC :: DocSection -> ItemType
toToC :: DocSection -> ItemType
toToC DocSection
TableOfContents = ItemType
mktToCSec
toToC (RefSec RefSec
rs) = RefSec -> ItemType
mktRefSec RefSec
rs
toToC (IntroSec IntroSec
i) = IntroSec -> ItemType
mktIntroSec IntroSec
i
toToC (StkhldrSec StkhldrSec
sts) = StkhldrSec -> ItemType
mktStkhldrSec StkhldrSec
sts
toToC (GSDSec GSDSec
gs') = GSDSec -> ItemType
mktGSDSec GSDSec
gs'
toToC (SSDSec SSDSec
ss) = SSDSec -> ItemType
mktSSDSec SSDSec
ss
toToC (ReqrmntSec ReqrmntSec
r) = ReqrmntSec -> ItemType
mktReqrmntSec ReqrmntSec
r
toToC (LCsSec LCsSec
lc) = LCsSec -> ItemType
mktLCsSec LCsSec
lc
toToC (UCsSec UCsSec
ulcs) = UCsSec -> ItemType
mktUCsSec UCsSec
ulcs
toToC (TraceabilitySec TraceabilitySec
t) = TraceabilitySec -> ItemType
mktTraceabilitySec TraceabilitySec
t
toToC (AuxConstntSec AuxConstntSec
acs) = AuxConstntSec -> ItemType
mktAuxConsSec AuxConstntSec
acs
toToC DocSection
Bibliography = ItemType
mktBib
toToC (AppndxSec AppndxSec
a) = AppndxSec -> ItemType
mktAppndxSec AppndxSec
a
toToC (OffShelfSolnsSec OffShelfSolnsSec
o) = OffShelfSolnsSec -> ItemType
mktOffShelfSolnSec OffShelfSolnsSec
o
mkHeaderItem :: Sentence -> [Sentence] -> ItemType
Sentence
hdr [Sentence]
itm = Sentence -> ListType -> ItemType
Nested Sentence
hdr forall a b. (a -> b) -> a -> b
$ [(ItemType, Maybe String)] -> ListType
Bullet forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map (\Sentence
x -> (Sentence -> ItemType
Flat Sentence
x, forall a. Maybe a
Nothing)) [Sentence]
itm
mkHeaderItem' :: Sentence -> [ItemType] -> ItemType
Sentence
hdr [ItemType]
itm = Sentence -> ListType -> ItemType
Nested Sentence
hdr forall a b. (a -> b) -> a -> b
$ [(ItemType, Maybe String)] -> ListType
Bullet forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map (, forall a. Maybe a
Nothing) [ItemType]
itm
mktToCSec :: ItemType
mktToCSec :: ItemType
mktToCSec = Sentence -> ItemType
Flat forall a b. (a -> b) -> a -> b
$ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.tOfContLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.tOfCont
mktRefSec :: RefSec -> ItemType
mktRefSec :: RefSec -> ItemType
mktRefSec (RefProg Contents
_ [RefTab]
l) =
Sentence -> [Sentence] -> ItemType
mkHeaderItem (forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.refMatLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.refMat) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map RefTab -> Sentence
mktSubRef [RefTab]
l
where
mktSubRef :: RefTab -> Sentence
mktSubRef :: RefTab -> Sentence
mktSubRef RefTab
TUnits = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.tOfUnitLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.tOfUnit
mktSubRef (TUnits' [TUIntro]
_ [UnitDefn] -> LabelledContent
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.tOfUnitLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.tOfUnit
mktSubRef (TSymb [TSIntro]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.tOfSymbLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.tOfSymb
mktSubRef (TSymb' LFunc
_ [TSIntro]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.tOfSymbLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.tOfSymb
mktSubRef RefTab
TAandA = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.tOfAbbAccLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.abbAcc
mktIntroSec :: IntroSec -> ItemType
mktIntroSec :: IntroSec -> ItemType
mktIntroSec (IntroProg Sentence
_ Sentence
_ [IntroSub]
l) =
Sentence -> [Sentence] -> ItemType
mkHeaderItem (forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.introLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.introduction) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map IntroSub -> Sentence
mktSubIntro [IntroSub]
l
where
mktSubIntro :: IntroSub -> Sentence
mktSubIntro :: IntroSub -> Sentence
mktSubIntro (IPurpose [Sentence]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.docPurposeLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.prpsOfDoc
mktSubIntro (IScope Sentence
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.reqsScopeLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.scpOfReq
mktSubIntro IChar {} = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.readerCharsLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.charOfIR
mktSubIntro IOrgSec {} = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.docOrgLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.orgOfDoc
mktStkhldrSec:: StkhldrSec -> ItemType
mktStkhldrSec :: StkhldrSec -> ItemType
mktStkhldrSec (StkhldrProg [StkhldrSub]
l) =
Sentence -> [Sentence] -> ItemType
mkHeaderItem (forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.stakeholderLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.stakeholder) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map StkhldrSub -> Sentence
mktSub [StkhldrSub]
l
where
mktSub :: StkhldrSub -> Sentence
mktSub :: StkhldrSub -> Sentence
mktSub (Client CI
_ Sentence
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.customerLabel forall a b. (a -> b) -> a -> b
$ forall n. NounPhrase n => n -> Sentence
titleizeNP forall a b. (a -> b) -> a -> b
$ forall t. NamedIdea t => t -> NP
the IdeaDict
Doc.customer
mktSub (Cstmr CI
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.clientLabel forall a b. (a -> b) -> a -> b
$ forall n. NounPhrase n => n -> Sentence
titleizeNP forall a b. (a -> b) -> a -> b
$ forall t. NamedIdea t => t -> NP
the IdeaDict
Doc.client
mktGSDSec :: GSDSec -> ItemType
mktGSDSec :: GSDSec -> ItemType
mktGSDSec (GSDProg [GSDSub]
l) =
Sentence -> [Sentence] -> ItemType
mkHeaderItem (forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.genSysDescLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.generalSystemDescription) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map GSDSub -> Sentence
mktSub [GSDSub]
l
where
mktSub :: GSDSub -> Sentence
mktSub :: GSDSub -> Sentence
mktSub (SysCntxt [Contents]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.sysContextLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.sysCont
mktSub (UsrChars [Contents]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.userCharsLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.userCharacteristic
mktSub (SystCons [Contents]
_ [Section]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.sysConstraintsLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.systemConstraint
mktSSDSec :: SSDSec -> ItemType
mktSSDSec :: SSDSec -> ItemType
mktSSDSec (SSDProg [SSDSub]
l) =
Sentence -> [ItemType] -> ItemType
mkHeaderItem' (forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.specSystDescLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.specificsystemdescription) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map SSDSub -> ItemType
mktSubSSD [SSDSub]
l
where
mktSubSSD :: SSDSub -> ItemType
mktSubSSD :: SSDSub -> ItemType
mktSubSSD (SSDProblem (PDProg Sentence
_ [Section]
_ [PDSub]
sl1)) = Sentence -> [Sentence] -> ItemType
mkHeaderItem (forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.probDescLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.problemDescription) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map PDSub -> Sentence
mktSubPD [PDSub]
sl1
mktSubSSD (SSDSolChSpec (SCSProg [SCSSub]
sl2)) = Sentence -> [Sentence] -> ItemType
mkHeaderItem (forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.solCharSpecLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.solutionCharSpec) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map SCSSub -> Sentence
mktSubSCS [SCSSub]
sl2
mktSubPD :: PDSub -> Sentence
mktSubPD :: PDSub -> Sentence
mktSubPD (TermsAndDefs Maybe Sentence
_ [c]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.termDefsLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.termAndDef
mktSubPD PhySysDesc {} = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.physSystLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize CI
Doc.physSyst
mktSubPD (Goals [Sentence]
_ [ConceptInstance]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.goalStmtLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' CI
Doc.goalStmt
mktSubSCS :: SCSSub -> Sentence
mktSubSCS :: SCSSub -> Sentence
mktSubSCS (Assumptions [ConceptInstance]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.assumptLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' CI
Doc.assumption
mktSubSCS TMs {} = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.thModelLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' CI
Doc.thModel
mktSubSCS GDs {} = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.genDefnLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' CI
Doc.genDefn
mktSubSCS DDs {} = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.dataDefnLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' CI
Doc.dataDefn
mktSubSCS IMs {} = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.inModelLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' CI
Doc.inModel
mktSubSCS (Constraints Sentence
_ [c]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.datConLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.datumConstraint
mktSubSCS (CorrSolnPpties [c]
_ [Contents]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.corSolPropsLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.propOfCorSol
mktReqrmntSec :: ReqrmntSec -> ItemType
mktReqrmntSec :: ReqrmntSec -> ItemType
mktReqrmntSec (ReqsProg [ReqsSub]
l) =
Sentence -> [Sentence] -> ItemType
mkHeaderItem (forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.requirementsLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' CI
Doc.requirement) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map ReqsSub -> Sentence
mktSubs [ReqsSub]
l
where
mktSubs :: ReqsSub -> Sentence
mktSubs :: ReqsSub -> Sentence
mktSubs (FReqsSub' [ConceptInstance]
_ [LabelledContent]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.funcReqLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.functionalRequirement
mktSubs (FReqsSub [ConceptInstance]
_ [LabelledContent]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.funcReqLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.functionalRequirement
mktSubs (NonFReqsSub [ConceptInstance]
_) = forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.nonfuncReqLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.nonfunctionalRequirement
mktLCsSec :: LCsSec -> ItemType
mktLCsSec :: LCsSec -> ItemType
mktLCsSec (LCsProg [ConceptInstance]
_) = Sentence -> ItemType
Flat forall a b. (a -> b) -> a -> b
$ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.likeChgLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' CI
Doc.likelyChg
mktUCsSec :: UCsSec -> ItemType
mktUCsSec :: UCsSec -> ItemType
mktUCsSec (UCsProg [ConceptInstance]
_) = Sentence -> ItemType
Flat forall a b. (a -> b) -> a -> b
$ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.unlikeChgLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' CI
Doc.unlikelyChg
mktTraceabilitySec :: TraceabilitySec -> ItemType
mktTraceabilitySec :: TraceabilitySec -> ItemType
mktTraceabilitySec (TraceabilityProg [TraceConfig]
_) = Sentence -> ItemType
Flat forall a b. (a -> b) -> a -> b
$ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.traceMatricesLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.traceyMandG
mktAuxConsSec :: AuxConstntSec -> ItemType
mktAuxConsSec :: AuxConstntSec -> ItemType
mktAuxConsSec (AuxConsProg CI
_ [ConstQDef]
_) = Sentence -> ItemType
Flat forall a b. (a -> b) -> a -> b
$ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.valsOfAuxConsLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.consVals
mktBib :: ItemType
mktBib :: ItemType
mktBib = Sentence -> ItemType
Flat forall a b. (a -> b) -> a -> b
$ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.referenceLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.reference
mktAppndxSec :: AppndxSec -> ItemType
mktAppndxSec :: AppndxSec -> ItemType
mktAppndxSec (AppndxProg [Contents]
_) = Sentence -> ItemType
Flat forall a b. (a -> b) -> a -> b
$ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.appendixLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
Doc.appendix
mktOffShelfSolnSec :: OffShelfSolnsSec -> ItemType
mktOffShelfSolnSec :: OffShelfSolnsSec -> ItemType
mktOffShelfSolnSec (OffShelfSolnsProg [Contents]
_) = Sentence -> ItemType
Flat forall a b. (a -> b) -> a -> b
$ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Reference
SRS.offShelfSolnsLabel forall a b. (a -> b) -> a -> b
$ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
Doc.offShelfSolution
findToC :: [DocSection] -> ShowTableOfContents
findToC :: [DocSection] -> ShowTableOfContents
findToC [] = ShowTableOfContents
NoToC
findToC (DocSection
TableOfContents:[DocSection]
_) = ShowTableOfContents
ToC
findToC (DocSection
_:[DocSection]
dds) = [DocSection] -> ShowTableOfContents
findToC [DocSection]
dds