From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28527 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: Syntax errors in YAML blocks Date: Wed, 02 Jun 2021 22:49:20 -0600 Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23132"; mail-complaints-to="usenet@ciao.gmane.io" Cc: William Lupton To: BPJ , pandoc-discuss Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBXN64GCQMGQE6OKKSYQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jun 03 06:49:35 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-io1-f62.google.com ([209.85.166.62]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lofIV-0005nE-TQ for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 03 Jun 2021 06:49:35 +0200 Original-Received: by mail-io1-f62.google.com with SMTP id w17-20020a6b4a110000b0290492680338ecsf3080863iob.2 for ; Wed, 02 Jun 2021 21:49:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1622695775; cv=pass; d=google.com; s=arc-20160816; b=L/EtA2D3V8O3aO6UY3V0zNIBcVF6X9yS+cWCj7zvE61vnMEeMGbbVW2N1yKRW66+V7 40418r7esEwgO4/gf2LfYzoARFY4EG55+uV070IIOicNZMQMuGGrgjHNnGxLiXCqeq/h wWT2lKAZxiTxXeJaeByweebb98VVqRRRlqAnxs2DcRhDNZCWcfy0si1gCjLw9s8wI/P3 lYlIm6EYY2fJuIbGf6lSw1zf6hgcVqYaNaw9GlTkrGdcp8zRqosvnJqd3mIpVpLmML7F RnmX2JVqNfaRA0hiXrPCjXjDaVsLMEfobre9AIYTRjt1mLDB5b1eIHW3jHHMHJ+SaE+Y WvYA== 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-transfer-encoding :mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:sender:dkim-signature; bh=bNtfg7yLLHe1M9NTtnVhO6aloMHjGJ0N1aIISGMLrI0=; b=w2RmILOQAO45Uavsxdulkb+x1KN3BhUGOqD7meYkv7q08PTycbI6myuuJFiZZ6Tpb+ +sRs9qY27yz7b1nRUdSv7nycUoEfHSozKz/XFpPPlFwqaYlc9ouZsqQzgImkePfgQSqR fl74OnPOjJOqzXcC7THRAZvcn9i70NMIw7JiOBK8zZ0mQdaZ0FFeRt9xVSbZfnFP0nu+ PZ1atzAez2mG2kSF6SxxwPdQjpRYkP1V7xi9IWUuO+Th5ZtUYo1xJZhpBRyBnPikBEGr lXCWiGHQsmRED+CZrXCUQoieLO3ebE3pOqzhd/QKdodFSAkvtwh2+waSaR7HONLtsdNW ySaw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b="Qozwk5e/"; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::436 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:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding: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=bNtfg7yLLHe1M9NTtnVhO6aloMHjGJ0N1aIISGMLrI0=; b=FTqQV9sNtGfmmBOdgP2OxZM2fcszZALLDNPRRwy3O84QIsUjsY8jyOO9o6jQkDTa+L N669ojWS6Hoicjf9Be8JWK4hJfW6TadIGIlZvDvgC2OiCg5NhZ62uNkGaR9GzInGIIzC 7jsqLHnUvWw2b8wCNCYqlVt1e08dQju0ycI0o8BLimmOaMnbrT/x0UyokhbePwb4LCKX 4WQ+kz5icdUNHU/9K1TDWC/ArwnA+gDiZ4vBmgMMdroEPw98vmAAXAaksPQh2izviul8 QpKgg38np3hkVqIyF/FftuqQPvMC95RX9wKKZ3qjJFnfXDB/Ca6aqG80pq/9WfVNw8WY VT+g== 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:cc:subject:in-reply-to:references :date:message-id:mime-version:content-transfer-encoding :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=bNtfg7yLLHe1M9NTtnVhO6aloMHjGJ0N1aIISGMLrI0=; b=mBzU9MPsAIAAPcxMrdAULPSMT9GD44+3YqyAFlSmpMx9RygRUf1lQNoB7AcmrXbvUK XgQ402vmkXdzot1rOeXn+lZosPLgbWVRxeNudKJd/VMrGnIPsBJqCB40rbq83VDGYUH4 2MHpF8pCjVdVGSHEPfcSeFDrLzP7KEIXSmTQeZvbkylcNhi+vmshhhlO4t9gDkFk+GVC CFXmcPIU8/dHJFPiR80YDQjuOrDSYAuY6Cx+qycC2Jqzis0eeYEQVk5i8xweNIig40vL JtSSfSKmuerdyeIkQOsWp1i6kl6gONXl0CJCS46ZbFfZcbcv9DP90dZ6ve60JFFvRjJV Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM530TpaQmm+jtYec/iWwlPafvgrooNZHkgTRrYvt4ASCs/uNmz8Hp ihQurq5WYvofcMEeFX1W8F0= X-Google-Smtp-Source: ABdhPJy1raSNMo3kg+pnjGDsc+WglEX+YZjSjv18Y7Sx+btJHSpBsXvU2kNp3Iu8QWAPdQW+rBk35w== X-Received: by 2002:a6b:f618:: with SMTP id n24mr17803443ioh.174.1622695774865; Wed, 02 Jun 2021 21:49:34 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6e02:68a:: with SMTP id o10ls651648ils.3.gmail; Wed, 02 Jun 2021 21:49:33 -0700 (PDT) X-Received: by 2002:a05:6e02:1561:: with SMTP id k1mr29477885ilu.218.1622695773506; Wed, 02 Jun 2021 21:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622695773; cv=none; d=google.com; s=arc-20160816; b=O1GYtevYPZNtnjTvs4bpBh9xyW38yD5q9/yUaC77L25sxvfgjT+eurZQDDrlrMsOFx rgCWt4iBIeNfKHvhpErpDkeR6J1/DC0nqas2C1gFlCKEW5/ERVKdPO2ZJXquenEt0Qh5 kbYTXne3Fd2xNJCVSAN63kFLiPFjszVIKZRiLO3aL+CoYtKP2DMpeFCaOSnoIfyS/Keb K3Xg9o+zEXQXbVXEY/yYpf2WN4SDsZ72whmUbG/HpF1OLj0O97+WojpSM9GfEd+ebhXe Gwshpd0uGh7ZT5qTj5O9tEpb0SIFCQyeSK8Zc5dA7/cc1r5OWZsa4mfHiNT5u/O3YuGA r+Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=q0WaPk1R4bGMdEnyYr2DcOmY2Tl9HgB4PqvJRWUZ+WA=; b=j98jcD5hJxsyt5B+o1QePxpyJgg4Og5ucxujVWpJgM0fIspeZkTWaxLXM6+y2Mv3su UhO8y1t9Ney+kFbshFCKPg0y5P+UamxensFEiZUwln3Hh50YCUKuMpmpTgbywRqw5EKM 5ZbymcaOGtljAqjsLmzUel5uiw5ugpSENgl0kqhDKgLqGwvItxoUZFz8QXjzwsOh8rGM ZbW+i1c2XWyaTktOP0MK2pIE3NKv0adE1/poUEsuD8eKP0jt/nk8WDgvL4Xgo4wJ9BZH 91Iu3DOjnAnF6z+IURUErKRDfYu3/GM3mWmlIexS/xrfmdf8lutEGG15fxHc9+QAe+Wv F8sA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b="Qozwk5e/"; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::436 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com. [2607:f8b0:4864:20::436]) by gmr-mx.google.com with ESMTPS id m11si102918iov.0.2021.06.02.21.49.33 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Jun 2021 21:49:33 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::436 as permitted sender) client-ip=2607:f8b0:4864:20::436; Original-Received: by mail-pf1-x436.google.com with SMTP id y15so3966422pfl.4 for ; Wed, 02 Jun 2021 21:49:33 -0700 (PDT) X-Received: by 2002:a63:1c1a:: with SMTP id c26mr38682117pgc.301.1622695772340; Wed, 02 Jun 2021 21:49:32 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id o3sm1222748pgh.22.2021.06.02.21.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 21:49:31 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 5E5A5A23E; Thu, 3 Jun 2021 00:49:20 -0400 (EDT) In-Reply-To: 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="Qozwk5e/"; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::436 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.io gmane.text.pandoc:28527 Archived-At: These are good suggestions. I've revised the manual accordingly. BPJ writes: > Perhaps it should be pointed out that the body of YAML block scalars must > be indented relative to the line with the `|` or `>`. Not doing so is > indeed a YAML syntax error, so Pandoc does the right thing when not > considering it valid YAML, however unfortunate it is that Pandoc may thin= k > it is something else. > > The overview of YAML syntax on Wikipedia is quite good. Perhaps the manua= l > could link to (some specific version of) it. > > https://en.m.wikipedia.org/wiki/YAML#Syntax > > Den ons 2 juni 2021 21:21John MacFarlane skrev: > >> >> The problem is that basically anything is valid Markdown, >> it's just a matter of how it is interpreted. It does seem >> to me that in the second case we might want to at least emit >> a warning -- if not downright fail. It's just so unlikely >> that someone would write a block beginning with `---` >> and ending with `...` and intend it to be something other >> than YAML metadata. If you'd like, you could submit an >> issue for this. I'd rather not suggest avoiding complex >> YAML blocks -- sometimes they're fine, if the syntax is >> correct! >> >> William Lupton writes: >> >> > Thanks. Yes, I guess I realised it had something to do with ambiguous >> > grammars, but I hadn't really considered that my input was a valid tab= le >> > (mea culpa). >> > >> > So I thought aha! I'll change the terminating "---" to "..." (in the h= ope >> > of an error), but this of course gives the output shown below. >> > >> > I wonder whether there could be a warning in the manual (or maybe ther= e >> is >> > and I've missed it?) and/or perhaps a suggestion that it might be a go= od >> > idea to avoid complex YAML metadata blocks (in favour of metadata file= s)? >> > I'd be happy to create an issue and/or a MANUAL.md pull request. >> > >> > % cat bad.md >> > --- >> > history: >> > - number: Release 1.2 >> > changes: | >> > - TBD >> > ... >> > >> > % pandoc bad.md >> >
>> >

