From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/23514 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: FEEDBACK WANTED: Re: YAML metadata files' override order in a single command line Date: Wed, 02 Oct 2019 17:04:45 -0700 Message-ID: References: <2921e399-c659-4cba-9357-577c2b05aece@googlegroups.com> <4998a075-0f70-4b30-7406-135d2e160b97@gmail.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="161852"; mail-complaints-to="usenet@blaine.gmane.org" To: BPJ , pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBK7W2TWAKGQEMRQEDPQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Oct 03 02:05:02 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-pf1-f191.google.com ([209.85.210.191]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1iFoc9-000fwH-O0 for gtp-pandoc-discuss@m.gmane.org; Thu, 03 Oct 2019 02:05:02 +0200 Original-Received: by mail-pf1-f191.google.com with SMTP id p2sf760458pff.4 for ; Wed, 02 Oct 2019 17:05:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1570061100; cv=pass; d=google.com; s=arc-20160816; b=ZpT9SCDYk9el0hC5d/fcdh0xEL8Db17oJdHvLKj1+H/AamhtvaGc22aYwkmSm9OxR5 7I2aHBdwlBOAr53Nvm154GZV4QrIVjGA0VPuIFlPMMOlC3A+TcvR2OaZfRsH5RwoSaIO cnqKGVydTgsRYWny4Q0Dj08SnHy8iQpXqxBrxhEKGrOZQym70chv2e1Gff6ombPuSSi2 Z5kaKyFBK5niQhi1HMpoxvvsqNWRX1OG9nohb05NCcXR/8f88G5L89YDvqG9IdgIiVqL u9Ktq6E5dhKwI7g5s3y9NCl6RUDuoGEWnuDQf1HVP/pw+15/f39SBtUHqHXmKoujqykb pm4Q== 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:mime-version:message-id :date:references:in-reply-to:subject:to:from:sender:dkim-signature; bh=5QkI0LiOvs52Q5y9k752Seuc7iMFquxjWnO6jIyEW7M=; b=ER+88AVLGYyTAjxEEy91R/D8CTdSE1l/AffI0U8MQPJ22bkONZJjuXtGGPriuW2na1 nCa9vxWQ1dkqS8vh8xRMkUEWVep5siPGAoJX0m/2m3dqMziuUiLpZng4V9kKYiJyfBRD mySh91iujOCl4gg7GOZDxRYYu66FCnLFIRCUwPJuIII5cMU8kKN3JrF+FF3v4p/oNLYm Yo6UhHhbi3EDymjFBIIYs6Z+cQEwmp/ET7/qmA4YvjvI2fLvhQaamKuJB9cOc3bGbAlN UDcVzwmamkXNwfu/UE8ukEIKuHMP0pQqTxBWBU0q0woINVWjfbHRayUoa7gkYp41wb12 tiaw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=uMfIwtsP; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52f as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:subject:in-reply-to:references:date:message-id :mime-version: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=5QkI0LiOvs52Q5y9k752Seuc7iMFquxjWnO6jIyEW7M=; b=JbmU3rxTxfaCHPfRyfMK3+bOybheM9tHWcwGQDFiD9vO0dTHTuGrcuLGyXLjpZcwZy FYQPpdSjT0yw1qUrEgwQ4NCT2Kl6F2gJeQL2XIWh8AM6YoZdm20N+h5M3O00j3sMSgWC 6wouX4gsS+QTzdxi+N4q3vaCdz+dCO1bhatO2cdXu23Ovp+PaMDbK+aCtV7nWDUgYsCc of0evIpRWSisnhbNovG4wQdA7wwL7nTNvZkMhzw+1g6RIrVJ5wyCXrUBj18+ctkuy0Pl /iTTfWVtGdpwiJS9PM0sN3ZF0HQYCTeicL0kxqPHvQBwzsdSdTYW089zXALbBIVNMMrg fQFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:subject:in-reply-to:references :date:message-id:mime-version: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=5QkI0LiOvs52Q5y9k752Seuc7iMFquxjWnO6jIyEW7M=; b=avWdXhYkvTd7hABxiRX489+RuDdjW4Ld4NzERaoOCf59q/pITzGqzkSMVt5J1HwwZ7 6lxwr1OQXc/1o+0fx6S8eqGXiYOw1OJbPRcqMhPrFLF9lQ+A6nhEGeRAIACCQ1jbKt4f S5RkIyNnR2VJZd57EsBODpHclb5MuHCC9s231X0mw8wwPZbR8Xn1iiKXX364l29InxSu C30pK6cMMZxci3sUpbU9iR8F536Wv3licQeNH1RmKioVYP/M9GJrBewrGxIQITF9oJxT 8HYFajTE0pO9durJf/DFKjFSE7AR8nRgwE7pt8qKNWBxI8jBIPAKabZgaeCWPBPF7dnG iVvw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAVQJrb4Lfl3nGBKcpg4PKqLCBLN01bfi3KmdMGAgC8dXdCAPgbU I7CKTvTpnH7+5Er7YZAuyNA= X-Google-Smtp-Source: APXvYqw3eu53MoHzY9dax4lskfSpA3Ph6SJggDeuvWc16j9IW7MnboEfgSpSzMagpg4oj+infRX0nw== X-Received: by 2002:a17:90a:210b:: with SMTP id a11mr7170467pje.23.1570061100216; Wed, 02 Oct 2019 17:05:00 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a63:2204:: with SMTP id i4ls911854pgi.12.gmail; Wed, 02 Oct 2019 17:04:59 -0700 (PDT) X-Received: by 2002:a65:5648:: with SMTP id m8mr6667211pgs.37.1570061098954; Wed, 02 Oct 2019 17:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570061098; cv=none; d=google.com; s=arc-20160816; b=CSm5wE1pF8vSYorTZw80z4IUvYa/rPe7wWSHb8+udfB3h0ieM/u/JSdw1hTif3zPTl BxXtT0h3UWk6WRBx7T3Q75GzpuJwN7oOgtJQcfl2+7NUXIpJY/K9hSn8tGlA6DdLqYz7 HYjSeU537JFkP5HrRlsw4CXso7MJjv+z3iD/42drDJ7mpki5g0snetZcAzazw+3sipwJ wVQjMqh3uipGmTuW/kUmjdQmqvyMruRB6gQ3RiKeTlEXg8dsoyUeh61f9Kug14dIM1WA vqJkUfMADlaKLKV/itUyBiJFSNP5gRGzXNHmBZny6jAk9hh5qMCTgR1Y9jYE6lLhpR80 GoTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :dkim-signature; bh=4jkjW8Wa9GtooTuBw03FdLJtnNHNt17iI09pLfnrW90=; b=wKIaRqD3eD1FOle6HFRYf/kKgGGZXe5VjOnynBe0zLtaOt5RDnjhZT42lgpg+r/3Ye 88Co20PRSM5r+Jm+NF/t7HC1DPAQ+/sBOMyq4/thZkJ6Uvnq/xxdiAiyEcyi7VXIwoiz 1y7CS3TExZViPcKejZZuHjYukIPiir6aZNxfNDzR6ZTnivCGEyqs58uFvxtJs4UpX4vH Oci2a3noLa3B7G4kAERF/qUG3TaazC+byh1u9FUdHWjjT8IwxmcrhDujLohFuFUAuEyc 2ynk85JzGldLmghgVOPloJ9zcN5nTJPLdUUZ7Dx+71DGp0nmh8Dw8UHXskp9DKtMXTli 8y8A== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=uMfIwtsP; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52f as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com. [2607:f8b0:4864:20::52f]) by gmr-mx.google.com with ESMTPS id i1si57539pfr.2.2019.10.02.17.04.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Oct 2019 17:04:58 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52f as permitted sender) client-ip=2607:f8b0:4864:20::52f; Original-Received: by mail-pg1-x52f.google.com with SMTP id a24so618166pgj.2 for ; Wed, 02 Oct 2019 17:04:58 -0700 (PDT) X-Received: by 2002:a63:2254:: with SMTP id t20mr6588287pgm.173.1570061097630; Wed, 02 Oct 2019 17:04:57 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id u4sm541042pfu.177.2019.10.02.17.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2019 17:04:56 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id EC455A258; Wed, 2 Oct 2019 20:04:45 -0400 (EDT) In-Reply-To: <4998a075-0f70-4b30-7406-135d2e160b97-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=uMfIwtsP; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52f as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org 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:23514 Archived-At: Yeah, it's true. Even though the ability to specify --metadata-file multiple times is new, you were always able to specify multiple YAML files when reading pandoc markdown (since these are valid pandoc markdown files). And changing the precedence at this point would break too much. Also, consistency with the way multiple YAML blocks in a document works recommends the "first wins" strategy. I think these are pretty strong reasons for keeping the order as it is, even if it is a bit counterintuitive. BPJ writes: > In the manual : > > > A document may contain multiple metadata blocks. The metadata fields > will be combined through a left-biased union: if two metadata blocks > attempt to set the same field, the value from the first block will be taken. > > That is, if I understand correctly: if there are two or more YAML > blocks, regardless of whether they are passed as separate input files or > embedded in other input files, and some key occurs at the top level of > two or more of those YAML blocks, the value from the first YAML block > which contains the key "wins". > > It *is* IMO a little counter-intuitive, i.e. I would have expected > right-biassed/last occurrence wins, but the question is whether it is > too late to change it or not. People may well have work flows which > rely on the current behavior. For example I have several Makefiles with > rules which pass one output-format-specific and one general metadata > file, and the order in which they are passed assumes the current > behavior, with the format-specific one before the general, so that the > format-specific one wins in case of a clash. I could of course reverse > the order of those input files as needed, but I would have to > always leave a comment saying that the metadata files are already in > right-biased order, and I would always have to check an existing > Makefile to see if it needs updating. I *know* that I'll forget to do > so after a while! > > On 2019-10-02 20:48, John MacFarlane wrote: >> >> It is as you discovered: the first one wins, currently. >> This is somewhat arbitrary and could be changed. >> >> Using foldl1 instead of foldr1 in line 230 of Text.Pandoc.App >> would give the other behavior. >> >> The change allowing multiple metadata files is not yet in >> any released version, so it would be easy to change this. >> I'd welcome feedback from people. >> >> consistency is good, so we should also ask: >> >> - which takes precedence if you do >> --metadata foo=1 --metadata foo=2 >> on the command line? >> >> - which takes precedence if you have two YAML metadata blocks >> in a markdown file, and they set the same field? >> >> K4zuki writes: >> >>> Hello, >>> >>> I have a question regarding multiple yaml input in one command line. >>> >>> I have two yaml metadata files: system/config.yaml and user/config.yaml. >>> They have some overlaps in entries. >>> I tested the following command with expectation that user/config.yaml >>> overrides system/config.yaml: >>> >>> pandoc -s -t markdown system/config.yaml user/config.yaml >>> >>> >>> but in fact system/config.yaml wins. What system/config.yaml does not have >>> is merged as expected (and vice versa). >>> >>> So the question is when multiple yaml with entry overlap given in a single >>> command line, what kind of override order is applied? >>> >>> Thanks && Regards, >>> Kazuki >> > > -- > 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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/4998a075-0f70-4b30-7406-135d2e160b97%40gmail.com.