lorenzwalthert / strcode

Structure your code better.
https://lorenzwalthert.github.io/strcode1/
MIT License
50 stars 6 forks source link

Allowing header attributes #5

Open olyerickson opened 7 years ago

olyerickson commented 7 years ago

I was very excited to see strcode!

My team would like to be able to associate semantic attributes with blocks of code. I think this could be done using Markdown Extended's header attributes; see esp

http://rmarkdown.rstudio.com/authoring_pandoc_markdown.html

The idea would be to allow the specification of classes and attributes in the header via an extended version of the Shiny gadget. I'd like to start a discussion on this...

lorenzwalthert commented 7 years ago

ok, thanks @olyerickson for opening the issue. So I might need some further clarification on this to understand your request. So you would like to insert something like the following with strcode, right?

# _________________________________________ # my_header {#my_identifier .my_class} ####

Whereas the identifier and (multiple) attributes can be inserted via the Shiny Gadget. What is the ultimate goal of this? strcode was designed to work on plain .R files (or within junks of .Rmd files) and it does not support any markdown syntax. So if you use attributes and classes, I guess you would ultimately want to post-process the file with pandoc. Is that right?

olyerickson commented 7 years ago

Yes, that is precisely the case. We're working on something we're calling "semantic markdown," which we see as a variation of .Rmd that allows for associating semantics with code blocks.

The basic classes of the code blocks would be provided by a subset of ProvONE, http://vcvcomputing.com/provone/provone.html (Program, Subprogram, Data, Visualizations, etc). The headers would allow for additional classes (entities can have multiple types) as well as properties, etc.

We envision producing linked data like this http://orion.tw.rpi.edu/~olyerickson/cwf.ttl and a resulting graph like this http://bit.ly/cwf_rdf_visualization based on a script...

olyerickson commented 7 years ago

In our vision, "semantic markdown" renders to RDF or XHTML+RDFa (that's our problem). What's super interesting about strcode is that you provide a really nice interface for users to add code blocks, and an interface paradigm for specifying classes and properties. Very cool.

olyerickson commented 7 years ago

By our approach, it's possible to visualize the script structure e.g like this http://bit.ly/2ldwVEJ

lorenzwalthert commented 7 years ago

thanks for sharing this. I just watched your recent talk on semantic markdown which was also helpful to understand what you envision. I thought about how to extend strcode in that direction too (especially on the aspect of visualising dependencies and data analysis processes), but did not really make any progress. Hence, I would indeed be very happy to collaborate with you on that matter. To this end, I have modified the "front-end" (and only the "front-end") of the Shiny Gadget (see new branch semantics), so one can now tick the box "add semantics", and three additional input fields open.

Feedback is most welcome, also on details. Please note that this is a skeleton only, I have some things in mind that could be improved as well:

As a next step, I suggest to implement a skeleton of the "backend", so the selections actually produce markdown compatible header attributes. If you want to, you are welcome to submit PRs if you want to code some of it yourself.

olyerickson commented 7 years ago

Thanks very much for this! I'll install the semantics branch and take a look

lorenzwalthert commented 7 years ago

I just pushed a version to the semantics branch that has a backend as well. Now, you should be able to insert with the Gadget what you wanted to. Feedback is most welcome.

olyerickson commented 7 years ago

Looking forward to testing it!

On Wed, Mar 15, 2017 at 5:15 PM, Lorenz Walthert notifications@github.com wrote:

I just pushed a version to the semantics branch that has a backend as well. Now, you should be able to insert with the Gadget what you wanted to. Feedback is most welcome.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lorenzwalthert/strcode/issues/5#issuecomment-286881680, or mute the thread https://github.com/notifications/unsubscribe-auth/AAV4-TIzTohHyZjTnkhwlpCJWVDxEdhOks5rmFTpgaJpZM4MPoSX .

-- John S. Erickson, Ph.D. Director of Operations, The Rensselaer IDEA Deputy Director, Web Science Research Center (RPI) http://idea.rpi.edu/ olyerickson@gmail.com Twitter & Skype: olyerickson

lorenzwalthert commented 7 years ago

Cool. It's not yet tested extensively.

lorenzwalthert commented 7 years ago

@olyerickson have you had a chance to test the semantics implementation?

olyerickson commented 7 years ago

I briefly did, and hope to get to it this week. The past few weeks have been grant writing ;)

On Sun, Apr 9, 2017 at 7:40 AM, Lorenz Walthert notifications@github.com wrote:

@olyerickson https://github.com/olyerickson have you had a chance to test the semantics implementation?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lorenzwalthert/strcode/issues/5#issuecomment-292780605, or mute the thread https://github.com/notifications/unsubscribe-auth/AAV4-Q3lvDA9vXXTppqx1_tICeXruHV3ks5ruMOkgaJpZM4MPoSX .

-- John S. Erickson, Ph.D. Director of Operations, The Rensselaer IDEA Deputy Director, Web Science Research Center (RPI) http://idea.rpi.edu/ olyerickson@gmail.com Twitter & Skype: olyerickson

lorenzwalthert commented 7 years ago

I was quite delighted to see @XiaoliangJiang working on an extension of strcode that was documented in his blog. I just had a look at his fork and I was wondering why all but 3 commits were gone. Is there any interest from your side to merge the changes back in the upstream branch? I think it would be nice to combine the functionality in one place.

olyerickson commented 7 years ago

Yes, we absolutely need to do this! You can see all of his code here https://github.com/XiaoliangJiang/semarkdown

@XiaoliangJiang https://github.com/xiaoliangjiang Can you please respond?

Thanks!

On Sun, Sep 24, 2017 at 5:24 AM, Lorenz Walthert notifications@github.com wrote:

I was quite delighted to see @XiaoliangJiang https://github.com/xiaoliangjiang working on an extension of strcode that was documented in his blog https://notebooks.dataone.org/semantic-annotation/. I just had a look at his fork and I was wondering why all but 3 commits were gone. Is there any interest from your side to merge the changes back in the upstream branch? I think it would be nice to combine the functionality in one place.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lorenzwalthert/strcode/issues/5#issuecomment-331698059, or mute the thread https://github.com/notifications/unsubscribe-auth/AAV4-QQe3_WmlOE6NnrgdHN889O-HRlzks5slh_rgaJpZM4MPoSX .

-- John S. Erickson, Ph.D. Director of Operations, The Rensselaer IDEA Deputy Director, Web Science Research Center (RPI) http://idea.rpi.edu/ olyerickson@gmail.com Twitter & Skype: olyerickson

lorenzwalthert commented 7 years ago

Cool. Looking forward to it. Will keep an eye on semarkdown. Let me know if there is anything I can help you out with.