Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website: case studies list: add a link to the source code too #3668

Closed
balacij opened this issue Sep 17, 2023 · 8 comments · Fixed by #3727
Closed

Website: case studies list: add a link to the source code too #3668

balacij opened this issue Sep 17, 2023 · 8 comments · Fixed by #3727
Labels
documentation Documentation of Drasil itself - how to install, how to use, build system etc. newcomers Good first issue to work on!

Comments

@balacij
Copy link
Collaborator

balacij commented Sep 17, 2023

See the below image. In our list of “Generated Examples”/case studies, we show the final fruits of the projects, but not the inputs. We should somehow link to the relevant source code folder too. For example, for DblPend, we should add a bullet item: "Source Code" that is clickable to https://github.com/JacquesCarette/Drasil/tree/master/code/drasil-example/dblpend (at the relevant commit tree however, similar to the stable code linked), or we could make the shown names clickable themselves to the same link.

image

@balacij balacij added the newcomers Good first issue to work on! label Sep 17, 2023
@smiths
Copy link
Collaborator

smiths commented Sep 19, 2023

Great idea!

@samm82 samm82 added the documentation Documentation of Drasil itself - how to install, how to use, build system etc. label Sep 20, 2023
@daijingz
Copy link
Contributor

I just have a brief understanding, and I guess this is the expected result:
DblPend - To predict the motion of a double pendulum.
SRS: [HTML] [PDF]
Generated Code:
DblPend [Python] [C++] [C Sharp] [Java]
Generated Code Documentation:
[Source Code]

(Same structure as the example beyond, just inserting a new link)

@daijingz
Copy link
Contributor

Newest update: Find the appropriate place, but do not know how to do:
image
Here the only thing I add two simple links for the source code (The address is not correct)
The only problem here is how to write the address. (Type is Reference)

@daijingz
Copy link
Contributor

@balacij Jason, Can you give me an example of Reference for the method getSRSRef? I know below there is a definition for it, but I do not know what each of its parameter represents.

@JacquesCarette
Copy link
Owner

(@daijingz Jason will eventually answer you, but he's got important deadlines right now, so he is ignoring the Drasil repo for this week).

@daijingz
Copy link
Contributor

daijingz commented Jan 22, 2024

@balacij @JacquesCarette There is one thing I forget: There are three different reference structures in this program:
codeRef, DoxRef, and SRSRef. I think a solution to fill my blank is to add a new link reference type because the link should not in each of these forms. Is that correct? Or I can just use the codeRef format?

@balacij
Copy link
Collaborator Author

balacij commented Jan 22, 2024

I think you should be able to create a new getCodeRef-like function for the source code, and use it similarly to create the text-inlined URIs.

Have a look at getCodeRef's definition (below) AND usage (elsewhere in the file):

-- | Generate a reference towards the code folder. Uses 'getCodePath' to find the code path.
getCodeRef :: Example -> Lang -> String -> Reference
-- We don't have to worry about the case of empty list when pattern matching
-- since that was checked in an earlier function.
--
-- Pattern matches so that examples that only have a single set of choices will be referenced one way.
getCodeRef ex@E{sysInfoE=SI{_sys = sys}, choicesE = chcs} l verName =
makeURI refUID refURI refShortNm
where
-- Append system name and program language to ensure a unique id for each.
refUID = "codeRef" ++ sysName ++ programLang
-- Finds the folder path that holds code for the respective program and system.
refURI = getCodePath (codePath ex) sysName programLang
-- Shortname is the same as the UID, just converted to a Sentence.
refShortNm = shortname' $ S refUID
-- System name, different between one set of choices and multiple sets.
sysName = case chcs of
[_] -> map toLower $ programName sys
_ -> map toLower (programName sys) ++ "/" ++ verName
-- Program language converted for use in file folder navigation.
programLang = convertLang l

@daijingz
Copy link
Contributor

daijingz commented Jan 28, 2024

@balacij @JacquesCarette Here is the last problem: I tried to use some new refUID, however, they are not recognized by the system:
) {NMNZV1D_~AP$(6{YS4CU

This is because I have not defined the reference srcCodeRefDblpend. so the system does not recognize it.

Here is the code: (Same form as CodeRef structures, but much simpler)
Y020USL$A0$ UZ~`@~AOH@N

To fix it, I need to find the place to define a reference, and likely it is in the symbMap function: (the last part introduced inside https://github.com/JacquesCarette/Drasil/wiki/Debugging-in-Drasil#notes-for-reference-not-found-in-referencemap-errors)
However, I have already tried to add my reference inside the last parameter, but it does not work.

Here is my attempt:

symbMap :: ChunkDB
symbMap = cdb (map qw iMods ++ map qw symbols)
  (nw newtonSLR : nw pendulumTitle : nw mass : nw len : nw kilogram : nw inValue : nw newton : nw degree : nw radian
    : nw unitVect : nw unitVectj : [nw errMsg, nw program] ++ map nw symbols ++
   map nw doccon ++ map nw doccon' ++ map nw physicCon ++ map nw mathcon ++ map nw mathcon' ++ map nw physicCon' ++
   map nw physicscon ++ concepts ++ map nw physicalcon ++ map nw acronyms ++ map nw symbols ++ map nw [metre, hertz] ++
   [nw algorithm] ++ map nw compcon ++ map nw educon ++ map nw prodtcon)
  (map cw iMods ++ srsDomains) (map unitWrapper [metre, second, newton, kilogram, degree, radian, hertz]) dataDefs
  iMods genDefns tMods concIns [] [] ([srcCodeRefDblpend] :: [Reference]) -- add your references here

In this attempt, I tried to insert my created reference refUID in the last parameter of the symbMap function, however, this simple calling did not work. I guess the correct way occurs elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation of Drasil itself - how to install, how to use, build system etc. newcomers Good first issue to work on!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants