diff --git a/code/drasil-data/Data/Drasil/Utils.hs b/code/drasil-data/Data/Drasil/Utils.hs index 7ee9b634a2..1d56f42f2e 100644 --- a/code/drasil-data/Data/Drasil/Utils.hs +++ b/code/drasil-data/Data/Drasil/Utils.hs @@ -175,25 +175,6 @@ unwrap :: (Maybe UnitDefn) -> Sentence unwrap (Just a) = Sy (a ^. usymb) unwrap Nothing = EmptyS -<<<<<<< HEAD --- Used to help make Qdefinitions when uid, term, and symbol come from the same source -mkDataDef :: (Quantity c) => c -> Expr -> Label -> QDefinition -mkDataDef cncpt equation lbl = datadef (getUnit cncpt) lbl - where datadef (Just a) lbl = fromEqn (cncpt ^. uid) (cncpt ^. term) EmptyS - (eqSymb cncpt) a equation [] lbl - datadef Nothing lbl = fromEqn' (cncpt ^. uid) (cncpt ^. term) EmptyS - (eqSymb cncpt) equation [] lbl - --- Same as 'mkDataDef', but with an additional Sentence that can be taken as "extra information"; issue #350 -mkDataDef' :: (Quantity c) => c -> Expr -> Sentence -> References -> Label -> QDefinition -mkDataDef' cncpt equation extraInfo refs lbl = datadef (getUnit cncpt) lbl - where datadef (Just a) lbl = fromEqn (cncpt ^. uid) (cncpt ^. term) extraInfo - (eqSymb cncpt) a equation refs lbl - datadef Nothing lbl = fromEqn' (cncpt ^. uid) (cncpt ^. term) extraInfo - (eqSymb cncpt) equation refs lbl - -======= ->>>>>>> master prodUCTbl :: [[Sentence]] -> Contents prodUCTbl cases = Table [S "Actor", titleize input_ +:+ S "and" +:+ titleize output_] cases diff --git a/code/drasil-example/Drasil/GlassBR/Assumptions.hs b/code/drasil-example/Drasil/GlassBR/Assumptions.hs index 523a7a0f84..9111f90d34 100644 --- a/code/drasil-example/Drasil/GlassBR/Assumptions.hs +++ b/code/drasil-example/Drasil/GlassBR/Assumptions.hs @@ -29,14 +29,14 @@ newAssumptions :: [AssumpChunk] -- For testing newAssumptions = [newA1, newA2, newA3, newA4, newA5, newA6, newA7, newA8] newA1, newA2, newA3, newA4, newA5, newA6, newA7, newA8 :: AssumpChunk -newA1 = assump "glassTyA" a1Desc "glassTy" -newA2 = assump "glassConditionA" a2Desc "glassCondition" -newA3 = assump "explsnScenarioA"a3Desc "explainScenario" -newA4 = assump "standardValuesA" (a4Desc load_dur) "StandardValues" -newA5 = assump "glassLiteA" a5Desc "glassLite" -newA6 = assump "bndryConditionsA" a6Desc "boundaryConditions" -newA7 = assump "responseTyA" a7Desc "responseType" -newA8 = assump "ldfConstantA" (a8Desc constant_LoadDF) "ldfConstant" +newA1 = assump "glassTyA" a1Desc (makeRA'' "glassTy") +newA2 = assump "glassConditionA" a2Desc (makeRA'' "glassCondition" ) +newA3 = assump "explsnScenarioA"a3Desc (makeRA'' "explainScenario") +newA4 = assump "standardValuesA" (a4Desc load_dur) (makeRA'' "StandardValues") +newA5 = assump "glassLiteA" a5Desc (makeRA'' "glassLite") +newA6 = assump "bndryConditionsA" a6Desc (makeRA'' "boundaryConditions") +newA7 = assump "responseTyA" a7Desc (makeRA'' "responseType" ) +newA8 = assump "ldfConstantA" (a8Desc constant_LoadDF) (makeRA'' "ldfConstant") assumptionDescs :: [Sentence] assumptionDescs = [a1Desc, a2Desc, a3Desc, a4Desc load_dur, a5Desc, a6Desc, a7Desc, a8Desc constant_LoadDF] diff --git a/code/drasil-example/Drasil/HGHC/HeatTransfer.hs b/code/drasil-example/Drasil/HGHC/HeatTransfer.hs index 328c5de51e..45a7ff7b07 100644 --- a/code/drasil-example/Drasil/HGHC/HeatTransfer.hs +++ b/code/drasil-example/Drasil/HGHC/HeatTransfer.hs @@ -35,7 +35,7 @@ htTransCladCool = fromEqn "htTransCladCool" (nounPhraseSP "convective heat transfer coefficient between clad and coolant") EmptyS (lH `sub` lC) heat_transfer_coef htTransCladCool_eq [] - "htTransCladCool" --shortname + (makeRA'' "htTransCladCool") htTransCladCool_eq = (2 * (sy cladCond) * (sy coolFilmCond) / (2 * (sy cladCond) + (sy cladThick) @@ -45,7 +45,7 @@ htTransCladFuel = fromEqn "htTransCladFuel" (nounPhraseSP "effective heat transfer coefficient between clad and fuel surface") EmptyS (lH `sub` lG) heat_transfer_coef htTransCladFuel_eq [] - "htTransCladFuel" --shortname + (makeRA'' "htTransCladFuel") htTransCladFuel_eq = (2 * (sy cladCond) * (sy gapFilmCond)) / (2 * (sy cladCond) + ((sy cladThick) * (sy gapFilmCond))) diff --git a/code/drasil-example/Drasil/SRS.hs b/code/drasil-example/Drasil/SRS.hs index ab537d6d44..c2654752c7 100644 --- a/code/drasil-example/Drasil/SRS.hs +++ b/code/drasil-example/Drasil/SRS.hs @@ -99,7 +99,7 @@ tOfSymb cs ss = section' (titleize Doc.tOfSymb) cs ss "ToS" --function that sets the shortname of each section to be the reference address section' :: Sentence -> [Contents] -> [Section] -> RefAdd -> Section -section' a b c d = section a b c d (shortname' $ getStr a) --FIXME: getStr hack +section' a b c d = section a b c (mkLabelRA' (d ++ "Label") d) where getStr :: Sentence -> String getStr (S s) = s @@ -108,4 +108,4 @@ section' a b c d = section a b c d (shortname' $ getStr a) --FIXME: getStr hack -- missingP :: [Contents] -missingP = [Paragraph $ S "..."] +missingP = [Paragraph $ S "..."] \ No newline at end of file diff --git a/code/drasil-example/Drasil/SWHS/References.hs b/code/drasil-example/Drasil/SWHS/References.hs index fdd3059eda..905b6e4464 100644 --- a/code/drasil-example/Drasil/SWHS/References.hs +++ b/code/drasil-example/Drasil/SWHS/References.hs @@ -20,11 +20,13 @@ ref1 = cBookA "bueche1986" [jBueche] (S "Introduction to Physics for Scientists") (S "McGraw Hill") 1986 [edition 4, address (S "New York City, New York")] + (makeRA'' "bueche1986") ref2 = cBookA "incroperaEtAl2007" [fIncropera, dDewitt, tBergman, aLavine] (S "Fundamentals of Heat and Mass Transfer") (S "John Wiley and Sons") 2007 [edition 6, address (S "Hoboken, New Jersey")] + (makeRA'' "incroperaEtAl2007") ref3 = koothoor2013 @@ -33,6 +35,7 @@ ref4 = cMisc "lightstone2012" [ title (S "Derivation of tank/pcm model"), year 2012, note (S "From Marilyn Lightstone's Personal Notes")] + (makeRA'' "lightstone2012") ref5 = parnasClements1986 diff --git a/code/drasil-example/drasil-example.cabal b/code/drasil-example/drasil-example.cabal index 987e2e664d..98dc178738 100644 --- a/code/drasil-example/drasil-example.cabal +++ b/code/drasil-example/drasil-example.cabal @@ -1,5 +1,5 @@ Name: drasil-example -Version: 0.1.1 +Version: 0.1.4 Cabal-Version: >= 1.18 Author: Dan Szymczak, Steven Palmer, Jacques Carette, Spencer Smith build-type: Simple diff --git a/code/drasil-lang/Language/Drasil.hs b/code/drasil-lang/Language/Drasil.hs index 70a221420e..0a2a79622c 100644 --- a/code/drasil-lang/Language/Drasil.hs +++ b/code/drasil-lang/Language/Drasil.hs @@ -212,7 +212,7 @@ module Language.Drasil ( , RefAdd -- Label , Label - , mkLabelRA, mkLabelRA' + , mkLabelRA, mkLabelRA', mkLabelRA'' ) where import Prelude hiding (log, sin, cos, tan, sqrt, id, return, print, break, exp, product) @@ -244,17 +244,14 @@ import Language.Drasil.Classes (HasUID(uid), NamedIdea(term), Idea(getA), HasUnitSymbol(usymb), IsUnit, CommonIdea(abrv), HasAdditionalNotes(getNotes), Constrained(constraints), HasReasVal(reasVal), ExprRelat(relat), HasDerivation(derivations), HasReference(getReferences), HasLabel(getLabel)) -<<<<<<< HEAD import Language.Drasil.Label.Core (Label) -======= ->>>>>>> master import Language.Drasil.Chunk.AssumpChunk import Language.Drasil.Chunk.Attribute import Language.Drasil.Chunk.Derivation (Derivation) import Language.Drasil.Chunk.References (References) import Language.Drasil.Chunk.ShortName (ShortName, shortname', HasShortName(shortname)) import Language.Drasil.Chunk.Change -import Language.Drasil.Label (mkLabelRA, mkLabelRA') +import Language.Drasil.Label (mkLabelRA, mkLabelRA', mkLabelRA'') import Language.Drasil.Chunk.Citation ( -- Types Citation, BibRef, CiteField, Month(..), HP, CitationKind(..) diff --git a/code/drasil-lang/Language/Drasil/Chunk/DataDefinition.hs b/code/drasil-lang/Language/Drasil/Chunk/DataDefinition.hs index 81696f8d37..433cc1f26a 100644 --- a/code/drasil-lang/Language/Drasil/Chunk/DataDefinition.hs +++ b/code/drasil-lang/Language/Drasil/Chunk/DataDefinition.hs @@ -11,7 +11,8 @@ import Language.Drasil.Chunk.Quantity (Quantity(getUnit), HasSpace(typ), Quantit mkQuant, qw) import Language.Drasil.Classes (HasUID(uid), NamedIdea(term), Idea(getA), HasSymbol(symbol), IsUnit, ExprRelat(relat), HasDerivation(derivations), - HasReference(getReferences), ConceptDomain, HasAdditionalNotes(getNotes)) + HasReference(getReferences), ConceptDomain, HasAdditionalNotes(getNotes), + HasLabel(getLabel)) import Language.Drasil.Chunk.SymbolForm (eqSymb) import Language.Drasil.Chunk.ShortName (ShortName, HasShortName(shortname), shortname') @@ -19,12 +20,14 @@ import Control.Lens(makeLenses, (^.), view) import Language.Drasil.Chunk.Eq(fromEqn, fromEqn') +import Language.Drasil.Label (mkLabelRA') + -- A data definition is a QDefinition that may have additional notes. -- It also has attributes like derivation, source, etc. data DataDefinition = DD { _qd :: QDefinition , _ref :: References , _deri :: Derivation - , _lbl :: ShortName {-FIXME: Upgrade to Label-} + , _lbl :: Label , _notes :: Maybe [Sentence] } makeLenses ''DataDefinition @@ -41,16 +44,18 @@ instance HasReference DataDefinition where getReferences = ref instance Eq DataDefinition where a == b = (a ^. uid) == (b ^. uid) instance HasDerivation DataDefinition where derivations = deri instance HasAdditionalNotes DataDefinition where getNotes = notes -instance HasShortName DataDefinition where shortname = view lbl +instance HasLabel DataDefinition where getLabel = qd . getLabel --FIXME: will eventually just be viewed from here +instance HasShortName DataDefinition where shortname = lbl . shortname + -- Used to help make Qdefinitions when uid, term, and symbol come from the same source mkDataDef :: (Quantity c) => c -> Expr -> QDefinition mkDataDef cncpt equation = datadef $ getUnit cncpt --should references be passed in at this point? where datadef (Just a) = fromEqn (cncpt ^. uid) (cncpt ^. term) EmptyS - (eqSymb cncpt) a equation [] (cncpt ^. uid) --shortname + (eqSymb cncpt) a equation [] (mkLabelRA' ((cncpt ^. uid) ++ "Label") (cncpt ^. uid)) datadef Nothing = fromEqn' (cncpt ^. uid) (cncpt ^. term) EmptyS - (eqSymb cncpt) equation [] (cncpt ^. uid) --shortname + (eqSymb cncpt) equation [] (mkLabelRA' ((cncpt ^. uid) ++ "Label") (cncpt ^. uid)) -- | Smart constructor for data definitions mkDD :: QDefinition -> References -> Derivation -> String{-Label-} -> Maybe [Sentence] -> DataDefinition -mkDD a b c _ e = DD a b c (shortname' $ a ^. uid {-shortname' d-}) e -- FIXME: should the shortname be passed in or derived? \ No newline at end of file +mkDD a b c _ e = DD a b c (mkLabelRA' ((a ^. uid) ++ "Label") (a ^. uid)) e -- FIXME: should the Label be passed in or derived? \ No newline at end of file diff --git a/code/drasil-lang/Language/Drasil/Chunk/Eq.hs b/code/drasil-lang/Language/Drasil/Chunk/Eq.hs index c81f12b637..9b6c5ccc8a 100644 --- a/code/drasil-lang/Language/Drasil/Chunk/Eq.hs +++ b/code/drasil-lang/Language/Drasil/Chunk/Eq.hs @@ -29,7 +29,7 @@ data QDefinition = EC , _equat :: Expr , _ref :: References -- FIXME: to be removed , _deri :: Derivation -- FIXME: to be removed - , _refName :: ShortName -- FIXME: to be removed + , _lb :: Label -- FIXME: to be removed , _notes :: Maybe [Sentence] -- FIXME: to be removed } makeLenses ''QDefinition diff --git a/code/drasil-lang/Language/Drasil/Label.hs b/code/drasil-lang/Language/Drasil/Label.hs index 7e08ab40ed..deaa2f93f2 100644 --- a/code/drasil-lang/Language/Drasil/Label.hs +++ b/code/drasil-lang/Language/Drasil/Label.hs @@ -1,4 +1,4 @@ -module Language.Drasil.Label (Label, mkLabelRA, mkLabelRA') where +module Language.Drasil.Label (Label, mkLabelRA, mkLabelRA', mkLabelRA'') where import Language.Drasil.Label.Core import Language.Drasil.Classes (HasUID(uid), HasRefAddress(getRefAdd)) @@ -19,6 +19,11 @@ mkLabelRA i ref shortn = Lbl i (RefAdd $ ensureASCII ref) (shortname' shortn) mkLabelRA' :: String -> String -> Label mkLabelRA' i refAndshortn = Lbl i (RefAdd $ ensureASCII refAndshortn) (shortname' refAndshortn) +-- for when reference address and the display should be the same +mkLabelRA'' :: String -> Label +mkLabelRA'' iAndRefAndshortn = Lbl (iAndRefAndshortn ++ "Label") + (RefAdd $ ensureASCII iAndRefAndshortn) (shortname' iAndRefAndshortn) + mkLabelML :: String -> String -> String -> Label mkLabelML i ref shortn = Lbl i (MetaLink $ ensureASCII ref) (shortname' shortn) diff --git a/code/drasil-lang/drasil-lang.cabal b/code/drasil-lang/drasil-lang.cabal index f1531c0558..09b90ad244 100644 --- a/code/drasil-lang/drasil-lang.cabal +++ b/code/drasil-lang/drasil-lang.cabal @@ -1,5 +1,5 @@ Name: drasil-lang -Version: 0.1.3 +Version: 0.1.8 Cabal-Version: >= 1.18 Author: Dan Szymczak, Steven Palmer, Jacques Carette, Spencer Smith build-type: Simple