Skip to content

Instantly share code, notes, and snippets.

@kohske
Created March 5, 2014 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kohske/9364680 to your computer and use it in GitHub Desktop.
Save kohske/9364680 to your computer and use it in GitHub Desktop.
unlockBinding("to_deck", asNamespace("slidify"))
f <- function (doc)
{
txt = str_split_fixed(read_file(doc), "\n---", 2)
meta = yaml.load(gsub("^---\n+", "", txt[1]))
meta <- lapply(meta, iconv, "utf8", "sjis")
cfile = ifelse(is.null(meta$config), "config.yml", meta$config)
deck = modifyList(get_config(cfile), c(meta, slides = txt[2]))
deck$standalone = ifelse(deck$mode == "standalone", TRUE,
FALSE)
return(deck)
}
environment(f) <- asNamespace("slidify")
assign("to_deck", f, asNamespace("slidify"))
Sys.setlocale(locale="Japanese_Japan.932")
#knit("index.Rmd", encoding="utf8")
knit("index2.Rmd")
#Sys.setlocale(locale="C")
slidify("index2.md", knit_deck=F)
Sys.setlocale(locale="Japanese_Japan.932")
writeLines(iconv(readLines("index2.html"), from="sjis", to="utf8"), "output.html")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment