{-# Language TupleSections #-}
-- | Standard code to make a table of contents.
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)

{- Layout for Table of Contents in SRS documents:
Table of Contents
Reference Material
  Table of Units
  Table of Symbols
  Table of Abbreviations and Acronyms
Instroduction
  Purpose of Document
  Scope of Requirements
  Characteristics of Intended Reader
  Organization of Document
Stakeholders
  The Client
  The Customer
General System Description
  System Context
  User Characteristics
  System Constraints
Specific System Description
  Problem Description
    Termonology and definitions
    Physical System Description
    Goal Statements
  Solution Characteristics Specification
    Assumptions
    Theoretical Models
    General Definitions
    Data Definitions
    Instance Models
    Data Constraints
    Properties of a Correct Solution
Requirements
  Functional Requirements
  Non-Functional Requirements
Likely Changes
Unlikely Changes
Traceability Matrices and Graphs
Values of Auxiliary Constants
References
Appendix

Other refs not used but still defined:
product use case
scope of the project
use case table
off the shelf solutions
-}

-- TODO: Use DLPlate for this.
-- | Finds all possible sections and subsections to make a Table of Contents.
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
mkHeaderItem :: Sentence -> [Sentence] -> ItemType
mkHeaderItem 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
mkHeaderItem' :: Sentence -> [ItemType] -> ItemType
mkHeaderItem' 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

-- | Helper for creating the 'Table of Contents' section ToC entry
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

-- | Helper for creating the 'Reference Material' section ToC entry
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

-- | Helper for creating the 'Introduction' section ToC entry
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

-- | Helper for creating the 'Stakeholders' section ToC entry
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

-- | Helper for creating the 'General System Description' section ToC entry
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

-- | Helper for creating the 'Specific System Description' section ToC entry
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

-- | Helper for creating the 'Requirements' section ToC entry
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

-- | Helper for creating the 'Likely Changes' section ToC entry
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

-- | Helper for creating the 'Unlikely Changes' section ToC entry
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

-- | Helper for creating the 'Traceability Matrices and Graphs' section ToC entry
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

-- | Helper for creating the 'Values of Auxiliary Constants' section ToC entry
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

-- | Helper for creating the 'References' section ToC entry
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 

-- | Helper for creating the 'Appendix' section ToC entry
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

-- | Helper for creating the 'Off-The-Shelf Solutions' section ToC entry
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

-- Find more concise way to do this
-- | Finds whether the Table of Contents is in a SRSDecl.
findToC :: [DocSection] -> ShowTableOfContents
findToC :: [DocSection] -> ShowTableOfContents
findToC [] = ShowTableOfContents
NoToC
findToC (DocSection
TableOfContents:[DocSection]
_) = ShowTableOfContents
ToC
findToC (DocSection
_:[DocSection]
dds) = [DocSection] -> ShowTableOfContents
findToC [DocSection]
dds