From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/15854 Path: news.gmane.org!.POSTED!not-for-mail From: BP Jonsson Newsgroups: gmane.text.pandoc Subject: =?UTF-8?Q?Re=3A_Discussion_needed=E2=80=94How_should_pandoc_handle_whe?= =?UTF-8?Q?n_meatada_in_YAML_collide_with_command_line_option?= Date: Sat, 29 Oct 2016 19:24:21 +0200 Message-ID: References: <836ca2d4-6e39-4f7e-b227-69dc06be6f15@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1141a2ee0f6d5d0540043f46 X-Trace: blaine.gmane.org 1477761882 10536 195.159.176.226 (29 Oct 2016 17:24:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 29 Oct 2016 17:24:42 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDIY76M674FRBSVW2PAAKGQEUARXYPQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Oct 29 19:24:38 2016 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-vk0-f59.google.com ([209.85.213.59]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0XMo-0000mZ-CT for gtp-pandoc-discuss@m.gmane.org; Sat, 29 Oct 2016 19:24:26 +0200 Original-Received: by mail-vk0-f59.google.com with SMTP id y123sf20867650vka.0 for ; Sat, 29 Oct 2016 10:24:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; 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:x-spam-checked-in-group :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=vAOkskYqm6vkukNDW+lD0rK+O8kdIjfaYCLirYTivvQ=; b=uIjksTR9vyJ8c3j9sreUCAQLp7x2WnRv8VYfYmY3sEfVTnp0crTO5m/Hf2XgNQJMkn W2EVagV1bfMredDeDLQw5cCZaZyeXMaQaEEFJBLXz5Shh8Oes3bTxZ2R87ayrfvrB4Ev XZ3TmPWwX5bc8eqGMGAnDY4PTY+tUQyaKOUTz13t+u2oYEn/SD13BTIep7YRPA1aBrPv fqacF2hJHnjOrVBzw9b0TPZLjK/SgDU0SaxNxYLF7PmNupJCuK0jSaW8Mgjf+/u2Soqm GOXyM1Szz7hV0EYeihh+Be2XpbvOFp1YYInrCj0A7etrALRPlvVuKviDAKgo2i0ASUgI OGGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; 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:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=vAOkskYqm6vkukNDW+lD0rK+O8kdIjfaYCLirYTivvQ=; b=CYS3rH2j7+VML8flnXS6QD2j+DkBOU12eob29vEjCDebgUHFtlka5NPZypnZpsBN7D EurbfTV/9DOEi7gLXZch96+wdIJ1AGlFv+kVfrPLP2SVpSkwuBT3fdRnMqfFPyyfOR/4 swmlM1hJzg7K4TXsqqy6N8kDR4lUu285LaxffjfZcZp+ahVl331x0hu5kvghnkoccN5Q LYYBwqNPJv7xTifSBepsA2YMRC/gop6Ovbt/X6CLweQSpckfK6pZ0YX+GSZXLsefwRw8 lNx/YRm8EO37LkGCCPpsX65uGln4T6Pw8Cc0UbmxJqWEooJt7xzCvdii6TqLCYyIq7W3 ccqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; 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=vAOkskYqm6vkukNDW+lD0rK+O8kdIjfaYCLirYTivvQ=; b=LHrLJMT2B93AfJpRh8o0Gh1qz0g1R4bdwqr4km/aLDlo5TefMnPJlmCpE4yUUot4d6 hLOTfifQY4VCfDgE193pM9CwRIuoUY1/oFZByesUcpos4adr/yjWkWSWUbzVt6DF/S/T Ry6f9LbRh2Tz6vKzmae8wjBtDLTt+7iSSglgXXI07aGMRGVe7jh2N/dZ/GJKAV4qrzkW P87Gm3XI81vVTuLwvbe/aKZaVzHUJw7bnXP1T6iOqyKoJRDXGkUQkTz+7ETNONT4zUxK V2pPK9siU4g8Dpu7Qay63UHA9C7pvXKoeCcfWPJVCtlm+17JlEJ+5C/03bdDavV2xzHj Whpw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ABUngvcPRDqdyghb3rN4n1T0Kv3BX+cTGjWkimsDx3flNuktechEMdHgwYLOHRKsErFaNA== X-Received: by 10.36.196.194 with SMTP id v185mr159443itf.4.1477761868900; Sat, 29 Oct 2016 10:24:28 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.107.134.168 with SMTP id q40ls2059764ioi.23.gmail; Sat, 29 Oct 2016 10:24:25 -0700 (PDT) X-Received: by 10.107.7.33 with SMTP id 33mr7473730ioh.35.1477761865929; Sat, 29 Oct 2016 10:24:25 -0700 (PDT) Original-Received: from mail-it0-x243.google.com (mail-it0-x243.google.com. [2607:f8b0:4001:c0b::243]) by gmr-mx.google.com with ESMTPS id c34si928862itd.1.2016.10.29.10.24.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 10:24:25 -0700 (PDT) Received-SPF: pass (google.com: domain of bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4001:c0b::243 as permitted sender) client-ip=2607:f8b0:4001:c0b::243; Original-Received: by mail-it0-x243.google.com with SMTP id q124so1895105itd.1 for ; Sat, 29 Oct 2016 10:24:25 -0700 (PDT) X-Received: by 10.107.155.14 with SMTP id d14mr16211718ioe.64.1477761865572; Sat, 29 Oct 2016 10:24:25 -0700 (PDT) Original-Received: by 10.107.146.85 with HTTP; Sat, 29 Oct 2016 10:24:21 -0700 (PDT) Original-Received: by 10.107.146.85 with HTTP; Sat, 29 Oct 2016 10:24:21 -0700 (PDT) In-Reply-To: <836ca2d4-6e39-4f7e-b227-69dc06be6f15-/JYPxA39Uh5TLH3MbocFFw@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; spf=pass (google.com: domain of bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4001:c0b::243 as permitted sender) smtp.mailfrom=bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=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:15854 Archived-At: --001a1141a2ee0f6d5d0540043f46 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable My solution is very simple: I define a separate variable in my templates and use that in metadata, with different keys for different output formats as well as for the beginning/end of header/body, along with a filter which converts codeblocks in said metadata fields into raw blocks of the right format, which is important to prevent breakage. No conflict with `--include-in-header` and its automatically raw semantics arises because they use different template variables. /bpj Den 29 okt 2016 05:18 skrev "Kolen Cheung" : > This originally started from issue #3138 > . It > concerns how pandoc should handle the case when YAML metadata collides wi= th > the command line options. > <#m_6038354951767356229_>An Example > > The example here concerns --include-in-header=3D in command line and > header-include in YAML, but the issue itself is more general, e.g. > --include-after-body=3D, etc. > > From the manual (emphasis is mine): > > -H *FILE*, --include-in-header=3D*FILE* > > : Include contents of *FILE*, verbatim, at the end of the header. This > can be used, for example, to include special CSS or javascript in HTML > documents. This option *can be used repeatedly* to include multiple files > in the header. They will be included in the order specified. Implies > --standalone. > > <#m_6038354951767356229_>Current behavior > > Whenever command line option is specified, it will override the YAML > metadata defined. Example used in the issue is: > > Command line: pandoc ... -H ..., and in the md file=E2=80=99s yaml= : > > header-includes: > - \usepackage{siunitx} > > \usepackage{siunitx} will be ignored. > <#m_6038354951767356229_>=E2=80=9CExpected=E2=80=9D Behavior > > Since the manual said, =E2=80=9CThis option can be used repeatedly=E2=80= =9D, it seems > natural to assume the same metadata can be defined through both the YAML > and command line. > > However, it can be imagined people might use command line option to > override the YAML option. I agree the command line option should have > priority: on option that cannot be repeated, command line option should > override. But when an option is repeatable, priority could means command > line metadata comes first and YAML comes second, not necessarily means > ignoring the later. > <#m_6038354951767356229_>Related Discussion: Should Templates Be > Recursively Resolved Into? > > This is the original purpose of issue #3138 > : > should templates be recursively resolved into? An example is, if I wrote = a > template snippet, currently -H/--include-in-header=3D*SNIPPET* would not > resolve it as a template but include it as is. (There=E2=80=99s a work ar= ound > mentioned in Pandoc Tricks =C2=B7 jgm/pandoc Wiki > .) > =E2=80=8B > > -- > 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/836ca2d4-6e39-4f7e-b227-69dc06be6f15% > 40googlegroups.com > > . > 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_yuQZfyYuP6LzVtv02pVkr92Vx6zATosAdXbm%2BBCbxeTMMw%40mail= .gmail.com. For more options, visit https://groups.google.com/d/optout. --001a1141a2ee0f6d5d0540043f46 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

My solution is very simple: I define a separate variable in = my templates and use that in metadata, with different keys for different ou= tput formats as well as for the beginning/end of header/body, along with a = filter which converts codeblocks in said metadata fields into raw blocks of= the right format, which is important to prevent breakage. No conflict with= `--include-in-header` and its automatically raw semantics arises because t= hey use different template variables.

/bpj


Den 29 okt 2016 0= 5:18 skrev "Kolen Cheung" <christian.kolen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:

This originally started from issue #3138. It concerns how pandoc should handle the case when YAM= L metadata collides with the command line options.

An Example

The example here concerns --include-in-header=3D in command line and he= ader-include in YAML, but the issue itself is more general, e.g. --include-after-body=3D, etc.

From the manual (emphasis is mi= ne):

-H FIL= E, --include-in-header=3DFILE

: Include contents of FIL= E, verbatim, at the end of the header. This can be used, for example, to include special CSS or javascript in HTML documents. This option can be used repeatedly to include multiple files in the header. They will= be included in the order specified. Implies --standalone.

Current behavior

Whenever command line option is= specified, it will override the YAML metadata defined. Example used in the= issue is:

Command line: pa= ndoc ... -H <file> ..., and in the md file=E2=80=99s yaml:

header-includ=
es:
    - \usepackage{siunitx}

\usepackage{siuni= tx} will be ignored.

=E2=80=9CExpected=E2=80=9D Behavior

Since the manual said, =E2=80= =9CThis option can be used repeatedly=E2=80=9D, it seems natural to assume = the same metadata can be defined through both the YAML and command line.

However, it can be imagined peo= ple might use command line option to override the YAML option. I agree the = command line option should have priority: on option that cannot be repeated= , command line option should override. But when an option is repeatable, pr= iority could means command line metadata comes first and YAML comes second,= not necessarily means ignoring the later.

= Related Discussion: Should Templates Be Recursively Resolved Into?

This is the original purpose of= issue #3138: should templates be recursively resol= ved into? An example is, if I wrote a template snippet, currently -H/--include-in-header=3DSNIPPET would not resolve it a= s a template but include it as is. (There=E2=80=99s a work around mentioned= in Pandoc Tricks =C2=B7 jgm/pandoc Wiki.)

=E2=80=8B

--
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@googlegroups.com. To view this discussion on the web visit https:= //groups.google.com/d/msgid/pandoc-discuss/836ca2d4-6e39-4f7e-b22= 7-69dc06be6f15%40googlegroups.com.
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://group= s.google.com/d/msgid/pandoc-discuss/CAFC_yuQZfyYuP6LzVtv02pVkr92Vx6zATosAdX= bm%2BBCbxeTMMw%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--001a1141a2ee0f6d5d0540043f46--