Lua filters for title/subtitle appearance? #11769
|
Apologies if this has been answered somewhere, but I've been searching around for a few days and haven't managed to find anything. I'm wondering if it is possible to set up a Lua filter to affect the appearance of the title and subtitle of a document when going from markdown to docx (not the metadata itself). I'm essentially hoping to prevent them from appearing in the resulting docx file altogether, as the printed final document will have a separate title/cover page added, so just adjusting the docx template settings wouldn't work. |
Replies: 2 comments 9 replies
|
Filters are for changing the content of the document tree (AST) not for appearances. The template controls appearance. That being said you're specifically asking about having them "not appear" at all. Just use a Lua filter and remove the title and subtitle completely. Then they will not appear. There isn't really a sane way to make something like that be in the document contents but invisible anyway. |
|
OpenXML format is pretty complicated, but it's pretty easy to edit the default template just to remove the title and subtitle. Right at the top of the template is this block: Delete that (and any other blocks you don't need, but make sure to keep the XML at the top and bottom, as well as |
Kind of. You can access any metadata variable in the template. Note, though, that Pandoc's template language is pretty basic compared to something like Jinja or Handlebars. There is no equivalent to
andornot,$if(variable)$only checks for the existence and "truth" of the variable, so something like what you suggest will need to be built up from more primitive parts. One way to fakeif notis to check for the variable, but then immediately have anelseclause, so the contents are only output if the variable is absent or false. Something like this: