From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28523 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: William Lupton Newsgroups: gmane.text.pandoc Subject: Re: Syntax errors in YAML blocks Date: Wed, 2 Jun 2021 18:09:28 +0100 Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000001c99db05c3cb86c6" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9669"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pandoc-discuss To: John MacFarlane Original-X-From: pandoc-discuss+bncBCS4HJ6WSAHBBWPW32CQMGQEOFUHYIQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jun 02 19:09:52 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f188.google.com ([209.85.208.188]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1loUNL-0002K7-Vc for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 02 Jun 2021 19:09:51 +0200 Original-Received: by mail-lj1-f188.google.com with SMTP id f22-20020a2e38160000b0290130cf22822asf926223lja.16 for ; Wed, 02 Jun 2021 10:09:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1622653791; cv=pass; d=google.com; s=arc-20160816; b=bXIUouUZGkuPGGdxcEwdoXlvRaBRfj8XWJv2AAWnYFx55LDQXBI1PAoknK5poFCgem QqlNhfuqqMjPcX9rfSq775pJMsBR+Htsp14Mb2/tfqoacdttPgxbRlZBxFPkEoo6GhRf x10h7A4O/yE7s3F6oU/3BL13po4zP7RhnWatgMF3H/Y1iJdEvYRL/oh0ijGeJXyH3f7F 80uqGNStH7JTMiW1z6Ip8kQK2a0a+w9l7x4/pGc0OlDWECdElQd7GFef1+zMqVRDP7zL TeiUnB+fhMWvceVtcoxVgyO+zP0M143VD6eW552GvQv9tmTxxNOc9vLD7E06WFTBjtXz zirQ== 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:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:sender:dkim-signature; bh=T2T3Lid/WjbHxfIWygsNyG/GvFIdj2ML5+yVw2JDrGs=; b=caF1jl8DbcI/o9/ug+PEQmEob03U9sN+xsROkSrQShUN2twNO6EMcMqWDWAAY51Zl8 jGjIGIg2+1hBFloTyswJ9o6rToOQYd4sPpQc7qyZBN+T81BEIORSIvyx230XJX+jhJ5B Oe7VohMpGBSnG8B6gOpts76Wfh4GL0jVCYVvAMWd5OEOSpDqm4j3XVmq2SlTY1FH+xIv zEFSQbb9Rql4w0GITdlDWmLwP9SFkQchfCUGmXhbSQIbKQ8mu936pMOnz2pXffT5Pgk0 lGFugfhigrejQqKHZXF8GoqiEKW9e+ltJf0rjj+XcRtDscryAhq9aNfZOEyYZm8HcVeh b3EQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20150623.gappssmtp.com header.s=20150623 header.b=lyUq6HWM; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::62d as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:references:in-reply-to:from:date:message-id :subject:to:cc: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=T2T3Lid/WjbHxfIWygsNyG/GvFIdj2ML5+yVw2JDrGs=; b=Q6tcBjIveQ/+CgLPadFs9xYqE5hXoH1HJ43vI0E08V59Huy17tBDamidS1Y1trsXxy 3Y5pMBk4p32Rtbt8HDfzrnop0nAncZ9w22wXKyT90m5oU80Ru2kooGwgp+rJDmDccRVt 3MJdeg2IELcjknPVa680ZwWIAZxdi1+pFUGXP68B3nKszkQpATa8qFF4ThUKdMzRtAA4 GRfeADMQNyrMn1A2AqCHr8stxpE6+m+Qw1On++0st56uGOmUVSJsi8sItl/1Ag8caP+m 9hs3PVN3sKECe9X3fte80KSwgfXxygk4lXDcCt26PxZyTSKyAlnnuRrTInF8NL8Ma4tc ANvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:references:in-reply-to:from :date:message-id:subject:to:cc: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=T2T3Lid/WjbHxfIWygsNyG/GvFIdj2ML5+yVw2JDrGs=; b=seauRm7rTqh1U+gWE8mZn0RuqfFZYViUgcP5TYcgUY62fIpqhZMgj200VZ5eToD8i3 vChc8XtAPC7nC/ald6om7qi9zlwm98O6ms6Yr/bhBUp9x2OkjgFf6r4IOBvIUjroRi5n x3iWO0bSqyGjDcsWhL8Rf7eKwmmYkxB/kNgT1d7q1LFfdiu4PRPRcVwVsf6ARf9+dKGg 5wsRq4vQBsMMgoqOQ8q+QpVYIt85E1TaxDnJV0mJqPYJBGl51gYOgWGcRdqsPzucb/yI kCQGoZk6VJcRr/J8fAct1usbVAA4quuEKGUfKyiDRmX1l7UWNQd41HAq2tAnnUfiB4cO d2PA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5315bcnK57g0vM5+bP7VbSGl4tH21jJW1rEmoplABI6+/4K+QfcO u0A0XXf0wPUTQvJY6W7eas0= X-Google-Smtp-Source: ABdhPJyj2FGZURNM0lkVf77zxsole+BbX5/u0TePYVsO+G665V52tTHnc2OqG4HDQyIByf/2N/G+rA== X-Received: by 2002:a05:6512:20f:: with SMTP id a15mr7176338lfo.618.1622653787026; Wed, 02 Jun 2021 10:09:47 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6512:230f:: with SMTP id o15ls539089lfu.1.gmail; Wed, 02 Jun 2021 10:09:39 -0700 (PDT) X-Received: by 2002:ac2:4d08:: with SMTP id r8mr9790989lfi.85.1622653779717; Wed, 02 Jun 2021 10:09:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622653779; cv=none; d=google.com; s=arc-20160816; b=cTWDqKm8bjMAKO+vy8MPzfnyHN/8dnKz54bqUtjRKxcw+vCfjegFhYo4eSW7G93dRA z5WzY1x7sGBCMj4pkMBrZSAshbxuv80GfeIIiV4pFVp6fNqotyBkV8TF+VGa2EEn3HMF raS2in4ZEktLCxq7AopPoJheJWJp5QAe5LJqFAm5Cw6rn3SmQ3WMd1xZ/fEYF7ery/v/ fAm/VUzFR9BAVB3+k/6um7Muyg2TmKAhARhCH/hldTrcVZC5FUvPM/ppTX/cxMfwtd6M q91AS0SNVvDqBvB7fGxYFdYOjjTB0QzNWjumL2B24O29ot1BYIgAxZ0rD7AM8AzW9YrT AVtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=LlMZIEFb1syp8xUwlyKAhBmmCmQh/tYDxiAoN5jYnas=; b=J/iTYaUZMfJpq8sMJ4/AC/8qWzZDTcLPzbMGmz3PsMkHBe85c50kq+ZjhQON7+4U2D EoeRJWycCeJ2tvdaB6YEEC7Y2ahbqYATAxrPCvXwRPiSXM37euyvIMN9NGgBfrA6Bq+R dI6UoyJxXRRM+rNTA60Xb4FGIcNb0s48WrzNdWOpuo2J1+2ZovgnBG7JyQrSXz7OA3Ll YFPDOKSovDZ7rw/RBTcW5Zfsiy0RHj+RRdeRu1ouP0oCpnkM6zgAaeu6L0hsaiVJf7gF giTTtcJibT8pKmBY7RxTEK4USNuOcwm79f9UHGJGan1uXCkwe0nMjqIbn+R7ZnEmiYfx L55g== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20150623.gappssmtp.com header.s=20150623 header.b=lyUq6HWM; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::62d as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org Original-Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com. [2a00:1450:4864:20::62d]) by gmr-mx.google.com with ESMTPS id q8si24772ljg.4.2021.06.02.10.09.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Jun 2021 10:09:39 -0700 (PDT) Received-SPF: pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::62d as permitted sender) client-ip=2a00:1450:4864:20::62d; Original-Received: by mail-ej1-x62d.google.com with SMTP id c10so4883804eja.11 for ; Wed, 02 Jun 2021 10:09:39 -0700 (PDT) X-Received: by 2002:a17:906:eb88:: with SMTP id mh8mr17675782ejb.540.1622653779344; Wed, 02 Jun 2021 10:09:39 -0700 (PDT) In-Reply-To: X-Original-Sender: wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20150623.gappssmtp.com header.s=20150623 header.b=lyUq6HWM; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::62d as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@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:28523 Archived-At: --0000000000001c99db05c3cb86c6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 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 and reporte= d? > > > > 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, 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-xg5UOs7uR= eZ5cO27TATA%2BfDY%2BAtghAsVhShA%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/CAEe_xxiHXF5vQTwyoUVLErHXSb%2BiMQvUaodU3aPbjnJ%3DfT54dQ%40ma= il.gmail.com. --0000000000001c99db05c3cb86c6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks. Yes, I guess I realised it had something to do wit= h ambiguous grammars, but I hadn't really considered that my input was = a valid table (mea culpa).

