Skip to content

Commit

Permalink
Update command to work with hugo
Browse files Browse the repository at this point in the history
  • Loading branch information
lcolladotor committed Jan 20, 2017
1 parent 0e0d3c3 commit f043c05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Commands/knit to post.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ html_header 'knit html result' "$FILENAME"
echo '<h2>Kniting…</h2>'
SW=${TM_SWEAVE_WD:=${TM_DIRECTORY}}
echo -e "setwd('$SW'); library(knitr); KnitPost <- function(input, base.url = '/', fig.path) { opts_knit\$set(base.url = base.url); opts_chunk\$set(fig.path = fig.path); opts_chunk\$set(fig.cap = 'center'); render_jekyll(); knit(input) }; fig.path <- paste0('figs/', sub('.Rmd$', '', basename('$FILENAME')), '/'); KnitPost('$FILENAME', base.url='http://lcolladotor.github.io/', fig.path=fig.path); site.path <- '/Users/lcollado/Dropbox/Code/lcolladotor.github.com'; file.copy(sub('.Rmd', '.md', basename('$FILENAME')), file.path(site.path, '_posts/'), overwrite=TRUE); if(FALSE) unlink(file.path(site.path, fig.path), recursive=TRUE); file.copy(fig.path, file.path(site.path, 'figs/'), recursive=TRUE)" | R --vanilla --quiet | pre
echo -e "setwd('$SW'); library(knitr); KnitPost <- function(input, base.url = '/', fig.path) { opts_knit\$set(base.url = base.url); opts_chunk\$set(fig.path = fig.path); opts_chunk\$set(fig.cap = 'center'); render_markdown(TRUE); knit(input) }; fig.path <- paste0('figs/', sub('.Rmd$', '', basename('$FILENAME')), '/'); KnitPost('$FILENAME', base.url='http://lcolladotor.github.io/', fig.path=fig.path); site.path <- '/Users/lcollado/Dropbox/Code/hugoblog'; file.copy(sub('.Rmd', '.md', basename('$FILENAME')), file.path(site.path, 'content', 'post/'), overwrite=TRUE); if(FALSE) unlink(file.path(site.path, fig.path), recursive=TRUE); file.copy(fig.path, file.path(site.path, 'static', 'figs/'), recursive=TRUE)" | R --vanilla --quiet | pre
# If there is output and it's newer than the current document, then we go directly to preview or link to it.
if [ -s "${RESULT}" -a ! "$RESULT" -ot "$FILENAME" ]; then
Expand All @@ -51,7 +51,7 @@ if [ -s "${RESULT}" -a ! "$RESULT" -ot "$FILENAME" ]; then
## Run: jekyll serve -w
## Then this will open Google Chrome on the localhost
echo $RESULT
open -a "$V" "http://localhost:4000/"
open -a "$V" "http://localhost:1313/"
else
strong "Error locating external viewer: $V"
fi
Expand Down

0 comments on commit f043c05

Please sign in to comment.