-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathdocument.sh
executable file
·24 lines (24 loc) · 959 Bytes
/
document.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
set -e
Rscript -e 'devtools::document()'
cd vignettes
../scripts/compile_examples.sh
cd ..
for v in Examples_Python Examples_R
do
rm -rf "vignettes/${v}_files"
jupyter nbconvert --to markdown "vignettes/${v}.ipynb"
mv "vignettes/${v}.md" "vignettes/${v}.Rmd"
sed 's/```r/```{r eval=FALSE}/g' "vignettes/${v}.Rmd" -i
sed 's/```python/```{python eval=FALSE}/g' "vignettes/${v}.Rmd" -i
sed 's/\[png\]/[ ]/g' "vignettes/${v}.Rmd" -i
title=${v/_/ - }
sed -i "1s/^/---\ntitle: \"${title}\"\nvignette: >\n %\\\\VignetteEngine{knitr::rmarkdown}\n %\\\\VignetteIndexEntry{${title}}\n %\\\\usepackage[utf8]{inputenc}\n---\n\n\`\`\`{r echo=FALSE}\nknitr::opts_chunk\$set\(python.reticulate=FALSE\)\n\`\`\`\n\n/" "vignettes/${v}.Rmd"
done
rm -rf docs/articles
echo "Compressing images"
for v in Examples_Python Examples_R
do
trimage -q -d "vignettes/${v}_files" || true
done
Rscript -e 'pkgdown::build_site()'