From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28672 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: Mon, 21 Jun 2021 15:00:52 -0700 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="29718"; mail-complaints-to="usenet@ciao.gmane.io" To: BPJ , pandoc-discuss Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBIUYYSDAMGQEGQS3J5Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Jun 22 00:01:10 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pj1-f60.google.com ([209.85.216.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lvRyf-0007aC-QK for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 22 Jun 2021 00:01:09 +0200 Original-Received: by mail-pj1-f60.google.com with SMTP id o11-20020a17090a420bb029016eed2aa304sf10353291pjg.2 for ; Mon, 21 Jun 2021 15:01:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1624312868; cv=pass; d=google.com; s=arc-20160816; b=VkAuE/8jyigHQkMBPmf3BLboNV3+PESSLAQMFeYTeC1ae0CWkkQMYIrdeF9U+CntxO 6U6i5yiP3jnjNSebBtpUrHjBDrCdX/Hl+OTg5Os7bb/74kVnTW7VnNnuGFHpGLfcBRvI fKRgLyH7r12tM29LFbg7Ggvwn5CUpU5vtuFo+RZHke6PDCwaQKqfhwQhobtXHTlxhS+3 97DTOXcTe9qYN3ctPl1ZysFqbqSkO3wf/6N3YZfOqlkEZWNiw5DCZe24FRMGLeOrlDw4 8Itqd32O9MI16a/6Nb6ez035M6nGsSqaOUNXUH7VqePhFgawvO61INF4d5wzNwVeNzAA NzBg== 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:to:from :sender:dkim-signature; bh=G3EYCvStvUCIsijKYVmL+5UlG+mgtnvATWn3OD2xRnY=; b=NBkT1vIwiC1Rgj+ggfoWpsnUKYBFFR7iVY6G0AHc1xzgdKxm77fbCw0XQYQ9sz06vk XxkNDyeL8zpZu5LoleiU4Dq13RwAJh3/aOAP0msPB0gFcIT9f0bUgrjtdAX7A86k+Y9W yUEDCKZfObL/BS0NU+mARfLvrHkHk0wpF8D0Rrvb8y2g+6YM0Ot9uPkIdIF53YweMaQl D4KhVBwZ4xTuibsSZtHLyJ1Fhe7zeFVCsCRELJhNoQ8mAzfTnTLzULc/p/7dR6OrSntu LrYDiLzK9YMr3MY8LZNYVdcPJxmJvpo5qJsRgvRBD6/YIBtjk/MhWG70VuXLPKMU2YwN KTQw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=YEM2KLhC; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52d 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: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=G3EYCvStvUCIsijKYVmL+5UlG+mgtnvATWn3OD2xRnY=; b=c0Dirzp0AMQVmY8z2ldT+dgTf8nntAtfzHZ+1/J5Q/REBqxyRyZ1xTmdezfvf1bceT UtCjY9gq+Kqb6RQkw6sp0xjs55K3SmLxktNHSyfZcURakWS8bzYV3YpseOgz6VE085t0 1Ct1sTEn1pQuqUfMIQnoLwLG8zmkauH6+/SjD3LatSmMRan6GerHLRQwiiSiRFmE4qwi qij/1BHo/7Oz7Jz4sRyEL2Xjh2eSIbxo6jduhRKnvTw4OEqbPgtYyZcJzm4XQga973L+ skdN7nw3YGy3SYQMhQo68OK+W8IEy/GBRgtFca0RXR8FSQ315byRHoNbEdNQ4vovwmW3 P6fQ== 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: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=G3EYCvStvUCIsijKYVmL+5UlG+mgtnvATWn3OD2xRnY=; b=cY6DtCe+I87Ulr9zHo+E+N4rcoisIYU+4erhPgjSkmEis5tV6nXc1a+oLSgm5Xt6XM 0xt1189vZVUUighf92Pg9KMuBC9XT0FK7exTixfWsIFB3eXuBJ5s3Sd+sYSPOcK99fpx JD2AqsCsPrP32iNPrEaIuFjBIwsyaFxc89+GpwD1W7z2J2sS7UTcua+wPSqepaAFzj+G gCbGEBxFSgjQFjebC/GomQWRhTLM0S7YbMSFtRVi7z9Se9n6TQtUMK+C3pLcqMw7PpeG 7kkAbRzd+QJZQCs+2yHVoozQj4+ydlR5bBiR2t+Ie6mVEJjzZ2SFOzjH6hjb5xAaQtLs Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM532Q8hXDneVaz9SuYJS4elM1X04lUSwz/Zc2Ym3bLtSZgq9Qmp1g L0MPU3YZk48rbTcvJoCac88= X-Google-Smtp-Source: ABdhPJyxbDMHDfqQci6GAGYxj9mIcVMIPmHw3K6uufcIFZMQDZpf0my6rE+1Y22qnFryWZRVBU+HnA== X-Received: by 2002:a65:63d2:: with SMTP id n18mr564204pgv.447.1624312868081; Mon, 21 Jun 2021 15:01:08 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a65:4107:: with SMTP id w7ls8949844pgp.3.gmail; Mon, 21 Jun 2021 15:01:05 -0700 (PDT) X-Received: by 2002:a63:4815:: with SMTP id v21mr574613pga.213.1624312865718; Mon, 21 Jun 2021 15:01:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624312865; cv=none; d=google.com; s=arc-20160816; b=E9gaalnANvIxnuiZqoDUDdgeiv6c3TK36CBVRGXEg5drN62uKBP27/beMH32CbM3nv kfhTzmpIB7EY9sGj16RyJl6dsoMld+/RGW7nmde8/fWl80qUhcTAXahrSTmFU3p72or1 AAw8wlNlyUxYvDLyVnu7BnSGmNvwbbJd6Rn/+XQ2p0+4pqYvLw+cuc5aWURh6cmSbMb8 3/L+sa2HQ/mNs3Z/U1AXK5ITo+IFXUMqlULxdqJCavGm8yq9KpFr6+2d1PrCwydur1bd MyXZ4SZCq+SMEVmSAEYtE2cmky4U8L/z3AMOw/UpgaCo6ebX7Ppn2NM4BPKkDo5g8hRo /2fw== 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:to:from:dkim-signature; bh=tIUknLo5LKrKhNdk7eMBfzKg7PxEhihsFDBSUMrwYcE=; b=SXE79LjbgQlvkMBDcMfaDS/7SpWw2tRD7oyEfk91tnoDsoB0l4hpgA/nPtrTVANCYB rVELtujtVM537/n7EkkWvfD6A/JGIEe2PuBiHBBhTlhU6fncvOqXfZjM3fflhVyOG40y hacoYzBG6CXv49PLzIl9UO6H9HLkUgM0XjpYM1DCFZLg8Pw5nrbXib30D/k9eFjtcFM+ bJgalPDnNAqTZXcCQ4NN37sIACAV1ZjddaqnOUjtPTDlq8RaKEcx0d/ztu9+iOqC9Hwd 1dgPWy9U++PtQ7XjAXhA8LlAA6ooFHS+Ta+AAHxweBR/YBeLbtHqjrsiSthtupLvu8Jq Iz3g== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=YEM2KLhC; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52d as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com. [2607:f8b0:4864:20::52d]) by gmr-mx.google.com with ESMTPS id x14si23922pfq.0.2021.06.21.15.01.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Jun 2021 15:01:05 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52d as permitted sender) client-ip=2607:f8b0:4864:20::52d; Original-Received: by mail-pg1-x52d.google.com with SMTP id h4so3735488pgp.5 for ; Mon, 21 Jun 2021 15:01:05 -0700 (PDT) X-Received: by 2002:a63:2b8a:: with SMTP id r132mr591624pgr.380.1624312864353; Mon, 21 Jun 2021 15:01:04 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id y2sm16077856pfa.195.2021.06.21.15.01.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 15:01:03 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id A3DAAA249; Mon, 21 Jun 2021 18:00:52 -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=YEM2KLhC; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52d 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:28672 Archived-At: Yes, this definitely used to work. Maybe due to the change to HsYAML? I will look into it, but an issue on the tracker will help ensure it doesn't get forgotten. BPJ writes: > It used to work. > > Den m=C3=A5n 21 juni 2021 15:44William Lupton > skrev: > >> All, >> >> I don't know how I missed this before, but I have noticed that this isn'= t >> treated as a valid YAML block (at least not with pandoc 2.11.4). >> >> *% *cat comment.md >> >> --- >> >> # comment >> >> ... >> >> *% *pandoc comment.md >> >>
>> >>

