Drasil icon indicating copy to clipboard operation
Drasil copied to clipboard

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

Open balacij opened this issue 1 year ago • 8 comments

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 avatar Sep 17 '23 01:09 balacij

Great idea!

smiths avatar Sep 19 '23 16:09 smiths

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 avatar Dec 17 '23 23:12 daijingz

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 avatar Dec 18 '23 01:12 daijingz

@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.

daijingz avatar Dec 18 '23 01:12 daijingz

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

JacquesCarette avatar Dec 18 '23 14:12 JacquesCarette

@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?

daijingz avatar Jan 22 '24 23:01 daijingz

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): https://github.com/JacquesCarette/Drasil/blob/04a5f3bf87b13061064613bb13dbe28007b8d017/code/drasil-website/lib/Drasil/Website/Example.hs#L163-L184

balacij avatar Jan 22 '24 23:01 balacij

@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.

daijingz avatar Jan 28 '24 00:01 daijingz