From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/23512 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: FEEDBACK WANTED: Re: YAML metadata files' override order in a single command line Date: Wed, 2 Oct 2019 21:45:16 +0200 Message-ID: <4998a075-0f70-4b30-7406-135d2e160b97@gmail.com> References: <2921e399-c659-4cba-9357-577c2b05aece@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="170108"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBUH42PWAKGQESZGQEFA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Oct 02 21:45:24 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-wr1-f64.google.com ([209.85.221.64]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1iFkYr-000i41-EE for gtp-pandoc-discuss@m.gmane.org; Wed, 02 Oct 2019 21:45:21 +0200 Original-Received: by mail-wr1-f64.google.com with SMTP id f11sf2842wrt.18 for ; Wed, 02 Oct 2019 12:45:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1570045520; cv=pass; d=google.com; s=arc-20160816; b=ug3iJKria6U6E6h6kXwmestEX12fAcLh5BaryFFSf2sJ6zbzSU5Iun1DyGlbR8sCHy MlU1rR5AL2hfB7UhirJbngCjg8daNldqn3sR0IYquzNpOKI1eTMSCR4O2caWIt5ImFa0 qt1RcuC4UeOrGuw4601qB60knpJCwner6LUt3b/Rr068NRxknFGZcTaIiTYm1vHltQDF hfpHlfX8NHJOX9TlYpcvoUcjOs9oIB113vMF7G9to10oMuWRDsiXx6cbf0IWIly03Yp2 mgB02cWl7J//1HE7mPqsL0FWlQ+wKs7O3+LUMtf+WDYilnBxqvrz54hTOXiDWcSmXCt+ XvfA== 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:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:sender:dkim-signature:dkim-signature; bh=5ILC/cCZd0x1YFjwbadaSLZAEn5yK4nqUTGVNApJjVo=; b=GlWpLTy1e3XcylZLPuh9BodgrjvQy0OZuAzBTFQ8J0jNkIz57VauuoJLh79MoHy0B3 DW4421i4pea/svOeG03gdq1w3qi2PIFANJ8tas6hNhxGGMTThd5Ej2gxOCNlev12ngQy hzgV4hHDFuBn8V67g9eigabSKZpZHzAwDxIQ8c+72RH8nawcgQF3cN7nE2vdHZP5KoJD GatA/fpkDPg3MoJGLJwqnvfRu3ABg8ySoGocF+Rdu8LDQbQt5ZA1T3beHyYAcdgvfCH7 GaSDNrffm6MYs584IzLVHwioRzRBJgDp6ggbJMd8V1j43+v6hUv/MWYQ6/nR3RZtSCcj c++Q== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bOErdWgA; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::52b as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language: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=5ILC/cCZd0x1YFjwbadaSLZAEn5yK4nqUTGVNApJjVo=; b=q+05puJ7gBPF882At2coUuwdBnM4otmPL2JkRczMVNa8D3nLv1UD+eIIPq704Bm9Y9 fMhwI7U36FqKJ5ore0mXl1+PV2K9zX1X5GpcX+JRP8Km85mhFXo2HDUL2pZf48U/Sjxv ieQQY5C55ooHu0TENg49BeqPbAGotFvBqi91b3m0vHOcqPm0Ubc+rgDdxPK6cT3Ob+DA k21+Uh3IM7BG+LOOI0avBUeiNgzTDnO+FplHpw8yFQXvx51hKC1zjNetJJKucgnWgHc2 YOe84LwRkh0wccfqnVyB4YeJL0qUcUa+DQVPmcGUwd3pww2ImgqIj2VoG6Gx2udeWTrS ThDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language: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=5ILC/cCZd0x1YFjwbadaSLZAEn5yK4nqUTGVNApJjVo=; b=R/jwPsC3HUNst8N5YMPXHlxSedvNyKCzMAdwJ+FMJAx0T0ix5aJfJattVY1bPpenZO KoLJ5XE/ZVc7/NdVN1P4TGkYSO6xjzHhOUwlMEKgqCVepQ7JcGfiIG+HTCmIiMA7YoEK 3VYqj5QrmaR1H6LEyA0MqY7XDMyFs31HkPhk4ZRNHJXO/OkGsvCo9cnjjjO4d/aE7rmt CiDDXiK1EB/sNySSX/OuNzcs6RN1jnQLrje7YHYc13PIupp6280ZJixKMd4l9R6tTdM0 NTsZZmoG+QnEq9uT8IGuc7eoUyG5yYTLnDM9B0vJMaz5eO3ixlcz5U0wV52bvrnbygsJ Egqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :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=5ILC/cCZd0x1YFjwbadaSLZAEn5yK4nqUTGVNApJjVo=; b=gVyC7Dkm31aD2D+jlgEJ8i2jK7bUMJ2dCeebmZ453XaHMJ94PP+LMlhLuf1RivURt9 +8/pTAxxEoWaprEfYUxcIcuSsOp5LSNaTnEy/8rP1wKLFYIRHbG9a5Ouu7zNEz2RgHfx BK8bMzEX4gOGP0l3KEfrXcI82h9PbBKnPSuzWNo93tkcqiRMTvR5ujZy41EBpVorRKve oZ8+ksvEwE7zOhXjLlh8AqqJcYxK+76VH1z3yRWCkCcJrgMnU2ZDhbLDLqMnMPSxlzAr OSZfxnEmaHmTJucdam+5yxrMcNfmdtVhQazmrmeNC3ZZaFDP6l/UyPV4ysFJsZ600Jt9 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAVxnUfqqX/eE8hjb/slv71/X08ditxtH40WNgEiBBchtHrhT4Ad 1NRxhy4uaqwYdKwyVDzrlu0= X-Google-Smtp-Source: APXvYqxQwIzPvtaeH3IP3Axsu1JA2yWZ+0PO9z4wKhsupG5uwyoHmzYjhSTnbAnOX6/fGthYMQ9AdA== X-Received: by 2002:a1c:99cd:: with SMTP id b196mr3955960wme.83.1570045520806; Wed, 02 Oct 2019 12:45:20 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:adf:eacc:: with SMTP id o12ls1034932wrn.5.gmail; Wed, 02 Oct 2019 12:45:19 -0700 (PDT) X-Received: by 2002:a5d:4083:: with SMTP id o3mr4267433wrp.216.1570045519945; Wed, 02 Oct 2019 12:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570045519; cv=none; d=google.com; s=arc-20160816; b=VxURMaA6oZLWTAls1oSvh/sXVAHsIs7rt3LM19C45VEqQ8Z01Tw2w3kEBcbCPz4msh j1DyEAs5iHG+SY6+BEhzBlWF8ZCCGIPdU2LDkCA6K/z8nEM43KoaBltFRTkd3nrVk1lv TYF5Dp6oxkxeZvRqBXCU0pCvUr2gdVvD6oTkZ9WgfF7JLXaakXa3xwJy1e61LVZSPOJ0 k64omhv1QnNY6iSV5YrhxezhLfE7ccF3ZFYbC+gOuDZKNoJct0ao0LtgEs55D1RTJi6g bhtwlJ+6G9ebL2k5WBkHtt0WtOzivoIqJQ00cN6XHyfixZF4ceA7oIkPHtZfJZl1Q1kY V6Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :dkim-signature; bh=Z3oCJpDHZ2Qruh3+nVG6jgb8UjjDN+xSvyEm93eYE1E=; b=NCPmXenQs2YMVf0hq6ncv5xZSE2080drGgUKRMRv/aLb0dHnrErjxhclGGYwqEH/05 AGLqCOnuQtm8pO06vRxiiaWRTcZX/CPHvj2M/5nFV7w+CnNkSaWm2Ya8wd1stnFqxMml HwOLD2BEX30tqTlj9Xt9cx1TGDXqxr0n4cAOAkUa77Ac2wta/4dU68/35nlF3tfbJwFy 1Q+4Bx4R5Lu5KtajJ8ohnxS47e8DQVZyLpnnMWLn4sU8UXtczypnKyB3/XemroDiusyr oIvPvBPM4L1Q/mp5TpxKakvnbyhR1IxBBOCAOl1o6PVFEbBLgkZaHKy73sFCvgNJveAA H3gA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bOErdWgA; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::52b as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com. [2a00:1450:4864:20::52b]) by gmr-mx.google.com with ESMTPS id p12si18906wmg.0.2019.10.02.12.45.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Oct 2019 12:45:19 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::52b as permitted sender) client-ip=2a00:1450:4864:20::52b; Original-Received: by mail-ed1-x52b.google.com with SMTP id r16so232792edq.11 for ; Wed, 02 Oct 2019 12:45:19 -0700 (PDT) X-Received: by 2002:a17:906:1853:: with SMTP id w19mr4648836eje.232.1570045519310; Wed, 02 Oct 2019 12:45:19 -0700 (PDT) Original-Received: from [192.168.1.122] (user141.77-105-220.netatonce.net. [77.105.220.141]) by smtp.gmail.com with ESMTPSA id r16sm18972eds.72.2019.10.02.12.45.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Oct 2019 12:45:18 -0700 (PDT) In-Reply-To: Content-Language: en-US X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bOErdWgA; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::52b as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE 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:23512 Archived-At: 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 >