Commit fe430506 authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

Fixes to rk.import.legacy.output()

parent a19f0663
......@@ -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
......
......@@ -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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment