From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/18559 Path: news.gmane.org!.POSTED!not-for-mail From: BP Jonsson Newsgroups: gmane.text.pandoc Subject: Re: Using YAML variables in docx Date: Tue, 7 Nov 2017 22:54:00 +0100 Message-ID: References: <46936ce3-7335-4071-ab66-88bd60ecdf84@googlegroups.com> <20171101035147.GB19638@Johns-MacBook-Pro.local> <20171101165418.GA9384@protagoras> <5f9a9b31-62b5-47b5-9db7-0a8ab5cae4e3@googlegroups.com> <20171105174028.GC73700@Johns-MacBook-Pro.local> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1134eba0d9aae6055d6b9b50" X-Trace: blaine.gmane.org 1510091644 13692 195.159.176.226 (7 Nov 2017 21:54:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Nov 2017 21:54:04 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDIY76M674FRB6WWRDIAKGQEG7VCAKI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Nov 07 22:53:58 2017 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-io0-f184.google.com ([209.85.223.184]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCBoh-0003D2-Pg for gtp-pandoc-discuss@m.gmane.org; Tue, 07 Nov 2017 22:53:56 +0100 Original-Received: by mail-io0-f184.google.com with SMTP id m81sf3628201ioi.15 for ; Tue, 07 Nov 2017 13:54:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1510091643; cv=pass; d=google.com; s=arc-20160816; b=gExfvUD4QKcAe6lR4dpiR1JVWoYhH/KRB3lMOBEWBUSBU4jkJ1oICEEXm35tDVmU0C S/1TEYuFLaxNMhspFmC6BzRIDDRflZLox0s/nw5rj9jpJ6amliDTwEV43APIvK3g+rmk ePnUh7PxlhiwPaSBInKDCKPf27M0jnbcsrBkYhqhkKct71ySfo3wpsiXPpy4JQI/uAds YzRnC3Qc1ZULbD3Zg6FX92DjOLlh8gW6fcl1hotlzlYbZcNhaUbX9JiKXKNnL4hI/+yw qkdNs6RNeaZSN1KDXd3nyG/GJKuZYTpUypt36RvUPn6KpTUosBifyZpjzlrdTMF7EaIR OXwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date :from:references:in-reply-to:mime-version:arc-authentication-results :arc-message-signature:sender:dkim-signature:dkim-signature :arc-authentication-results; bh=+atsFJYDEnE8F5Us59iFkQ3/f89JJmGCSjGsy/Wyinc=; b=sOxiBTgzY7GGLcPYKfV6k7nNJ+kVc+eqEo2ZinSi8VF3zOtSKlz70xSX7Dm03LleI9 vPWeJL+Zigj1IlmwsUgcfYd6RvEaeU1y/e5tpk6jKZpJyxIZ28ZTTDOcWwhxi2qPVEzV +H16poxmbxRvHFtF6/OCCwAH6pPrqlL5IX3OXGrGYPeZCgT82uR3fKnQm7Kd1TLE9JZ6 QNOUEiD4dzB/JE/xbofItN7EICh0A6EXlzeR5bcuvbhHrsiX2mDoN8ByTksfpuIKUg8K 9vj9wYYXouyrHRFhbti1X10gv+R0uNvGL+mOaOl2yZArP1O7Oc+u+unTk27RfFrWcH7G oJkQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BHhqUVYG; spf=pass (google.com: domain of bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4003:c0f::232 as permitted sender) smtp.mailfrom=bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:in-reply-to:references:from:date:message-id :subject:to:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=+atsFJYDEnE8F5Us59iFkQ3/f89JJmGCSjGsy/Wyinc=; b=d5oB9SJRPDAfowPySlzwrg/2PepTwUN3jnVZRf2iBQLo/LOxXwB20y9GebjrIil/1o TqBNsd9L1kZlgcky3hRUdx5iDTFKiKKJBovs4snpODoEKuw3C2tvFp4gcylqClom5zuM ceLOJnPlK5ETORiduGeUy4jYSy3CBVdqLNkR4IaOtgBD3uNwhjqJfuIr7LgEiFdxDQAN UE3TvUG7cSqVYxFS6/gxCgHYnmBM26bvHYavqqUI+dzDjtN8Beq8Y+DaNy+0AoEPRhkA H6LHB3WSgBEhz9zs+sIiojA1C6flSe5Zz0VkpBPcC6DBVqMVa4Gksj9bdkLBYsSn8fAb k6ng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=+atsFJYDEnE8F5Us59iFkQ3/f89JJmGCSjGsy/Wyinc=; b=bzHPZqRsJDOLOpXEMp9qD/A6Td1D9OqdgBaE7eB2N70omnA2UgR8pV5MUYPS3LmXkq AKkApThDXtRdXol2N72gsXMV55b9mKPgpwcDBYFbN/dvhyuqjR8AqTFdVD/Oh0d7JW50 REspafZzaVGac2/lcczLt7lHmBJAsVVsy0khghXa6U/VRYzDgHSKa3kHtBmwsmnhcv5u 4i57GWmR+am4FW0F+NYYMf3beFQDWcsM+pB+4euTtiwuDZVHAYYEjrjKcI4HyUTYVbvt ikKKX5ZgQpaBxc7tW/7+fI/S8axPW6NQpeU3RjPrYIWq3Ps95fl10CsQ4OacFDGfkb8G OjqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:in-reply-to:references:from :date:message-id:subject:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=+atsFJYDEnE8F5Us59iFkQ3/f89JJmGCSjGsy/Wyinc=; b=Jl04itutqivRcgA3Z+Y8XmBsIX1FgapGUPYeAq7p+xiCt1pOc0VZ00ZECwU+QLf/Qz 2AgHlqAcjW1tZB+KbakMu1MlIgiD7Oe69omy7q94n2/+cB6sk/VuFSjjtffLnDcDiKUo 78xeeavgoiEtDXjbc9JhJj/+ydwnIZTux2Yb9yAA80wCbUTENKN/0WMmhdmvtbKYF/Wk GnkEg1ZUQfalko0/ttNEheMPdnjLudB+OcFEMBoZnnBGmL4i5H/JAagpOoSWvJfSKhyI vI2Utbmcr+0cE5UGkr8nufUGil17eKmoAGeF2ujbQdaOeq50G2ACGkl+7NiWv+76C31U KUGw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJaThX7nqx5azZUycyEKWKlh4ENXcaRY8VSlp0sSQ0ZYKrZ8ZQKDDKf+ 1eGFNLZRkEoTDagazaT3rZM= X-Google-Smtp-Source: ABhQp+Tb/ffbQbyFKgwbVhA+Ks2Y0IDkuuGyAzTzscWQ6LTzgbj48bxl87D2X/EnrgXqy+TLO1C9pA== X-Received: by 10.36.7.65 with SMTP id f62mr12021itf.1.1510091643061; Tue, 07 Nov 2017 13:54:03 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.99.49.84 with SMTP id x81ls4295363pgx.23.gmail; Tue, 07 Nov 2017 13:54:01 -0800 (PST) X-Received: by 10.98.153.5 with SMTP id d5mr98096pfe.32.1510091641847; Tue, 07 Nov 2017 13:54:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510091641; cv=none; d=google.com; s=arc-20160816; b=Xb13bo5aZoZZ+ZrptbMf/2ciFoiGBXlwHhFUgvOQtMZB79ZMGoWtTfXD8yiy9Ab9If 59M3hv0JOEu7IWk8aVxJMbFzrAPQxp7THtJgmAeJf8XE3HCXLC9Lrf+RLqrPK4qDcupv a+Cw2GCSw++AhbTdY+07oEaFon8pkoarm37y9GIGOmEgQ2E3d6219T9s1Uch3q0eT62O TuoFSgFjj5p/tWFu7tcWqCQ8eNpxrwMm12RqNRlWzUBBWhdu8BHGiAzpBN6QALR1AmDc S0LV9tCFClK5eLCtH9JC/c1v89ajTtzjO0NOUNUXRfYx4TvIf0UZwMl4feVmrwG71bmH 77Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=X8MFiF3rtkNxIQF55pEsAP1gtpN5REsMofYIfW1ZpTI=; b=1Cn/xs2GG29RdfsvO56cQR589ztRzL3W0Sw3gyHsggl7/FLwJ/pj7sm7lkcKaakOJr S4HfgW/p4itr+tAfTNunXrQGEkLhZuodOZ4c7wbCr2FEqyAdMQlNHPkIoLwwvhL+DCd0 PGQZn+WHF5mHso803p0XXCMrUDcGiTv7zDaxGQD3fjWi3HuGJFIhKEnnIL7XtcBVnY/b mwF+cCdDdTP4V1ap1tDNsrupGOFO9VNMdxMhNa5y0jBsP966i8m4xXpbtad+b+ylMrKm JUbHvt6I550v5qahbgkwfbCxKbOAGx3UO9eKrdclHg1KOXIt2Gk+ZgkCwqWXcN6pFerh sH1Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BHhqUVYG; spf=pass (google.com: domain of bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4003:c0f::232 as permitted sender) smtp.mailfrom=bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Original-Received: from mail-ot0-x232.google.com (mail-ot0-x232.google.com. [2607:f8b0:4003:c0f::232]) by gmr-mx.google.com with ESMTPS id f20si229832plj.0.2017.11.07.13.54.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Nov 2017 13:54:01 -0800 (PST) Received-SPF: pass (google.com: domain of bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4003:c0f::232 as permitted sender) client-ip=2607:f8b0:4003:c0f::232; Original-Received: by mail-ot0-x232.google.com with SMTP id n19so274422ote.10 for ; Tue, 07 Nov 2017 13:54:01 -0800 (PST) X-Received: by 10.157.17.80 with SMTP id p16mr102392otp.371.1510091641168; Tue, 07 Nov 2017 13:54:01 -0800 (PST) Original-Received: by 10.157.16.49 with HTTP; Tue, 7 Nov 2017 13:54:00 -0800 (PST) Original-Received: by 10.157.16.49 with HTTP; Tue, 7 Nov 2017 13:54:00 -0800 (PST) In-Reply-To: <20171105174028.GC73700-9Rnp8PDaXcadBw3G0RLmbRFnWt+6NQIA@public.gmane.org> X-Original-Sender: bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BHhqUVYG; spf=pass (google.com: domain of bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4003:c0f::232 as permitted sender) smtp.mailfrom=bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:18559 Archived-At: --001a1134eba0d9aae6055d6b9b50 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I haven't used Word in over a decade, so I don't know what builtin scripting capabilities it has nowadays, but my thought is that you might have a filter insert certain metadata values as custom styled paragraphs at the end of the document body and then use python-docx to pull out the (contents of) those paragraphs and insert them into the header/footer (of each section seemingly to judge by < http://python-docx.readthedocs.io/en/latest/dev/analysis/features/header.ht= ml >). Just my two worthless coins. Den 5 nov 2017 18:40 skrev "John MacFarlane" : > 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=C2=B9 that could include $for$ loops, $variab= le$ >> substitution, and so on as usual. >> ___ >> =C2=B9 or .dotx too, I suppose? My knowledge of Word templates is at l= east >> 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/ms > gid/pandoc-discuss/20171105174028.GC73700%40Johns-MacBook-Pro.local. > For more options, visit https://groups.google.com/d/optout. > --=20 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 e= mail 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/CAFC_yuTZRE6grnVvWkCbbjDGAQ3NPWY0Ee52SrQ2-P7aUNpNrg%40mail.g= mail.com. For more options, visit https://groups.google.com/d/optout. --001a1134eba0d9aae6055d6b9b50 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I haven't used Word in over a decad= e, so I don't know what builtin scripting capabilities it has nowadays,= but my thought is that you might have a filter insert certain metadata val= ues as custom styled paragraphs at the end of the document body and then us= e python-docx to pull out the (contents of) those paragraphs and insert the= m into the header/footer (of each section seemingly to judge by <http://python-docx.readthedocs.io/en/latest/dev/analysis/features/h= eader.html>).

