Commit e2a32f2b authored by Holger Brandl's avatar Holger Brandl

moved fake yaml header back to end of script to allow for user defined yaml headers

parent 0409e25a
...@@ -44,15 +44,17 @@ tmpScript <- tempfile(fileext=".R") ...@@ -44,15 +44,17 @@ tmpScript <- tempfile(fileext=".R")
## remove sheband and comment-only lines from source document ## remove sheband and comment-only lines from source document
#file.copy(r_script, tmpScript) #file.copy(r_script, tmpScript)
system(paste("cat ", r_script," | grep -Ev '^#+$' | grep -Fv '#!/usr/bin/env Rscript' >", tmpScript))
## add yaml header (will be ignored if already present ## add yaml header (will be ignored if already present
metadata <- paste0( metadata <- paste0('#\n',
'#\'---\n', '#\' ---\n',
'#\'title: ""\n', '#\' title: ""\n',
'#\'author: ""\n', '#\' author: ""\n',
'#\'date: ""\n', '#\' date: ""\n',
'#\'---\n') '#\' ---\n\n')
cat(metadata, file = tmpScript) cat("\n", file = tmpScript, append=TRUE)
system(paste("cat ", r_script," | grep -Ev '^#+$' | grep -Fv '#!/usr/bin/env Rscript' >>", tmpScript)) cat(metadata, file = tmpScript, append=TRUE)
# see http://stackoverflow.com/questions/17341122/link-and-execute-external-javascript-file-hosted-on-github # see http://stackoverflow.com/questions/17341122/link-and-execute-external-javascript-file-hosted-on-github
......
Markdown is supported
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