@@ -50,6 +50,7 @@ generate_hw_pkg = function(x,
5050 name ,
5151 type ,
5252 output_dir = paste0(name , " -" , type ),
53+ render_files = TRUE ,
5354 zip_files = TRUE ) {
5455
5556 if (length(remove_indexes ) > 0 ) {
@@ -77,13 +78,15 @@ generate_hw_pkg = function(x,
7778 # write to .Rmd, then render as html and pdf
7879 writeLines(x , rmd_material_name )
7980
80- rmarkdown :: render(
81- rmd_material_name ,
82- encoding = " UTF-8" ,
83- envir = new.env(),
84- output_format = c(" html_document" , " pdf_document" ),
85- quiet = TRUE
86- )
81+ if (render_files ) {
82+ rmarkdown :: render(
83+ rmd_material_name ,
84+ encoding = " UTF-8" ,
85+ envir = new.env(),
86+ output_format = c(" html_document" , " pdf_document" ),
87+ quiet = TRUE
88+ )
89+ }
8790
8891 if (zip_files ) {
8992 message(" Creating a zip file for " , output_name )
@@ -130,12 +133,14 @@ get_example_filepath = function(x) {
130133# ' Transforms an RMarkdown file into two separate files: `filename-assign`
131134# ' and `filename-solutions`
132135# '
133- # ' @param file Input `.Rmd` file with `-main.Rmd` in the filename.
134- # ' @param output_dir Output directory. Defaults to name of prefix of filename.
135- # ' @param soln_file Generate Solution Material. Default is `TRUE`.
136- # ' @param assign_file Generate Student Assignment Material. Default is `TRUE`.
137- # ' @param zip_files Create a zip file containing the relevant materials.
138- # ' Default is `TRUE`.
136+ # ' @param file Input `.Rmd` file with `-main.Rmd` in the filename.
137+ # ' @param output_dir Output directory. Defaults to name of prefix of filename.
138+ # ' @param soln_file Generate Solution Material. Default is `TRUE`.
139+ # ' @param assign_file Generate Student Assignment Material. Default is `TRUE`.
140+ # ' @param zip_files Create a zip file containing the relevant materials.
141+ # ' Default is `TRUE`.
142+ # ' @param render_files Create HTML and PDF output for each Rmd file.
143+ # ' Default is `TRUE`.
139144# ' @export
140145# ' @return The function will generate assignment files for students and
141146# ' solution keys for instructors.
@@ -165,7 +170,8 @@ assignr = function(file,
165170 output_dir = NULL ,
166171 assign_file = TRUE ,
167172 soln_file = TRUE ,
168- zip_files = TRUE ) {
173+ zip_files = TRUE ,
174+ render_files = TRUE ) {
169175
170176 if (length(file ) != 1 ) {
171177 stop(" Only one file may be processed at time." )
@@ -212,7 +218,9 @@ assignr = function(file,
212218 remove_indexes = c(solution_indexes , direction_chunk_indices ),
213219 name = hw_name ,
214220 type = " assign" ,
215- output_dir = output_dir
221+ output_dir = output_dir ,
222+ render_files = render_files ,
223+ zip_files = zip_files
216224 )
217225 }
218226
@@ -223,6 +231,7 @@ assignr = function(file,
223231 name = hw_name ,
224232 type = " soln" ,
225233 output_dir = output_dir ,
234+ render_files = render_files ,
226235 zip_files = zip_files
227236 )
228237 }
0 commit comments