module Drasil.Sections.AuxiliaryConstants
(valsOfAuxConstantsF, tableOfConstants, tableOfConstantsRef) where
import Language.Drasil
import qualified Drasil.DocLang.SRS as SRS (valsOfAuxCons)
import Drasil.DocumentLanguage.Units (toSentence)
import Data.Drasil.Concepts.Documentation (value, description, symbol_, tAuxConsts)
import qualified Data.Drasil.Concepts.Math as CM (unit_)
import Control.Lens ((^.))
valsOfAuxConstantsF :: Idea a => a -> [ConstQDef] -> Section
valsOfAuxConstantsF :: a -> [ConstQDef] -> Section
valsOfAuxConstantsF kWord :: a
kWord listOfConstants :: [ConstQDef]
listOfConstants = [Contents] -> [Section] -> Section
SRS.valsOfAuxCons (a -> [ConstQDef] -> [Contents]
forall a. Idea a => a -> [ConstQDef] -> [Contents]
contentGenerator a
kWord [ConstQDef]
listOfConstants) []
contentGenerator :: Idea a => a -> [ConstQDef] -> [Contents]
contentGenerator :: a -> [ConstQDef] -> [Contents]
contentGenerator _ [] = [[Sentence] -> Contents
foldlSP [String -> Sentence
S "There are no auxiliary constants"]]
contentGenerator a :: a
a b :: [ConstQDef]
b = [a -> Contents
forall a. Idea a => a -> Contents
intro a
a, LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ [ConstQDef] -> LabelledContent
tableOfConstants [ConstQDef]
b]
intro :: (Idea a) => a -> Contents
intro :: a -> Contents
intro kWord :: a
kWord = [Sentence] -> Contents
foldlSP [String -> Sentence
S "This section contains the standard values that are used for calculations in" Sentence -> Sentence -> Sentence
+:+ a -> Sentence
forall c. (Idea c, HasUID c) => c -> Sentence
short a
kWord]
tableOfConstants :: [ConstQDef] -> LabelledContent
tableOfConstants :: [ConstQDef] -> LabelledContent
tableOfConstants f :: [ConstQDef]
f = Reference -> RawContent -> LabelledContent
llcc Reference
tableOfConstantsRef (RawContent -> LabelledContent) -> RawContent -> LabelledContent
forall a b. (a -> b) -> a -> b
$ [Sentence] -> [[Sentence]] -> Sentence -> Bool -> RawContent
Table
[NamedChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize NamedChunk
symbol_, NamedChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize NamedChunk
description, NamedChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize NamedChunk
value, ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize ConceptChunk
CM.unit_]
([ConstQDef -> Sentence] -> [ConstQDef] -> [[Sentence]]
forall a b. [a -> b] -> [a] -> [[b]]
mkTable [ConstQDef -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch, ConstQDef -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
phrase, \c :: ConstQDef
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
$ ConstQDef
c ConstQDef -> Getting Literal ConstQDef Literal -> Literal
forall s a. s -> Getting a s a -> a
^. Getting Literal ConstQDef Literal
forall (c :: * -> *) e. DefiningExpr c => Lens' (c e) e
defnExpr, ConstQDef -> Sentence
forall u. MayHaveUnit u => u -> Sentence
toSentence] [ConstQDef]
f)
(NamedChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize' NamedChunk
tAuxConsts)
Bool
True
tableOfConstantsRef :: Reference
tableOfConstantsRef :: Reference
tableOfConstantsRef = UID -> Reference
makeTabRef' (NamedChunk
tAuxConsts NamedChunk -> Getting UID NamedChunk UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID NamedChunk UID
forall c. HasUID c => Lens' c UID
uid)