module Drasil.SRS.Sections.AuxiliaryConstants
(valsOfAuxConstantsF, tableOfConstants, tableOfConstantsRef) where
import Control.Lens ((^.))
import Drasil.Database (HasUID(..))
import Language.Drasil
import Language.Drasil.Document
import Data.List.Extras (mkTable)
import Drasil.System (ProjectName, projAbrvS)
import qualified Drasil.SRS.Concepts as SRS (valsOfAuxCons)
import Drasil.SRS.DocumentLanguage.Units (toSentence)
import Drasil.SRS.Sections.ReferenceMaterial (emptySectSentPlu)
import Drasil.Metadata.Documentation (value, description, symbol_, tAuxConsts)
import qualified Drasil.Metadata.Concepts.Math as CM (unit_)
valsOfAuxConstantsF :: ProjectName -> [ConstQDef] -> Section
valsOfAuxConstantsF :: ProjectName -> [QDefinition Literal] -> Section
valsOfAuxConstantsF ProjectName
kWord [QDefinition Literal]
listOfConstants = [Contents] -> [Section] -> Section
SRS.valsOfAuxCons (ProjectName -> [QDefinition Literal] -> [Contents]
contentGenerator ProjectName
kWord [QDefinition Literal]
listOfConstants) []
contentGenerator :: ProjectName -> [ConstQDef] -> [Contents]
contentGenerator :: ProjectName -> [QDefinition Literal] -> [Contents]
contentGenerator ProjectName
_ [] = [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ [IdeaDict] -> Sentence
forall n. NamedIdea n => [n] -> Sentence
emptySectSentPlu [IdeaDict
tAuxConsts]]
contentGenerator ProjectName
a [QDefinition Literal]
b = [ProjectName -> Contents
intro ProjectName
a, LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ [QDefinition Literal] -> LabelledContent
tableOfConstants [QDefinition Literal]
b]
intro :: ProjectName -> Contents
intro :: ProjectName -> Contents
intro ProjectName
kWord = [Sentence] -> Contents
foldlSP [String -> Sentence
S String
"This section contains the standard values that are used for calculations in" Sentence -> Sentence -> Sentence
+:+ ProjectName -> Sentence
projAbrvS ProjectName
kWord]
tableOfConstants :: [ConstQDef] -> LabelledContent
tableOfConstants :: [QDefinition Literal] -> LabelledContent
tableOfConstants [QDefinition Literal]
f = RawContent -> Reference -> LabelledContent
mkRawLC ([Sentence] -> [[Sentence]] -> Sentence -> Bool -> RawContent
Table
[IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
symbol_, IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
description, IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize IdeaDict
value, ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize ConceptChunk
CM.unit_]
([QDefinition Literal -> Sentence]
-> [QDefinition Literal] -> [[Sentence]]
forall a b. [a -> b] -> [a] -> [[b]]
mkTable [QDefinition Literal -> Sentence
forall t.
(IsChunk t, Idea t, HasSpace t, HasSymbol t) =>
t -> Sentence
ch, QDefinition Literal -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase, \QDefinition Literal
c -> ModelExpr -> Sentence
eS (ModelExpr -> Sentence) -> ModelExpr -> Sentence
forall a b. (a -> b) -> a -> b
$ Literal -> ModelExpr
forall c. Express c => c -> ModelExpr
express (Literal -> ModelExpr) -> Literal -> ModelExpr
forall a b. (a -> b) -> a -> b
$ QDefinition Literal
c QDefinition Literal
-> Getting Literal (QDefinition Literal) Literal -> Literal
forall s a. s -> Getting a s a -> a
^. Getting Literal (QDefinition Literal) Literal
forall e. Lens' (QDefinition e) e
forall (c :: * -> *) e. DefiningExpr c => Lens' (c e) e
defnExpr, QDefinition Literal -> Sentence
forall u. MayHaveUnit u => u -> Sentence
toSentence] [QDefinition Literal]
f)
(IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
tAuxConsts)
Bool
True) Reference
tableOfConstantsRef
tableOfConstantsRef :: Reference
tableOfConstantsRef :: Reference
tableOfConstantsRef = UID -> Reference
makeTabRef' (IdeaDict
tAuxConsts IdeaDict -> Getting UID IdeaDict UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID IdeaDict UID
forall c. HasUID c => Getter c UID
Getter IdeaDict UID
uid)