Skip to content

Commit

Permalink
PDF generators
Browse files Browse the repository at this point in the history
  • Loading branch information
rdpeng committed Jan 21, 2014
1 parent 4f28f20 commit 2e3bd19
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 05_ReproducibleResearch/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
DELAY = 1000
RMD_FILES = $(wildcard */index.Rmd)
HTML_FILES = $(patsubst %.Rmd, %.html, $(RMD_FILES))
PDF_FILES = $(patsubst %/index.html, lectures/%.pdf, $(HTML_FILES))

listfiles:
@echo $(RMD_FILES)
@echo $(HTML_FILES)
@echo $(PDF_FILES)


html: $(HTML_FILES)
pdf: $(PDF_FILES)
all: html pdf

zip: $(PDF_FILES)
zip all_pdf_files.zip $^

lectures/%.pdf: %/index.html
casperjs makepdf.js $< $@ $(DELAY)

%/index.html: %/index.Rmd
cd $(dir $<) && Rscript -e "slidify::slidify('index.Rmd')" && cd ..

10 changes: 10 additions & 0 deletions 05_ReproducibleResearch/makepdf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var casper = require('casper').create({viewportSize:{width:1500,height:1000}});
var args = casper.cli.args;
var imgfile = (args[1] || Math.random().toString(36).slice(2))
casper.start(args[0], function() {
this.wait(args[2], function(){
this.captureSelector(imgfile, "slides");
});
});

casper.run();

0 comments on commit 2e3bd19

Please sign in to comment.