Jus= t my two worthless coins.

Den 5 nov 2017 18:40 skrev "John MacFarlane" = <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>:
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.=C2=A0 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.=C2=A0 If you edit with Word, you'll
get things like

<w:p>
=C2=A0<w:r>
=C2=A0 =C2=A0<w:t>$for(author)$</w:t>
=C2=A0</w:r>
</w:p>
<w:p>
=C2=A0<w:r>
=C2=A0 =C2=A0<w:t>$author.name$ ($author.institute$)</w:t>
=C2=A0</w:r>
</w:p>
<w:p>
=C2=A0<w:r>
=C2=A0 =C2=A0<w:t>$endfor$</w:t>
=C2=A0</w:r>
</w:p>

which (for two authors) would resolve to:

<w:p>
=C2=A0<w:r>
=C2=A0 =C2=A0<w:t>

</w:t>
=C2=A0</w:r>
</w:p>
<w:p>
=C2=A0<w:r>
=C2=A0 =C2=A0<w:t>Author 1 (Institute 1)</w:t>
=C2=A0</w:r>
</w:p>
<w:p>
=C2=A0<w:r>
=C2=A0 =C2=A0<w:t>
</w:t>
=C2=A0</w:r>
</w:p>
<w:p>
=C2=A0<w:r>
=C2=A0 =C2=A0<w:t>Author 2 (Institute 2)</w:t>
=C2=A0</w:r>
</w:p>
<w:p>
=C2=A0<w:r>
=C2=A0 =C2=A0<w:t>
</w:t>
=C2=A0</w:r>
</w:p>

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 ]:
=C2=A0 It might be useful to replace the limited "reference-doc" = system with a
=C2=A0 full-fledged template system. Users could then naturally create a =C2=A0 template as a .docx file=C2=B9 that could include $for$ loops, $vari= able$
=C2=A0 substitution, and so on as usual.
=C2=A0 ___
=C2=A0 =C2=B9 or .dotx too, I suppose? My knowledge of Word templates is at= least
=C2=A0 15 years old.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm. To view this discussion on the web visit https://groups.google.com/d/msgi= d/pandoc-discuss/20171105174028.GC73700%40Johns-MacBook-Pro.local= .
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to
pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.= google.com/d/msgid/pandoc-discuss/CAFC_yuTZRE6grnVvWkCbbjDGAQ3NPWY0Ee52SrQ2= -P7aUNpNrg%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--001a1134eba0d9aae6055d6b9b50--