Skip to content

Instantly share code, notes, and snippets.

@yanping
Created June 14, 2013 10:42
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 yanping/5780942 to your computer and use it in GitHub Desktop.
Save yanping/5780942 to your computer and use it in GitHub Desktop.
下载 knitrBootstrap 的样式文件
# 参考 https://github.com/jimhester/knitrBootstrap/blob/master/R/knit_bootstrap.R
boot_styles = c(
'Default'='http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css',
'Amelia'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/amelia/bootstrap.min.css',
'Cerulean'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/cerulean/bootstrap.min.css',
'Cosmo'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/cosmo/bootstrap.min.css',
'Cyborg'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/cyborg/bootstrap.min.css',
'Journal'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/journal/bootstrap.min.css',
'Readable'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/readable/bootstrap.min.css',
'Simplex'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/simplex/bootstrap.min.css',
'Slate'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/slate/bootstrap.min.css',
'Spacelab'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/spacelab/bootstrap.min.css',
'Spruce'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/spruce/bootstrap.min.css',
'Superhero'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/superhero/bootstrap.min.css',
'United'='http://netdna.bootstrapcdn.com/bootswatch/2.3.1/united/bootstrap.min.css'
)
code_styles = c(
'Default'='http://yandex.st/highlightjs/7.3/styles/default.min.css',
'Dark'='http://yandex.st/highlightjs/7.3/styles/dark.min.css',
'FAR'='http://yandex.st/highlightjs/7.3/styles/far.min.css',
'IDEA'='http://yandex.st/highlightjs/7.3/styles/idea.min.css',
'Sunburst'='http://yandex.st/highlightjs/7.3/styles/sunburst.min.css',
'Zenburn'='http://yandex.st/highlightjs/7.3/styles/zenburn.min.css',
'Visual Studio'='http://yandex.st/highlightjs/7.3/styles/vs.min.css',
'Ascetic'='http://yandex.st/highlightjs/7.3/styles/ascetic.min.css',
'Magula'='http://yandex.st/highlightjs/7.3/styles/magula.min.css',
'GitHub'='http://yandex.st/highlightjs/7.3/styles/github.min.css',
'Google Code'='http://yandex.st/highlightjs/7.3/styles/googlecode.min.css',
'Brown Paper'='http://yandex.st/highlightjs/7.3/styles/brown_paper.min.css',
'School Book'='http://yandex.st/highlightjs/7.3/styles/school_book.min.css',
'IR Black'='http://yandex.st/highlightjs/7.3/styles/ir_black.min.css',
'Solarized - Dark'='http://yandex.st/highlightjs/7.3/styles/solarized_dark.min.css',
'Solarized - Light'='http://yandex.st/highlightjs/7.3/styles/solarized_light.min.css',
'Arta'='http://yandex.st/highlightjs/7.3/styles/arta.min.css',
'Monokai'='http://yandex.st/highlightjs/7.3/styles/monokai.min.css',
'XCode'='http://yandex.st/highlightjs/7.3/styles/xcode.min.css',
'Pojoaque'='http://yandex.st/highlightjs/7.3/styles/pojoaque.min.css',
'Rainbow'='http://yandex.st/highlightjs/7.3/styles/rainbow.min.css',
'Tomorrow'='http://yandex.st/highlightjs/7.3/styles/tomorrow.min.css',
'Tomorrow Night'='http://yandex.st/highlightjs/7.3/styles/tomorrow-night.min.css',
'Tomorrow Night Bright'='http://yandex.st/highlightjs/7.3/styles/tomorrow-night-bright.min.css',
'Tomorrow Night Blue'='http://yandex.st/highlightjs/7.3/styles/tomorrow-night-blue.min.css',
'Tomorrow Night Eighties'='http://yandex.st/highlightjs/7.3/styles/tomorrow-night-eighties.min.css'
)
path = "F:/files"
for(i in 1:length(boot_styles)){
file <- boot_styles[i]
dirName <- tolower(names(file))
workPath <- paste(path,"boot-styles",sep="/")
setwd(workPath)
dir.create(dirName)
setwd(paste(workPath,dirName,sep="/"))
fileName <- tail(unlist(strsplit(boot_styles[i],"/")),1)
download.file(file,fileName)
setwd(workPath)
}
setwd(path)
##----------------------
for(i in 1:length(code_styles)){
file <- code_styles[i]
dirName <- names(file)
workPath <- paste(path,"code-styles",sep="/")
setwd(workPath)
fileName <- tail(unlist(strsplit(code_styles[i],"/")),1)
download.file(file,fileName)
}
setwd(path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment