I like this idea as a first iteration of the feature. Will it be difficult
to merge the current "reference docx" system into the full-fledged template
system?
I expect most people do not want to manually unzip and edit XML and would
rather edit a template document within Word. It should be possible to trim
the opening and closing empty paragraphs (i.e. detect when a paragraph only
contains a control statement like $for$), or actually manipulate the XML
tree.
On Sunday, November 5, 2017 at 12:40:27 PM UTC-5, John MacFarlane wrote:
>
> The simplest idea would be to run the template resolver
> on word/document.xml from the reference.docx, to produce
> the new word/document.xml from the document body and
> metadata values.
>
> This could work, I think. However, except in simple cases
> you'd have to edit word/document.xml with a text editor,
> rather than using Word, in order to get the template control
> commands in the right place. If you edit with Word, you'll
> get things like
>
>
>
> $for(author)$
>
>
>
>
> $author.name$ ($author.institute$)
>
>
>
>
> $endfor$
>
>
>
> which (for two authors) would resolve to:
>
>
>
>
>
>
>
>
>
>
> Author 1 (Institute 1)
>
>
>
>
>
>
>
>
>
>
> Author 2 (Institute 2)
>
>
>
>
>
>
>
>
>
> This is valid (though I don't know if we can guarantee that
> in all cases), but contains a number of empty paragraphs.
>
>
> +++ Ophir Lifshitz [Nov 01 17 22:17 ]:
> > It might be useful to replace the limited "reference-doc" system with
> a
> > full-fledged template system. Users could then naturally create a
> > template as a .docx file¹ that could include $for$ loops, $variable$
> > substitution, and so on as usual.
> > ___
> > ¹ or .dotx too, I suppose? My knowledge of Word templates is at least
> > 15 years old.
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/25ab9cfc-04e7-4cca-be75-b77bb4f996bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.