Inline R code seems to work well in some fields of yaml block, but not others. For example, this works as expected with an R generated date inserted into the date field:
---
title: "docx template"
author: "Dave Braze"
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
word_document:
toc: true
toc_depth: 2
highlight: "tango"
pandoc_args:
- --reference-docx
- resources/FDB-styles.docx
- --output
- docx-template-20170609.docx
---
But this does not, choking on the inline R in the pandoc_args section.
---
title: "docx template"
author: "Dave Braze"
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
word_document:
toc: true
toc_depth: 2
highlight: "tango"
pandoc_args:
- --reference-docx
- resources/FDB-styles.docx
- --output
- '`r paste0("docx-template-", format(Sys.time(), "%Y%m%d"), ".docx")`'
---
Here's the error I get:
"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS docx-template.utf8.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output docx-template.docx --table-of-contents --toc-depth 2 --highlight-style tango --reference-docx resources/FDB-styles.docx --output "r paste0(\"docx-template-\", format(Sys.time(), \"%Y%m%d\"), \".docx\")
"
pandoc.exe: r paste0("docx-template-", format(Sys.time(), "%Y%m%d"), ".docx")
: openBinaryFile: invalid argument (Invalid argument)
Warning: running command '"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS docx-template.utf8.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output docx-template.docx --table-of-contents --toc-depth 2 --highlight-style tango --reference-docx resources/FDB-styles.docx --output "r paste0(\"docx-template-\", format(Sys.time(), \"%Y%m%d\"), \".docx\")
"' had status 1
Error: pandoc document conversion failed with error 1
It seems clear that the second bit of inline R is not being interpreted, but I don't know where to go from here. Any thoughts?