Found in packages using quillt template.
We have a custom footer (https://github.com/apreshill/quillt/blob/master/inst/pkgdown/templates/footer.html#L2)
This should also break packages using tidytemplate (https://github.com/tidyverse/tidytemplate/blob/master/inst/pkgdown/templates/footer.html#L2)
It does not appear anymore using dev version of pkgdown. From a discussion with @maelle it could come from https://github.com/r-lib/pkgdown/commit/1ca166905f1b019ed4af9642617ea09fa2b8fc17
To see what happens, we should have this, as currently in https://pkgs.rstudio.com/rmarkdown/ not recently built

but we have this in a recent build (https://pkgs.rstudio.com/bookdown/)

I confirm that changing the template file fix the issue: https://github.com/apreshill/quillt/pull/7
Should we do that ? Or is it a regression as it seems to be ?
It seems a footer variable could be set in YAML for templates (quillt and tidytemplate) to overwrite the default one. Seems no more possible this way with the change in pkgdown
cc @apreshill
From @maelle comments on slack, this seems to be a whisker behavior not expected
Copying as is the reprex:
data <- list(
yaml = list(footer = "my footer yay"),
footer = list(left = "left", right = "right")
)
whisker::whisker.render(
'{{#yaml}}{{{footer}}}{{^footer}}BLOP.{{/footer}}{{/yaml}}',
data
)
#> [1] "my footer yay"
data <- list(
yaml = list(id = "pof"),
footer = list(left = "left", right = "right")
)
whisker::whisker.render(
'{{#yaml}}{{{footer}}}{{^footer}}BLOP.{{/footer}}{{/yaml}}',
data
)
#> [1] "left,right"
Created on 2021-02-22 by the reprex package (v1.0.0.9001)
I could rename the footer list something else like footer_data.
It'd be nice to be able to use "footer of yaml not other footer" in whisker, I'll look into this.
Thanks!
From Mustache docs
"The most basic tag type is the variable. A {{name}} tag in a basic template will try to find the name key in the current context. If there is no name key, the parent contexts will be checked recursively. "
(Taking notes as I read)
So it seems the solution is using "." in the template, and one can drop the "yaml" borders.
{{{yaml.footer}}}{{^yaml.footer}}{{#package}}{{name}}{{/package}} is built for <strong>R Markdown</strong>, an ecosystem of packages for creating computational documents in R. Learn more at <a href="https://rmarkdown.rstudio.com">rmarkdown.rstudio.com</a>.{{/yaml.footer}}
Cf reprexes
whisker::whisker.render(
'{{{yaml.footer}}}{{^yaml.footer}}BLOP.{{/yaml.footer}}',
data = list(
footer = list(left = "left", right = "right")
)
)
#> [1] "BLOP."
whisker::whisker.render(
'{{{yaml.footer}}}{{^yaml.footer}}BLOP.{{/yaml.footer}}',
data = list(
yaml = list(id = "pof"),
footer = list(left = "left", right = "right")
)
)
#> [1] "BLOP."
whisker::whisker.render(
'{{{yaml.footer}}}{{^yaml.footer}}BLOP.{{/yaml.footer}}',
data = list(
yaml = list(footer = "my-footer"),
footer = list(left = "left", right = "right")
)
)
#> [1] "my-footer"
Created on 2021-02-23 by the reprex package (v1.0.0.9001)
For completeness, the syntax could use a $ rather than a dot if pkgdown called whisker::whisker.render() with strict=FALSE
whisker::whisker.render(
'{{{yaml$footer}}}{{^yaml$footer}}BLOP.{{/yaml$footer}}',
data = list(
yaml = list(footer = "my-footer"),
footer = list(left = "left", right = "right")
),
strict = FALSE
)
#> [1] "my-footer"
whisker::whisker.render(
'{{{yaml.footer}}}{{^yaml.footer}}BLOP.{{/yaml.footer}}',
data = list(
yaml = list(footer = "my-footer"),
footer = list(left = "left", right = "right")
),
strict = FALSE
)
#> [1] "BLOP."
Created on 2021-02-23 by the reprex package (v1.0.0.9001)
I can't find anything about "dot notation" (which can also be "dollar notation") in Mustache docs but I see it is implemented in both the JS and Ruby libraries.
It seems it is not documented in the Manual but directly in the specs (from comment https://github.com/mustache/mustache/issues/129#issuecomment-111313923): https://github.com/mustache/spec/blob/master/specs/interpolation.yml#L124-L180
Besides fixing the quillt/tidytemplate templates I wonder what actions need to be taken here.
whisker::whisker.render() with strict=FALSE i.e. do we want to use dots or dollars in the templates for the dot notation? https://github.com/r-lib/pkgdown/issues/1518#issuecomment-784102237