Skip to content

Commit

Permalink
removed duplicate tags that were being printed with some refaddresses…
Browse files Browse the repository at this point in the history
…; continue to clear log
  • Loading branch information
niazim3 committed Aug 4, 2018
1 parent eacf853 commit a573061
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 19 deletions.
13 changes: 8 additions & 5 deletions code/drasil-docLang/Drasil/DocumentLanguage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,12 @@ mkRefSec si (RefProg c l) = section'' (titleize refmat) [c]
table_of_units (sortBy comp_unitdefn $ Map.elems $ db ^. unitTable) (tuIntro con)
mkSubRef SI {_quants = v} (TSymb con) =
SRS.tOfSymb
[tsIntro con, LlC $ table Equational (
sortBy (compsy `on` eqSymb) $
filter (`hasStageSymbol` Equational)
(nub v)) at_start] []
[tsIntro con,
LlC $ table Equational (
sortBy (compsy `on` eqSymb)
$ filter (`hasStageSymbol` Equational)
(nub v))
at_start] []
mkSubRef SI {_concepts = cccs} (TSymb' f con) = mkTSymb cccs f con
mkSubRef SI {_sysinfodb = db} TAandA =
table_of_abb_and_acronyms $ nub $ Map.elems (db ^. termTable)
Expand All @@ -295,7 +297,8 @@ mkTSymb :: (Quantity e, Concept e, Eq e) =>
mkTSymb v f c = SRS.tOfSymb [tsIntro c,
LlC $ table Equational
(sortBy (compsy `on` eqSymb) $ filter (`hasStageSymbol` Equational) (nub v))
(lf f)] []
(lf f)]
[]
where lf Term = at_start
lf Defn = (^. defn)
lf (TermExcept cs) = \x -> if (x ^. uid) `elem` map (^. uid) cs then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Data.Function (on)
-- given list of abbreviated chunks
table_of_abb_and_acronyms :: (Idea s) => [s] -> Section
table_of_abb_and_acronyms ls = Section (S "Abbreviations and Acronyms")
[Con (LlC $ table ls)] (mkLabelSame "TAbbAcc" Tab)
[Con (LlC $ table ls)] (mkLabelRASec "TAbbAcc" "Abbreviations and Acronyms")

select :: (Idea s) => [s] -> [(String, s)]
select [] = []
Expand Down
7 changes: 4 additions & 3 deletions code/drasil-docLang/Drasil/Sections/TableOfSymbols.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import Data.Drasil.Concepts.Documentation (symbol_, description, tOfSymb)
--Removed SymbolForm Constraint and filtered non-symbol'd chunks
-- | table of symbols creation function
table :: (Quantity s) => Stage -> [s] -> (s -> Sentence) -> LabelledContent
table st ls f = llcc (mkLabelSame "ToS" Tab) $ Table
table st ls f = llcc (mkLabelSame "ToS" Tab)
$ Table
[at_start symbol_, at_start description, at_start' CM.unit_]
(mkTable [P . (flip symbol st), f, unitToSentence]
(filter (\q -> hasStageSymbol q st) ls))
(titleize tOfSymb) False
(filter (\q -> hasStageSymbol q st) ls))
(titleize tOfSymb) False
5 changes: 3 additions & 2 deletions code/drasil-example/Drasil/NoPCM/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ probDescription, termAndDefn, physSystDescription, goalStates,

