Pass on additional variables as DOCX document properties
When using the DOCX backend, several metadata variables are passed on as Document Properties which can be access in Microsoft Word from File->Info->Properties->Advanced Properties->Summary tab:
- Title
- Subject
- Author
- Category
- Keywords
- Comments (from the
descriptionvariable)
It would be useful to also implement the fields:
- Company
- Manager
...which are not currently implemented.
I realize that any variable is passed on as Custom Document Properties, but as these fields are not defined in the --reference-document, there is no way of referring to them in that document.
I guess the first step would be identifying the internal name of these properties which seems straightforward enough:
- Company:
extended-properties:Company - Manager:
extended-properties:Manager
And then apply their specific naming when encountering these properties in the AST and writing DOCX.
Meanwhile as a workaround, I'm guessing currently they would be included as Custom Properties (and you could still use them in your template as such).
I don't really understand your last point. If you are modifying your template, you can always add your own custom properties (company and manager for instance) and reference them in the text (not useful for templates) or header/footer. Note that they'd still be custom properties, not shown in the first tab of document properties.
Ah, but you don't get to use templates with DOCX, @agusmba.
While I'm at it, it would be nice to also have the date metadata variable map to the Word Document Property "Publish Date"
To clarify the last sentence of my OP, you can't insert any properties in you reference document which it doesn't know about in advance. So even though all the other metadata variables are passed on to the generated document, the refence document doesn't know about them to insert them in the first place (i.e., Insert->Quick Part->Field...).
NOTE: Whenever I say "template" for docx output, I mean "reference document" which acts as a sort-of-template.
For the sake of clarification (I'm still not quite sure what use case you are defining), and again focusing on the "workaround" aspect of this thread, since I think the request of using the "standard" metadata for "Company" and "Manager" is a valid one:
Pandoc (AFAIK) won't insert any custom metadata variable in the main text of a docx document. It will only pass-through those used in the header/footer of the reference document, and add the metadata variables you define in your source document (I assume markdown).
You seem to complain about not being able to (manually?) insert new metadata variables in your reference document.
First of all, note that this only makes sense if you are tweaking your header/footer (any particular text in the main body of the reference document is ignored).
In order to add said custom variables to your header/footer, you have to use a custom reference document. You can either create the reference document from scratch (Word will let you create new custom properties with the names you need), or you can generate a sample document with pandoc that includes your custom properties, tweak that document's header and footer adding there your desired custom properties, and use that document as your new reference document.
If this is not what you were asking about, could you please further clarify your use case?
Cheers!
For what it's worth, I can't get any properties passed through to .docx — neither title nor author — whether these are defined as Markdown YAML or in the command line.