att / rcloud

Collaborative data analysis and visualization
http://rcloud.social
MIT License
432 stars 142 forks source link

do not rely on github for language tagging #1412

Closed gordonwoodhull closed 9 years ago

gordonwoodhull commented 9 years ago

@s-u writes:

The public github is now screwing up language tagging - it tags .R cells under some circumstances as "Rebol" instead of "R" (e.g. if you have an 1+1 cell) - which wreaks chaos on RCloud. I have a quick hack below, but I think we should be ignoring the language tag and use our own detection based on extension registration through the plugins.

diff --git a/rcloud.support/R/rcloud.support.R b/rcloud.support/R/rcloud.support.R
index 6690e4a..bfa4e9d 100644
--- a/rcloud.support/R/rcloud.support.R
+++ b/rcloud.support/R/rcloud.support.R
@@ -24,6 +24,8 @@ rcloud.augment.notebook <- function(res) {
   names(version2tag) <- versions
   version2tag <- Filter(Negate(is.null), version2tag)

+    if (length(res$content$files)) res$content$files <- lapply(res$content$files, function(o) { if (o$language == "Rebol") o$language <- "R"; o })
+
   if(length(hist)>0)
     for(i in 1:length(hist)) {
       tag <- version2tag[[hist[[i]]$version]]
gordonwoodhull commented 9 years ago

Notebook ends up in an inconsistent state where it isn't possible to change the cell. If you try, another cell gets created with the same part number but no extension. This cell is not visible.

https://gist.github.com/gordonwoodhull/3f1e8d54063afc7f724e/c058aec7407aceae0ba15a58192c749d35db13b5

gordonwoodhull commented 9 years ago

I suggest that the RCloud language extensions should be consulted first, and then only use GitHub only if the file extension is unknown.

I support changing the definition of the current field, even though it's one defined by GitHub Gist. It will not be the first place we're doing this (fork_of comes to mind), but it does mean we need to define the format somewhere.

prateek05 commented 9 years ago

Problem with using RMarkdown too using GHE 1.x $content$files$part1.Rmd$filename [1] "part1.Rmd"

$content$files$part1.Rmd$type [1] "text/plain"

$content$files$part1.Rmd$language NULL

gordonwoodhull commented 9 years ago

Fix contains a little bit of code to allow multiple file extensions for the same language, but this does not work yet because of the same problem as #1166 unsupported languages crashing the notebook - internally we track cells as number + language and don't retain the actual file extension.