So I thought aha! I'll ch= ange 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 th= ere is and I've missed it?) and/or perhaps a suggestion that it might b= e 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
=C2=A0 changes: |
=C2=A0 - TBD
= ...

% pandoc bad.md
<hr />
<p>his= tory: - number: Release 1.2 changes: | - TBD =E2=80=A6</p>

=

On Wed, 2 Jun 2021 at 17:47, John MacFarlane <= ;jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org= > wrote:

Well, this actually IS a valid "simple table".=C2=A0 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 <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:

> Should I expect syntax errors in YAML blocks to be detected and report= ed?
>
> This has a syntax error in the YAML block:
>
> % cat bad.md
> ---
> history:
> - number: Release 1.2
>=C2=A0 =C2=A0changes: |
>=C2=A0 =C2=A0- TBD
> ---
>
> This fixes it:
>
> % diff bad.md good.md
> 5c5
> <=C2=A0 =C2=A0- TBD
> ---
>>=C2=A0 =C2=A0 =C2=A0- 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
> <table>
> <tbody>
> <tr class=3D"odd">
> <td>history:</td>
> </tr>
> <tr class=3D"even">
> <td>- number: Release 1.2</td>
> </tr>
> <tr class=3D"odd">
> <td>changes: |</td>
> </tr>
> <tr class=3D"even">
> <td>- TBD</td>
> </tr>
> </tbody>
> </table>
>
> 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 Gro= ups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send= an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To view this discussion on the web visit https://= groups.google.com/d/msgid/pandoc-discuss/CAEe_xxjF3Un2J-xg5UOs7uReZ5cO27TAT= A%2BfDY%2BAtghAsVhShA%40mail.gmail.com.

--
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 view this discussion on the web visit https://gro= ups.google.com/d/msgid/pandoc-discuss/CAEe_xxiHXF5vQTwyoUVLErHXSb%2BiMQvUao= dU3aPbjnJ%3DfT54dQ%40mail.gmail.com.
--0000000000001c99db05c3cb86c6--