Complexity, in this case, stems from different sources.
- Pandoc itself, as a universal markup converter, takes several arguments and has dozens of optional flags, and not all of them apply to all formats it supports. Synthesizing all of this (or most of it) in a single template takes time and knowledge of the tools. At the time, I had neither . That is, I knew Pandoc well enough, but not Tbx; and time was scarce.
- The template uses Pandoc, with all its complexity, for two different tasks: preview and export. The command is not the same in these two cases, nor are the flags used.
- I started out trying to achieve something even more complex than I already described. I actually wanted to recreate with Tbx a workflow I had been using with Scrivener to create the final version of my Ph.D. Thesis. The reason the first version of the template had so many attributes to be passed in the YAML header is that it relied on a previously prepared LaTeX template to create a Thesis/Dissertation PDF. However, I prepared this LaTeX template in Portuguese, thinking about my colleagues, and saw no reason to translate it to English and share it along with the Tbx file, seeing that there are already many good resources for this in English (not that they would work in the same way).
I ended up settling with Scrivener, set up to export a mixture of Markdown and LaTeX. The exported file is then processed with a long Ruby script that adjusts cross-references and bibliographical citations and draws information from an Excel Spreadsheet to create a multilingual glossary. (This is not really relevant to the problem at hand, but it is where the process culminated.)
After the failed Tbx with Pandoc experience for long-text writing and with a little more knowledge of how the software works, I started using it to manage the bibliography. I think it shines in this and that is severely undervalued for this purpose. It is possible to set it up to export BibTeX for compiling with LaTeX; JSON for feeding Alfred to use it as a search tool; Markdown with metadata such as authors, editors, publishers and keywords for browsing in DEVONthink (with autolinks on); TSV for exporting metadata to any app (not this format is really needed), and so on. It is also fairly easy to keep bibliographical entries in sync with the files stored in DEVONthink and retrieving highlighted passages to Tbx and storing it as one of the entry’s attribute.
For this, of course, there is no need to work with Pandoc, so no plans to update the template for now. Also, I am sure others are already preparing better alternatives.