New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render_site with Rmd parameters #903
Comments
What if we just added support for a |
That would be great! My only concern is that the same Looking at the To me it would make more sense to say "render this output file" and then it would render it using the corresponding Rmd input file and parameters... but maybe I am missing something or overcomplicating things... Thanks for the quick reply on a Sunday... I wasn't expecting that 😮 👍 |
I get it now, you want to use a single Rmd as a template for multiple
distinct output files. That makes a tremendous amount of sense. Yes, I
think it would be good to have support for this built in so I would take a
PR. What would you think about the YAML being "output_files" rather than
"files"?
…On Sun, Dec 4, 2016 at 7:04 AM, Sergio Oller ***@***.***> wrote:
That would be great!
My only concern is that the same .Rmd file may be used as the input file
for several output html files (with different parameters) and the params
argument should be able to accept that use case.
Looking at the render
<https://github.com/rstudio/rmarkdown/blob/master/R/render_site.R#L170>
function in the default_site, when it wants to do an "incremental"
rendering, it is based on the input_file. This is fine if there is a
single output file for each input file, but it gets a bit confusing in the
case where we have a single Rmd file generating several html files.
To me it would make more sense to say "render this output file" and then
it would render it using the corresponding Rmd input file and parameters...
but maybe I am missing something or overcomplicating things...
Thanks for the quick reply on a Sunday... I wasn't expecting that 😮 👍
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#903 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGXx-RoLIWoDOdo0DqgxLKjn63w55Eoks5rEqxagaJpZM4LDj7O>
.
|
render_site understands the `output_files` field in the `_site.yml` file to describe which source file should an html file use and give Rmd parameters if needed. (closes rstudio#903) The output_files feature can be used as well to set as source for an html file a R script that will be spinned. This commit also adds a `autospin` field in `_site.yml` that, if set to `true` will render all the `R` scripts spinning them first (closes rstudio#892)
I thought it would be better to do a PR with the changes and if necessary do further discussion there. We were lucky and I also fixed #892 with almost zero extra effort. Looking forward to the next release! 😃 |
@zeehio I'm going to take this PR back up after the next CRAN release (2 or 3 weeks out). |
@jjallaire this is just a kind reminder of the issue, given your previous comment of taking the PR back up after the 1.3 release 👍 |
@zeehio Sorry for leaving this issue aside for so long. Bad news is we probably still don't have the bandwidth to review your PR. I have currently scheduled it for v1.8, the next version after 1.7 (no ETA yet; probably early next year). I'd appreciate it if you could resolve the GIT conflicts before then. |
@yihui, I fully understand the bandwidth limitations. Like you, I am a bit full until mid January, but I will do my best to find the time to resolve conflicts. I appreciate a lot your kind reply, keep up doing your great work! |
render_site understands the `output_files` field in the `_site.yml` file to describe which source file should an html file use and give Rmd parameters if needed. (closes rstudio#903) The output_files feature can be used as well to set as source for an html file a R script that will be spinned. This commit also adds a `autospin` field in `_site.yml` that, if set to `true` will render all the `R` scripts spinning them first (closes rstudio#892)
render_site understands the `output_files` field in the `_site.yml` file to describe which source file should an html file use and give Rmd parameters if needed. (closes rstudio#903) The output_files feature can be used as well to set as source for an html file a R script that will be spinned. This commit also adds a `autospin` field in `_site.yml` that, if set to `true` will render all the `R` scripts spinning them first (closes rstudio#892)
Just came across this - any chance this was ever integrated? I could certainly use this functionality in some course sites I'm building. |
As far as I know, the option of passing parameters to Rmd files through I believe my pull request had some room for improvement and I discarded it. I think there was some interest by rmarkdown maintainers to keep I have no idea and I don't need this functionality anymore, but I would check other packages (blogdown maybe?) |
I started to use the
rmarkdown::render_site
function. At some point I had anRmd
file with parameters, and I wanted to render it several times with different options.To do that, I adapted a custom site generator. I would like to know if you are interested in a pull request or at least export some functions so I don't need to use
:::
.render_site with rmarkdown parameters
I wrote a custom site generator named
site_with_params
based ondefault_site
. The main changes with respect to the default_site are:index.Rmd
needs to havesite: site_with_params
to use this site generator.files
section to_site.yml
is required, that states how html files need to be rendered. An example of_site.yml
is shown here (note the "files" section):Questions
rmarkdown:::site_config
,rmarkdown:::input_as_dir
,rmarkdown:::knitr_files_dir
,rmarkdown:::dir_exists
,rmarkdown:::copy_site_resources
andrmarkdown:::knitr_root_cache_dir
so it is easy to provide custom site generators in other packages?Actual code
The code I wrote is adapted from
default_site
and uses several non-exported rmarkdown functions.This could be submitted as a PR if there is interest:
The text was updated successfully, but these errors were encountered: