Browse code

switching from pkgdown to compbiocore mkdocs setup

August Guang authored on 09/11/2018 19:35:20
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,34 @@
1
+# Script to convert .Rd and .Rmd files from man/ and vignettes to docs/*.md for use by MkDocs
2
+library("Rd2md")
3
+library("knitr")
4
+
5
+path = "man/"
6
+files = dir(path)
7
+
8
+for(file in files){
9
+  infile = file.path(path, file)
10
+  outfile = file.path("docs", gsub(".Rd", ".md", file))
11
+  Rd2markdown(infile, outfile, append = FALSE)
12
+}
13
+
14
+vignette_file = dir("vignettes/")
15
+Rmds = vignette_file[grep(".Rmd",vignette_file)]
16
+in_ = file.path("vignettes", Rmds)
17
+out_ = file.path("docs", gsub(".Rmd", ".md", Rmds))
18
+knit(in_, out_)
19
+
20
+
21
+file_rename = function(from, to) {
22
+    todir = dirname(to)
23
+    if (!isTRUE(file.info(todir)$isdir)) dir.create(todir, recursive=TRUE)
24
+    file.rename(from = from,  to = to)
25
+}
26
+
27
+figures = dir("figure/")
28
+for (f in figures){
29
+  file_rename(from = file.path("figure", f),
30
+              to = file.path("docs", "figure", f))
31
+}
32
+
33
+file_rename(from = file.path("README.md"),
34
+            to = file.path("docs", "index.md"))
0 35
\ No newline at end of file