comment

>> >>

=E2=80=A6

>> >> Inserting some YAML works: >> >> *% *cat comment-plus-variable.md >> >> --- >> >> # comment >> >> variable: 42 >> >> ... >> >> *% *pandoc comment-plus-variable.md >> >> >> >> I realise that this is an abuse, and that I could have used an HTML >> comment (for example), but I believe that this is valid YAML, so should = it >> have worked? >> >> *% *yq eval comment.md >> >> >> >> # comment >> >> >> >> *% *yq eval comment-plus-variable.md >> >> # comment >> >> variable: 42 >> >> Apologies if this behaviour has changed in the latest pandoc... >> >> Thanks, >> William >> >> On Thu, 3 Jun 2021 at 09:10, William Lupton >> wrote: >> >>> Thanks! >>> >>> On Thu, 3 Jun 2021 at 05:49, John MacFarlane wrote: >>> >>>> >>>> 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 i= s >>>> > indeed a YAML syntax error, so Pandoc does the right thing when not >>>> > considering it valid YAML, however unfortunate it is that Pandoc may >>>> think >>>> > it is something else. >>>> > >>>> > The overview of YAML syntax on Wikipedia is quite good. Perhaps the >>>> manual >>>> > 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 vali= d >>>> table >>>> >> > (mea culpa). >>>> >> > >>>> >> > So I thought aha! I'll change the terminating "---" to "..." (in >>>> the hope >>>> >> > 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 >>>> there >>>> >> is >>>> >> > and I've missed it?) and/or perhaps a suggestion that it might be= a >>>> good >>>> >> > idea to avoid complex YAML metadata blocks (in favour of metadata >>>> files)? >>>> >> > 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 an= d >>>> >> 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.m= d >>>> >> >> > 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, 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/CAEe_xxjF3Un2J-xg5UOs= 7uReZ5cO27TATA%2BfDY%2BAtghAsVhShA%40mail.gmail.com >>>> >> >> . >>>> >> >> >>>> >> >>>> >> -- >>>> >> 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/m2a6o8ul91.fsf%40john= macfarlane.net >>>> >> . >>>> >> >>>> > >>>> > -- >>>> > 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, se= nd >>>> 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/CADAJKhC2g4z_H%2BK%2B= VtGoVd1T2nmYeMuRrnUquhDPpoYfuxSwWw%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/CAEe_xxj-bHpfTLDhz5QRz5= 1x-zcs%2BVW5dgWbmRTRaNL%2Bx6Y31Q%40mail.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= 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/CADAJKhAr3Q_FR8FaubSDUxj692uSwAhKgdVV8mDRw5eU7HmO0g%40mail= .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/m27dimg9nv.fsf%40Johns-Air.hsd1.ca.comcast.net.