mkSRS :: DocDesc
mkSRS = RefSec (RefProg intro
[TUnits, tsymb [TSPurpose, SymbConvention
[Lit (nw ht_trans), Doc' (nw progName)], SymbOrder], TAandA]) :
[TUnits,
tsymb [TSPurpose, SymbConvention [Lit (nw ht_trans), Doc' (nw progName)], SymbOrder],
TAandA]) :
IntroSec (IntroProg (introStart ener_src energy progName)
(introEnd progName program)
[IPurpose (purpDoc progName),
Expand Down
4 changes: 3 additions & 1 deletion code/drasil-example/Drasil/SWHS/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ swhsPeople = [thulasi, brooks, spencerSmith]

mkSRS :: DocDesc
mkSRS = RefSec (RefProg intro [
TUnits, tsymb'' tsymb_intro (TermExcept [uNormalVect]), TAandA]):
TUnits,
tsymb'' tsymb_intro (TermExcept [uNormalVect]),
TAandA]):
IntroSec (
IntroProg (introP1 CT.ener_src energy swhs_pcm phsChgMtrl
progName CT.thermal_energy latent_heat unit_) (introP2 swhs_pcm program
Expand Down
3 changes: 3 additions & 0 deletions code/drasil-lang/Language/Drasil/Misc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ mkTable fl (c:cl) = map ($ c) fl : mkTable fl cl
unitToSentence :: Quantity u => u -> Sentence
unitToSentence x = maybe (S "--") (\y -> Sy (y ^. usymb)) (getUnit x)

unitToEmptyS :: u -> Sentence
unitToEmptyS _ = S ""

unitToSentenceUnitless :: Quantity u => u -> Sentence
unitToSentenceUnitless x = maybe (S "Unitless") (\y -> Sy (y ^. usymb)) (getUnit x)

Expand Down
6 changes: 3 additions & 3 deletions code/drasil-lang/Language/Drasil/Reference.hs
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,15 @@ instance Referable QDefinition where -- FIXME: This could lead to trouble; need
-- Refs. Double-check QDef is a DD before allowing
-- FIXME: QDefinition should no longer be referable
-- after its Label is removed.
refAdd d = "DD:" ++ (getAdd ((d ^. getLabel) ^. getRefAdd))
refAdd d = getAdd ((d ^. getLabel) ^. getRefAdd)
rType _ = Def DD

instance Referable DataDefinition where
refAdd d = "DD:" ++ (getAdd ((d ^. getLabel) ^. getRefAdd))
refAdd d = getAdd ((d ^. getLabel) ^. getRefAdd)
rType _ = Def DD

instance Referable InstanceModel where
refAdd i = "IM:" ++ (getAdd ((i ^. getLabel) ^. getRefAdd))
refAdd i = getAdd ((i ^. getLabel) ^. getRefAdd)
rType _ = Def Instance

instance Referable ConceptInstance where
Expand Down
8 changes: 4 additions & 4 deletions code/drasil-printers/Language/Drasil/Printing/Import.hs
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ lay sm (UlC x) = layUnlabelled sm (x ^. accessContents)
layLabelled :: HasSymbolTable ctx => ctx -> LabelledContent -> T.LayoutObj
layLabelled sm x@(LblC _ (Table hdr lls t b)) = T.Table ["table"]
((map (spec sm) hdr) : (map (map (spec sm)) lls))
(P.S $ "Table:" ++ (getAdd (x ^. getRefAdd)))
(P.S $ getAdd (x ^. getRefAdd))
b (spec sm t)
layLabelled sm x@(LblC _ (EqnBlock c)) = T.HDiv ["equation"]
[T.EqnBlock (P.E (expr c sm))]
(P.S $ "Eqn:" ++ (getAdd (x ^. getRefAdd)))
(P.S $ getAdd (x ^. getRefAdd))
layLabelled sm x@(LblC _ (Figure c f wp)) = T.Figure
(P.S $ "Figure:" ++ (getAdd (x ^. getRefAdd)))
(P.S $ getAdd (x ^. getRefAdd))
(spec sm c) f wp
layLabelled sm x@(LblC _ (Requirement r)) = T.ALUR T.Requirement
(spec sm $ requires r)
Expand All @@ -275,7 +275,7 @@ layLabelled sm x@(LblC _ (Change lcs)) = T.ALUR
(spec sm $ getShortName lcs)
layLabelled sm x@(LblC _ (Graph ps w h t)) = T.Graph
(map (\(y,z) -> (spec sm y, spec sm z)) ps) w h (spec sm t)
(P.S $ "Figure:" ++ (getAdd (x ^. getRefAdd)))
(P.S $ getAdd (x ^. getRefAdd))
layLabelled sm x@(LblC _ (Defnt dtyp pairs)) = T.Definition
dtyp (layPairs pairs)
(P.S $ getAdd (x ^. getRefAdd))
Expand Down

5 comments on commit a573061

@niazim3
Copy link
Collaborator Author

@niazim3 niazim3 commented on a573061 Aug 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to confirm, the equations for DataDefs, GenDefs, IMs, and TMs, should have the "Eqn:" text appended before the reference address, correct?

@szymczdm @JacquesCarette

Currently, the equations in the models and definitions directly take the labels of their respective model/definition:

mkDDField d _ l@DefiningEquation fs = (show l, (LlC $ eqUnR (sy d $= d ^. relat) (d ^.getLabel)) :[]) : fs --FIXME: appending symbol should be done in the printing stage
which results in discrepancies like the following in Tiny:

478c478
< <div id="Eqn:htTransCladFuel">
---
> <div id="DD:htTransCladFuel">
552c552
< <div id="Eqn:htTransCladCool">
---
> <div id="DD:htTransCladCool">

For now, should a hack be made to take in a label and tweak the refaddress with a new RefType passed in?

mkLabelModified :: Label -> RefType -> Label
...

--so that the above mentioned (d ^.getLabel) gets replaced with
(mkLabelModified (d ^. getLabel) EqnB)

?

@JacquesCarette
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, good question. Now that you have asked it, I think that Eqn: is something I do in my latex when I have some raw equation for which I have not really thought enough about "where does it belong". But in Drasil, that is never the case: we always know where an equation belongs. It arises in a context. And so if that context is used to 'mark' each equation, giving some provenance information [not quite traceability], that's good.

In other words, I think that the change described above is good. In general, I think the label really ought to be

DD:<label-of-DD>:<label-of-equation>

so as to record real traceability information.

@smiths
Copy link
Collaborator

@smiths smiths commented on a573061 Aug 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of capturing provenance information (although the labels can get a little long). However, if the label starts with DD doesn't that imply it is a data definition? I might like Eqn: better than that. It is actually a bit hard to tell without seeing a document completed the way @JacquesCarette proposes. Ideally, it would be nice if this is something that we could change easily. We could then experiment to see what approach we prefer.

In the interest of making progress, I'm fine with trying the DD:<label-of-DD>:<label-of-equation> approach, if that is the easiest thing to implement at this point.

@JacquesCarette
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One clarification: I only meant this for this "reference address" (i.e. internal label, that would be used in the .tex and .html files), not for the short name that would show up in the rendered document.

Eventually, we'll also likely do something similar (and probably even longer) to the UIDs.

That's the benefit of have layers of names for the same thing: we can have rich provenance information being tracked, without forcing users to see this by default.

@smiths
Copy link
Collaborator

@smiths smiths commented on a573061 Aug 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks for the clarification @JacquesCarette.

Please sign in to comment.