history: - number: Release 1.2 changes: | - TBD =E2=80=A6

>> > >> > >> > On Wed, 2 Jun 2021 at 17:47, John MacFarlane wrote: >> > >> >> >> >> Well, this actually IS a valid "simple table". So how is >> >> pandoc to know that you intended it as a YAML metadata block? >> >> Pandoc tries first to parse things as YAML blocks, and then as >> >> tables, if either works, the parse succeeds with no error. >> >> >> >> William Lupton writes: >> >> >> >> > Should I expect syntax errors in YAML blocks to be detected and >> reported? >> >> > >> >> > This has a syntax error in the YAML block: >> >> > >> >> > % cat bad.md >> >> > --- >> >> > history: >> >> > - number: Release 1.2 >> >> > changes: | >> >> > - TBD >> >> > --- >> >> > >> >> > This fixes it: >> >> > >> >> > % diff bad.md good.md >> >> > 5c5 >> >> > < - TBD >> >> > --- >> >> >> - TBD >> >> > >> >> > The latest pandoc: >> >> > >> >> > % ~/Downloads/pandoc-2.14.0.1/bin/pandoc -v >> >> > pandoc 2.14.0.1 >> >> > ... >> >> > >> >> > Pandoc thinks the bad YAML is a table: >> >> > >> >> > % ~/Downloads/pandoc-2.14.0.1/bin/pandoc bad.md >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> >
history:
- number: Release 1.2
changes: |
- TBD
>> >> > >> >> > But it's OK with the good YAML: >> >> > >> >> > % ~/Downloads/pandoc-2.14.0.1/bin/pandoc good.md >> >> > >> >> > Parsing the file as YAML reports the error: >> >> > >> >> > % ~/Downloads/pandoc-2.14.0.1/bin/pandoc --metadata-file bad.md >> >> > Error at "bad.md" (line 5, column 0): >> >> > Unexpected ' ' >> >> > >> >> > % ~/Downloads/pandoc-2.14.0.1/bin/pandoc --metadata-file good.md >> >> > ^C >> >> > >> >> > -- >> >> > 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, s= end >> >> 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/CAEe_xxjF3Un2J-xg5UOs7u= ReZ5cO27TATA%2BfDY%2BAtghAsVhShA%40mail.gmail.com >> >> . >> >> >> >> -- >> You received this message because you are subscribed to the Google Group= s >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n >> 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/m2a6o8ul91.fsf%40johnma= cfarlane.net >> . >> > > --=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= email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgi= d/pandoc-discuss/CADAJKhC2g4z_H%2BK%2BVtGoVd1T2nmYeMuRrnUquhDPpoYfuxSwWw%40= mail.gmail.com. --=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 view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/m21r9jv9gv.fsf%40johnmacfarlane.net.