Replies: 2 comments 6 replies
-
You're probably going to need to generalize this to (at least) return a 'set' of documents. It might be clever to put in a bit of abstraction now. I'm guessing that a Map from some reasonable set of 'key's to You might want to take a peek at In any case: this is a sub-optimal design of the |
Beta Was this translation helpful? Give feedback.
-
@BilalM04, I like your description above of how the SRS is generated. I'm guessing that you deduced this from reading the code, or maybe it is documented somewhere. If it isn't documented, we should talk about capturing the overview somewhere for the benefit of future Drasil developers. I'll add this discussion to our Monday meeting (#3791). |
Beta Was this translation helpful? Give feedback.
-
Tickets to revisit after this discussion is resolved:
Currently, the way printing SRS documents are setup, it is only possible to print to a single file. Each example makes a call to the
gen
function inLanguage.Drasil.Generate
, passing in the SRS, which is aDocument
:Drasil/code/drasil-example/projectile/app/Main.hs
Line 19 in bfcf92f
Then, through a series of functions in
Language.Drasil.Generate
, particularlyprnt
,prntDoc
,printDoc'
, andwriteDoc
, a call to a format specific gen function is made:Drasil/code/drasil-gen/lib/Language/Drasil/Generate.hs
Lines 93 to 101 in bfcf92f
These format specific gen functions (
genHTML
,genTeX
,genJSON
,genMD
) return a singleDoc
, which contains the entire SRS. ThisDoc
is then printed to its respective SRS file.The format specific gen functions receive a single
Document
, which contains all the SRS details. TheDocument
it receives is in the format of the data type defined inLanguage.Drasil.Document
, where the SRS contents is represented through[Section]
. The format specific gen functions, using themakeDocument
function, then convert it to theDocument
data type defined inLanguage.Drasil.Printing.LayoutObj
, where the SRS content is represented through[LayoutObj]
. The SRS printers then render theseLayoutObj
's into a singleDoc
.LayoutObj
is defined as follows:Drasil/code/drasil-printers/lib/Language/Drasil/Printing/LayoutObj.hs
Lines 30 to 43 in bfcf92f
The description above is how Drasil currently generates SRS documents (rather my understanding of it, please correct me if I'm wrong). The problem here is that the SRS is treated as a single document all throughout its journey from conception to being printed.
After playing around with the code for printing, I found the general structure of the SRS contents (represented as
[LayoutObj]
) follows a nested structure. The top-levelLayoutObj
s in the list areHDiv
s for each of the primary sections (closed dot in the TOC). TheHDiv
s contain[LayoutObj]
, which is used to nest the sub-sections (open dot in the TOC). Similarly. the sections denoted by the square in the TOC are also nested.Here are the table of contents for reference
From my understanding, some
HDiv
s, regardless of whether it is nested or not, should be printed into separate files. Whereas there are someHDiv
s that do not need to be printed to a separate file, i.e. the ones containing block equations. However, this nested structure makes it difficult to separate the SRS into different sections. I can think of several "hacky" ways to go about it; however being new to Drasil and Haskell, I am unsure of a good design.What is the best way to print the mdBook SRS into separate Documents?
Beta Was this translation helpful? Give feedback.
All reactions