[education/rkward/devel/workspace_output] rkward/rbackend/rpackages/rkward/R: Fixes to rk.import.legacy.output()

Thomas Friedrichsmeier null at kde.org
Mon Mar 7 21:06:32 GMT 2022


Git commit fe43050695ad9497186ca2430b6345b872274653 by Thomas Friedrichsmeier.
Committed on 07/03/2022 at 21:06.
Pushed by tfry into branch 'devel/workspace_output'.

Fixes to rk.import.legacy.output()

M  +5    -6    rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
M  +2    -3    rkward/rbackend/rpackages/rkward/R/rk.output.R

https://invent.kde.org/education/rkward/commit/fe43050695ad9497186ca2430b6345b872274653

diff --git a/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R b/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
index f09ff7fa..d71f04b8 100644
--- a/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
+++ b/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
@@ -228,16 +228,15 @@
 			if (substring (toupper(sline), 0, 3) == "IMG") {
 				parts <- strsplit (sline, "[Ss][Rr][Cc]")[[1]]
 				if (length (parts) < 2) next
-				parts <- strsplit (parts[2], "\"")[[1]]
-				if (length (parts) < 2) next
-				files <- c (files, parts[2])
 			} else if (substring (toupper(sline), 0, 6) == "OBJECT") {
 				parts <- strsplit (sline, "[Dd][Aa][Tt][Aa]")[[1]]
 				if (length (parts) < 2) next
-				parts <- strsplit (parts[2], "\"")[[1]]
-				if (length (parts) < 2) next
-				files <- c (files, parts[2])
+			} else {
+				next
 			}
+			parts <- strsplit (parts[2], "\"")[[1]]
+			if (length (parts) < 2) next
+			files <- c (files, sub("^file://", "", parts[2]))
 		}
 	}
 	files
diff --git a/rkward/rbackend/rpackages/rkward/R/rk.output.R b/rkward/rbackend/rpackages/rkward/R/rk.output.R
index 8a419aa1..c02323c4 100644
--- a/rkward/rbackend/rpackages/rkward/R/rk.output.R
+++ b/rkward/rbackend/rpackages/rkward/R/rk.output.R
@@ -130,7 +130,7 @@ Do not write anything to the target filename, directly! This is purely for infor
 "rk.import.legacy.output" <- function(filename=file.path(rk.home(), "rk_out.html"), import=TRUE, delete=FALSE) {
 	f <- filename
 	stopifnot(file.exists(f))
-	files <- rkward:::.rk.get.images.in.html.file(f)
+	files <- .rk.get.images.in.html.file(f)
 	css <- file.path(rk.home(), "rk_out.css")
 	if (file.exists(css)) files <- c(files, css)
 
@@ -141,10 +141,9 @@ Do not write anything to the target filename, directly! This is purely for infor
 
 		stopifnot(file.copy(f, file.path(wd, "index.html"), overwrite=TRUE))
 		stopifnot(all(file.copy(files, file.path(wd, basename(files)), overwrite=TRUE)))
-		wd$save(save_filename)
 		out$view()
 
-		rk.show.message("The legacy output file has been imported. If satisfied with the result, you now save it in the new format. To remove the old output file, run rk.import.legacy.output(import=FALSE,delete=TRUE)")
+		rk.show.message("The legacy output file has been imported. If satisfied with the result, you can now save it in the new format. To remove the old output file, run rk.import.legacy.output(import=FALSE,delete=TRUE)")
 	}
 
 	if (delete) {


More information about the rkward-tracker mailing list