module Drasil.Website.Body where
import Language.Drasil.Printers (PrintingInformation(..), defaultConfiguration)
import Database.Drasil
import SysInfo.Drasil
import Language.Drasil
import Drasil.DocLang (findAllRefs)
import Drasil.Website.Introduction (introSec)
import Drasil.Website.CaseStudy (caseStudySec)
import Drasil.Website.Example (exampleSec, exampleRefs, allExampleSI)
import Drasil.Website.Documentation (docsSec, docRefs)
import Drasil.Website.Analysis (analysisSec, analysisRefs)
printSetting :: FolderLocation -> PrintingInformation
printSetting :: FolderLocation -> PrintingInformation
printSetting fl :: FolderLocation
fl = ChunkDB -> Stage -> PrintingConfiguration -> PrintingInformation
PI (FolderLocation -> ChunkDB
symbMap FolderLocation
fl) Stage
Equational PrintingConfiguration
defaultConfiguration
mkWebsite :: FolderLocation -> Document
mkWebsite :: FolderLocation -> Document
mkWebsite fl :: FolderLocation
fl =
Title -> Title -> ShowTableOfContents -> [Section] -> Document
Document (String -> Title
S String
websiteTitle) (Reference -> Title -> Title
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Title -> Title
namedRef Reference
gitHubRef (String -> Title
S "Link to GitHub Repository")) ShowTableOfContents
NoToC ([Section] -> Document) -> [Section] -> Document
forall a b. (a -> b) -> a -> b
$ FolderLocation -> [Section]
sections FolderLocation
fl
data FolderLocation = Folder {
FolderLocation -> String
depL :: FilePath
, FolderLocation -> String
docsRt :: FilePath
, FolderLocation -> String
exRt :: FilePath
, FolderLocation -> String
graphRt :: FilePath
, FolderLocation -> String
analysisRt :: FilePath
, FolderLocation -> String
typeGraphFolder :: FilePath
, FolderLocation -> String
classInstFolder :: FilePath
, FolderLocation -> String
repoRt :: FilePath
, FolderLocation -> String
buildNum :: FilePath
, FolderLocation -> String
buildPth :: FilePath
, FolderLocation -> [String]
packages :: [String]
}
si :: FolderLocation -> SystemInformation
si :: FolderLocation -> SystemInformation
si fl :: FolderLocation
fl = SI :: forall a b c e f h i j d.
(CommonIdea a, Idea a, Idea b, HasName c, Quantity e, Eq e,
MayHaveUnit e, Quantity f, MayHaveUnit f, Concept f, Eq f,
Quantity h, MayHaveUnit h, Quantity i, MayHaveUnit i, HasUID j,
Constrained j) =>
a
-> b
-> [c]
-> d
-> [e]
-> [f]
-> [InstanceModel]
-> [DataDefinition]
-> [String]
-> [h]
-> [i]
-> [Block SimpleQDef]
-> [j]
-> [ConstQDef]
-> ChunkDB
-> ChunkDB
-> ReferenceDB
-> SystemInformation
SI {
_sys :: CI
_sys = CI
webName,
_kind :: CI
_kind = CI
web,
_authors :: [Person]
_authors = [] :: [Person],
_quants :: [QuantityDict]
_quants = [] :: [QuantityDict],
_purpose :: [Any]
_purpose = [],
_concepts :: [UnitalChunk]
_concepts = [] :: [UnitalChunk],
_instModels :: [InstanceModel]
_instModels = [],
_datadefs :: [DataDefinition]
_datadefs = [],
_configFiles :: [String]
_configFiles = [],
_inputs :: [QuantityDict]
_inputs = [] :: [QuantityDict],
_outputs :: [QuantityDict]
_outputs = [] :: [QuantityDict],
_defSequence :: [Block SimpleQDef]
_defSequence = [] :: [Block SimpleQDef],
_constraints :: [ConstrainedChunk]
_constraints = [] :: [ConstrainedChunk],
_constants :: [ConstQDef]
_constants = [] :: [ConstQDef],
_sysinfodb :: ChunkDB
_sysinfodb = FolderLocation -> ChunkDB
symbMap FolderLocation
fl,
_usedinfodb :: ChunkDB
_usedinfodb = ChunkDB
usedDB,
refdb :: ReferenceDB
refdb = BibRef -> [ConceptInstance] -> ReferenceDB
rdb [] []
}
sections :: FolderLocation -> [Section]
sections :: FolderLocation -> [Section]
sections fl :: FolderLocation
fl = [Section
headerSec, Reference
-> Reference -> Reference -> Reference -> Reference -> Section
introSec (Section -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref Section
caseStudySec) (Section -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref (Section -> Reference) -> Section -> Reference
forall a b. (a -> b) -> a -> b
$ String -> Section
docsSec (String -> Section) -> String -> Section
forall a b. (a -> b) -> a -> b
$ FolderLocation -> String
docsRt FolderLocation
fl) (Section -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref (Section -> Reference) -> Section -> Reference
forall a b. (a -> b) -> a -> b
$ String -> String -> String -> String -> [String] -> Section
analysisSec (FolderLocation -> String
analysisRt FolderLocation
fl) (FolderLocation -> String
typeGraphFolder FolderLocation
fl) (FolderLocation -> String
classInstFolder FolderLocation
fl) (FolderLocation -> String
graphRt FolderLocation
fl) ([String] -> Section) -> [String] -> Section
forall a b. (a -> b) -> a -> b
$ FolderLocation -> [String]
packages FolderLocation
fl) Reference
gitHubRef Reference
wikiRef,
String -> String -> Section
exampleSec (FolderLocation -> String
repoRt FolderLocation
fl) (FolderLocation -> String
exRt FolderLocation
fl), Section
caseStudySec, String -> Section
docsSec (FolderLocation -> String
docsRt FolderLocation
fl), String -> String -> String -> String -> [String] -> Section
analysisSec (FolderLocation -> String
analysisRt FolderLocation
fl) (FolderLocation -> String
typeGraphFolder FolderLocation
fl) (FolderLocation -> String
classInstFolder FolderLocation
fl) (FolderLocation -> String
graphRt FolderLocation
fl) ([String] -> Section) -> [String] -> Section
forall a b. (a -> b) -> a -> b
$ FolderLocation -> [String]
packages FolderLocation
fl,
FolderLocation -> Section
footer FolderLocation
fl]
symbMap :: FolderLocation -> ChunkDB
symbMap :: FolderLocation -> ChunkDB
symbMap fl :: FolderLocation
fl = [QuantityDict]
-> [IdeaDict]
-> [ConceptChunk]
-> [UnitDefn]
-> [DataDefinition]
-> [InstanceModel]
-> [GenDefn]
-> [TheoryModel]
-> [ConceptInstance]
-> [Section]
-> [LabelledContent]
-> [Reference]
-> ChunkDB
forall q t c u.
(Quantity q, MayHaveUnit q, Idea t, Concept c, IsUnit u) =>
[q]
-> [t]
-> [c]
-> [u]
-> [DataDefinition]
-> [InstanceModel]
-> [GenDefn]
-> [TheoryModel]
-> [ConceptInstance]
-> [Section]
-> [LabelledContent]
-> [Reference]
-> ChunkDB
cdb ([] :: [QuantityDict]) ((CI -> IdeaDict) -> [CI] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map CI -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw [CI
webName, CI
web] [IdeaDict] -> [IdeaDict] -> [IdeaDict]
forall a. [a] -> [a] -> [a]
++ (SystemInformation -> IdeaDict)
-> [SystemInformation] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map SystemInformation -> IdeaDict
getSysName [SystemInformation]
allExampleSI)
([] :: [ConceptChunk]) ([] :: [UnitDefn]) [] [] [] [] [] [] [] ([Reference] -> ChunkDB) -> [Reference] -> ChunkDB
forall a b. (a -> b) -> a -> b
$ FolderLocation -> [Reference]
allRefs FolderLocation
fl
getSysName :: SystemInformation -> IdeaDict
getSysName :: SystemInformation -> IdeaDict
getSysName SI{_sys :: ()
_sys = a
nm} = a -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw a
nm
usedDB :: ChunkDB
usedDB :: ChunkDB
usedDB = [QuantityDict]
-> [IdeaDict]
-> [ConceptChunk]
-> [UnitDefn]
-> [DataDefinition]
-> [InstanceModel]
-> [GenDefn]
-> [TheoryModel]
-> [ConceptInstance]
-> [Section]
-> [LabelledContent]
-> [Reference]
-> ChunkDB
forall q t c u.
(Quantity q, MayHaveUnit q, Idea t, Concept c, IsUnit u) =>
[q]
-> [t]
-> [c]
-> [u]
-> [DataDefinition]
-> [InstanceModel]
-> [GenDefn]
-> [TheoryModel]
-> [ConceptInstance]
-> [Section]
-> [LabelledContent]
-> [Reference]
-> ChunkDB
cdb ([] :: [QuantityDict]) ([] :: [IdeaDict])
([] :: [ConceptChunk]) ([] :: [UnitDefn]) [] [] [] [] [] [] [] ([] :: [Reference])
allRefs :: FolderLocation -> [Reference]
allRefs :: FolderLocation -> [Reference]
allRefs fl :: FolderLocation
fl = [Reference
gitHubRef, Reference
wikiRef]
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ String -> String -> [Reference]
exampleRefs (FolderLocation -> String
repoRt FolderLocation
fl) (FolderLocation -> String
exRt FolderLocation
fl)
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ String -> [Reference]
docRefs (FolderLocation -> String
docsRt FolderLocation
fl)
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ String -> String -> String -> String -> [String] -> [Reference]
analysisRefs (FolderLocation -> String
analysisRt FolderLocation
fl) (FolderLocation -> String
typeGraphFolder FolderLocation
fl) (FolderLocation -> String
classInstFolder FolderLocation
fl) (FolderLocation -> String
graphRt FolderLocation
fl) (FolderLocation -> [String]
packages FolderLocation
fl)
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (Section -> [Reference]) -> [Section] -> [Reference]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Section -> [Reference]
findAllRefs (FolderLocation -> [Section]
sections FolderLocation
fl)
webName, web :: CI
webName :: CI
webName = String -> NP -> String -> [UID] -> CI
commonIdea "websiteName" (String -> NP
cn String
websiteTitle) "Drasil" []
web :: CI
web = String -> NP -> String -> [UID] -> CI
commonIdea "website" (String -> NP
cn "website") "web" []
headerSec :: Section
=
Title -> [Contents] -> [Section] -> Reference -> Section
section Title
EmptyS
[LabelledContent -> Contents
LlC LabelledContent
imageContent]
[] (Reference -> Section) -> Reference -> Section
forall a b. (a -> b) -> a -> b
$ String -> Title -> Reference
makeSecRef "Header" (Title -> Reference) -> Title -> Reference
forall a b. (a -> b) -> a -> b
$ String -> Title
S "Header"
imageContent :: LabelledContent
imageContent :: LabelledContent
imageContent = Reference -> RawContent -> LabelledContent
llcc (String -> Reference
makeFigRef "Drasil") (RawContent -> LabelledContent) -> RawContent -> LabelledContent
forall a b. (a -> b) -> a -> b
$ Title -> String -> MaxWidthPercent -> RawContent
figWithWidth Title
EmptyS String
imagePath 50
gitHubRef :: Reference
gitHubRef :: Reference
gitHubRef = String -> String -> ShortName -> Reference
makeURI "gitHubRepo" String
gitHubInfoURL (Title -> ShortName
shortname' (Title -> ShortName) -> Title -> ShortName
forall a b. (a -> b) -> a -> b
$ String -> Title
S "gitHubRepo")
wikiRef :: Reference
wikiRef :: Reference
wikiRef = String -> String -> ShortName -> Reference
makeURI "gitHubWiki" (String
gitHubInfoURL String -> String -> String
forall a. [a] -> [a] -> [a]
++ "/wiki") (Title -> ShortName
shortname' (Title -> ShortName) -> Title -> ShortName
forall a b. (a -> b) -> a -> b
$ String -> Title
S "gitHubWiki")
websiteTitle :: String
gitHubInfoURL, imagePath :: FilePath
websiteTitle :: String
websiteTitle = "Drasil - Generate All the Things!"
gitHubInfoURL :: String
gitHubInfoURL = "https://github.com/JacquesCarette/Drasil"
imagePath :: String
imagePath = "./images/Icon.png"
footer :: FolderLocation -> Section
_ = Title -> [Contents] -> [Section] -> Reference -> Section
section Title
EmptyS [Title -> Contents
mkParagraph Title
copyrightInfo] [] (Reference -> Section) -> Reference -> Section
forall a b. (a -> b) -> a -> b
$ String -> Title -> Reference
makeSecRef "Footer" (Title -> Reference) -> Title -> Reference
forall a b. (a -> b) -> a -> b
$ String -> Title
S "Footer"
copyrightInfo :: Sentence
copyrightInfo :: Title
copyrightInfo = String -> Title
S "Copyright (c) Jacques Carette, 2021. All rights reserved. This website is a software artifact generated by Drasil."