From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28673 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: Tue, 22 Jun 2021 10:26:50 +0100 Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000006e5e8605c5576468" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30394"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCS4HJ6WSAHBBZWZY2DAMGQEHMLRCUQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Jun 22 11:27:05 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f61.google.com ([209.85.128.61]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lvcgS-0007gC-JA for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 22 Jun 2021 11:27:04 +0200 Original-Received: by mail-wm1-f61.google.com with SMTP id w186-20020a1cdfc30000b02901ced88b501dsf516159wmg.2 for ; Tue, 22 Jun 2021 02:27:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1624354024; cv=pass; d=google.com; s=arc-20160816; b=Ars4v8y/+azMMibm2yfAAWNZsWHid0SioVXxxU3HMMsxwSxtjbt6QP9FszrTPW1RpA sX8zKQKa1owtyZXfa1+UW8lZI3j9L6BhU3w1NeFRqK2zuSgwExJPLLQbvsKpbLG+b75H uL3S4r+oHm5UXYrcoP+kRLA98Df3esFBwK3yq9gQBioKjXquM5FEpxn9IDHY1KrqO6yi ihB7aNMAosOxl17LjVvCkl+AH7hOo4poF33WlkGZimH1QpHrSGI9vzHqjgXcCA9TeGLn Quvd+0Zhj1kyRgo8r7ipHZjjcL5MCbUJhwvTChrCCAGrvDuus5X2FNvbDGyU+WA/qi5U vdow== 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:to:subject:message-id:date :from:in-reply-to:references:mime-version:sender:dkim-signature; bh=8qQr+wekmXh9N7DfBn3O0HnnV1ceKlbiFOdlEnzKDtQ=; b=CRbOkKCLPXtNmeBcmxrsNdFUkCtjG3quKXgJ2H241pBH6AllyazuOxDvnLCaosoXH0 +hxiASOtg5zhy9Zbho2egqzcm1tDq1UVMDjq4lGGzzR9ljDzfdhgowHECcUSREMFeYE/ dU6Tqey7P1sYrGDGTFXwPzkAzMYw6yvlFTLyB7YHHmf58l5E3fhDckWOuhX9Qy+Cepum aH11Buak7174rm4sE/J1QMaGPRbDgrwiE1drbZ03kE89GB2DtMWX2ngbpKiIi/gbcFpi Uhj70DJcIs0aD0VmUichPWgxdb8b/rQAOfuoeF2UgWRFVT0SaKrTUSCi0+dzShCUvEyl S2Gw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20150623.gappssmtp.com header.s=20150623 header.b=qTHz0mo2; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::630 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: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=8qQr+wekmXh9N7DfBn3O0HnnV1ceKlbiFOdlEnzKDtQ=; b=GtY5Al/tvdfTBd4m2ENFH1khNalC+lb1Fy2WvnT6ckCkD3sSho4h3G6jy7KBWF9s3b aSClswxCncmbz1pP4QWgjiW8AQPKjTZc5GmIEiymRfCBnpTbr+Oa/N+W73JK/da4cYRv WvcHRoTc2YMM7vJ9z0k9DuOEgd2pBQHE59hcvbc4F2x8Cf92E/Eci7KPmKeDhgtK86Yw 2WyjFHKCsB8KXZ2l33genxbvr6tNha7D+GrVt8DjY5g2xPKslJdeBeoRm0xN+dZ31Kig hL/9PqTy9t6vexmDlTNyQI6GulTIeOZpxFXhk0LCYu6y/QzKckXGnKo9QnML1TabkiuU Ga7g== 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: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=8qQr+wekmXh9N7DfBn3O0HnnV1ceKlbiFOdlEnzKDtQ=; b=C9zxd785lt4CSMhlRL0zIB/E3T/ZWk1VDnIDl8BvKlA+nXgbILll+L3gG2O+jAbjlZ le65ECU0BrNyRWvuASuytJdqf6O1Bloqatfi0sB0aSG8rn38zieODvEQdhChkrUs2RFa UIcskppcoN4rQkOz5tmqN4NX19hZdlx0YWjrEC1yHCVlhXE60BfSYmykOMhuSaHQXXoz GU5ux6lpcF29eo/8aWCoiVg6pEb5AwWRUPBpxM+ZaODXWsw7fsM6fQdphJwb8wqNy0fs nN8viVdaFaqi49yW1Sdtu9bpowIwYi2Q4PBF6mEzt4ey9qMc9vc8Rz/ctke1MbTp05Pn IjEg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5330JC+C5+9BDyiC8DCEgqC4GCEIzVhJ37WYabUKivEjYIaQ1y9q PfdbCaKzCrss3xMlbAqB9dE= X-Google-Smtp-Source: ABdhPJzmU1eFzKu/7TO+Nnk2gkIMrDYUnZ1Zblpm6w4eEzHigewmespZcLPM8mhViaCQVRKwIMCyiA== X-Received: by 2002:a5d:4a02:: with SMTP id m2mr3543197wrq.332.1624354024310; Tue, 22 Jun 2021 02:27:04 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:600c:3b14:: with SMTP id m20ls10372724wms.2.gmail; Tue, 22 Jun 2021 02:27:01 -0700 (PDT) X-Received: by 2002:a1c:b403:: with SMTP id d3mr3165748wmf.79.1624354021832; Tue, 22 Jun 2021 02:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624354021; cv=none; d=google.com; s=arc-20160816; b=xJjUwD5dgLtw3m2gKFB9zZxeeY2QQ2P58Y4SQK2QjgOpd8+yOsMP9JGnv2PM4z1n4n CCbYdZJdZoGqYfxIlCsLDcE8N0oCHnseXpqQMclDIuD+141hXwTR5BiDxRsjPEBcaWpx yAtskLFmOELoGh0amoZ1s/CQHord0C0BnPkk38EPuW/dziuVMy5cNAyWsUa6WLwZfa4+ IrNSuP0h/lss5q6Sm13aqML80Ga71bQjgCgYXmpIgi5xV+foll83ftLsSm/wfdL4NNuh X8CfxzaUdzgAdb1M7t1y3UdV0Pf2APtAUAa216VDjk3KPhI59d3ZF4nHv4rVU6GfY2Gc wISA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=37wR+Hf7hJstKDa42V+TAOOrqniGN0xY9UUnw7ZANAU=; b=jAPhHrdRkajURPoPgFewh9Eq5gvGe9/9SAnP64dITzR9mfFBF8Q6XtbABD5ESy+pzB KyfKgkZnu8G1hJknD/PaWCCDQlIfmVpZoCTCF4kXLMBevoCfkRIXXRDhuaNBC1zjWKzl eKg5lspkq02EzWdXhLRzh3RrkYouHVuXd09bVMreIOKXA3iy/cRieeUE4CetWwdB3DPK GIObO78qbOqmqy43kJbaozHqlIOv2LjU34BlxD2UjTq6ueHCrON519RMHvgXPwc3tBoY /YvVG507rLY7j5q8UEW+HIAWOr3dIU/8eeinCAd84DYcpt3QBbWSkU8SvtwE3AKCzKAI 4xzA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20150623.gappssmtp.com header.s=20150623 header.b=qTHz0mo2; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::630 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org Original-Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com. [2a00:1450:4864:20::630]) by gmr-mx.google.com with ESMTPS id v4si107436wrg.2.2021.06.22.02.27.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Jun 2021 02:27:01 -0700 (PDT) Received-SPF: pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::630 as permitted sender) client-ip=2a00:1450:4864:20::630; Original-Received: by mail-ej1-x630.google.com with SMTP id hq39so6403947ejc.5 for ; Tue, 22 Jun 2021 02:27:01 -0700 (PDT) X-Received: by 2002:a17:907:1ca0:: with SMTP id nb32mr2987724ejc.105.1624354021328; Tue, 22 Jun 2021 02:27:01 -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=qTHz0mo2; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::630 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:28673 Archived-At: --0000000000006e5e8605c5576468 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks. https://github.com/jgm/pandoc/issues/7400 On Mon, 21 Jun 2021 at 23:01, John MacFarlane wrote: > > 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 shoul= d > 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 < > wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> > >> 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 scala= rs > >>>> 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 no= t > >>>> > considering it valid YAML, however unfortunate it is that Pandoc m= ay > >>>> think > >>>> > it is something else. > >>>> > > >>>> > The overview of YAML syntax on Wikipedia is quite good. Perhaps th= e > >>>> 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 > valid > >>>> table > >>>> >> > (mea culpa). > >>>> >> > > >>>> >> > So I thought aha! I'll change the terminating "---" to "..." (i= n > >>>> 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 may= be > >>>> 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 metada= ta > >>>> 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 > >>>> >> 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 fro= m > >>>> 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 > >>>> >> >> . > >>>> >> >> > >>>> >> > >>>> >> -- > >>>> >> You received this message because you are subscribed to the Googl= e > >>>> 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%40johnmac= farlane.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, > 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/CADAJKhC2g4z_H%2BK%2BVtG= oVd1T2nmYeMuRrnUquhDPpoYfuxSwWw%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/CAEe_xxj-bHpfTLDhz5QRz51= x-zcs%2BVW5dgWbmRTRaNL%2Bx6Y31Q%40mail.gmail.com > >> < > https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxj-bHpfTLDhz5QRz51= x-zcs%2BVW5dgWbmRTRaNL%2Bx6Y31Q%40mail.gmail.com?utm_medium=3Demail&utm_sou= rce=3Dfooter > > > >> . > >> > > > > -- > > 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/CADAJKhAr3Q_FR8FaubSDUxj= 692uSwAhKgdVV8mDRw5eU7HmO0g%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/m27dimg9nv.fsf%40Johns-A= ir.hsd1.ca.comcast.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 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_xxh-geLJmwn4cuYftHAVzA6UZKq9wUkE7s5hPvsUw88%3DEw%40mail= .gmail.com. --0000000000006e5e8605c5576468 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, 21 Jun 2021 = at 23:01, John MacFarlane <jgm@berke= ley.edu> wrote:

Yes, this definitely used to work.=C2=A0 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 <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org<= /a>> writes:

> It used to work.
>
> Den m=C3=A5n 21 juni 2021 15:44William Lupton <
wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
> 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
>>
>> <hr />
>>
>> <h1 id=3D"comment">comment</h1>
>>
>> <p>=E2=80=A6</p>
>>
>> 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 HTM= L
>> comment (for example), but I believe that this is valid YAML, so s= hould 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 <
wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org<= /a>>
>> wrote:
>>
>>> Thanks!
>>>
>>> On Thu, 3 Jun 2021 at 05:49, John MacFarlane <
jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote: >>>
>>>>
>>>> These are good suggestions.=C2=A0 I've revised the man= ual accordingly.
>>>>
>>>> BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>>>
>>>> > Perhaps it should be pointed out that the body of YAM= L 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
>>>> think
>>>> > it is something else.
>>>> >
>>>> > The overview of YAML syntax on Wikipedia is quite goo= d. Perhaps the
>>>> manual
>>>> > could link to (some specific version of) it.
>>>> >
>>>> > https://en.m.wikipedia.org/wiki/YAM= L#Syntax
>>>> >
>>>> > Den ons 2 juni 2021 21:21John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> skr= ev:
>>>> >
>>>> >>
>>>> >> The problem is that basically anything is valid M= arkdown,
>>>> >> it's just a matter of how it is interpreted.= =C2=A0 It does seem
>>>> >> to me that in the second case we might want to at= least emit
>>>> >> a warning -- if not downright fail.=C2=A0 It'= s just so unlikely
>>>> >> that someone would write a block beginning with `= ---`
>>>> >> and ending with `...` and intend it to be somethi= ng other
>>>> >> than YAML metadata.=C2=A0 If you'd like, you = could submit an
>>>> >> issue for this.=C2=A0 I'd rather not suggest = avoiding complex
>>>> >> YAML blocks -- sometimes they're fine, if the= syntax is
>>>> >> correct!
>>>> >>
>>>> >> William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writ= es:
>>>> >>
>>>> >> > Thanks. Yes, I guess I realised it had somet= hing 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 termin= ating "---" to "..." (in
>>>> the hope
>>>> >> > of an error), but this of course gives the o= utput 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 su= ggestion 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
>>>> >> >=C2=A0 =C2=A0changes: |
>>>> >> >=C2=A0 =C2=A0- TBD
>>>> >> > ...
>>>> >> >
>>>> >> > % pandoc bad.md
>>>> >> > <hr />
>>>> >> > <p>history: - number: Release 1.2 chan= ges: | - 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 "sim= ple 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 YA= ML blocks, and then as
>>>> >> >> tables, if either works, the parse succe= eds with no error.
>>>> >> >>
>>>> >> >> William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org= > writes:
>>>> >> >>
>>>> >> >> > Should I expect syntax errors in YA= ML blocks to be detected and
>>>> >> reported?
>>>> >> >> >
>>>> >> >> > 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/p= andoc -v
>>>> >> >> > pandoc 2.14.0.1
>>>> >> >> > ...
>>>> >> >> >
>>>> >> >> > Pandoc thinks the bad YAML is a tab= le:
>>>> >> >> >
>>>> >> >> > % ~/Downloads/pandoc-2.14.0.1/bin/p= andoc bad.md
>>>> >> >> > <table>
>>>> >> >> > <tbody>
>>>> >> >> > <tr class=3D"odd"><= br> >>>> >> >> > <td>history:</td>
>>>> >> >> > </tr>
>>>> >> >> > <tr class=3D"even">=
>>>> >> >> > <td>- number: Release 1.2<= /td>
>>>> >> >> > </tr>
>>>> >> >> > <tr class=3D"odd"><= br> >>>> >> >> > <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/p= andoc good.md
>>>> >> >> >
>>>> >> >> > Parsing the file as YAML reports th= e error:
>>>> >> >> >
>>>> >> >> > % ~/Downloads/pandoc-2.14.0.1/bin/p= andoc --metadata-file bad.md
>>>> >> >> > Error at "bad.md" (line 5= , column 0):
>>>> >> >> > Unexpected ' '
>>>> >> >> >
>>>> >> >> > % ~/Downloads/pandoc-2.14.0.1/bin/p= andoc --metadata-file good.md
>>>> >> >> > ^C
>>>> >> >> >
>>>> >> >> > --
>>>> >> >> > You received this message because y= ou 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+unsub= scribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
>>>> >> >> > To view this discussion on the web = visit
>>>> >> >>
>>>> >>
>>>> https://groups.google.com/d/msgid/pan= doc-discuss/CAEe_xxjF3Un2J-xg5UOs7uReZ5cO27TATA%2BfDY%2BAtghAsVhShA%40mail.= gmail.com
>>>> >> >> .
>>>> >> >>
>>>> >>
>>>> >> --
>>>> >> You received this message because you are subscri= bed 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@googl= egroups.com.
>>>> >> To view this discussion on the web visit
>>>> >>
>>>> https://groups.google.com/d/msgid/pandoc-discuss/m2a6o8ul91.fsf%40johnmacf= arlane.net
>>>> >> .
>>>> >>
>>>> >
>>>> > --
>>>> > You received this message because you are subscribed = to the Google
>>>> Groups "pandoc-discuss" group.
>>>> > To unsubscribe from this group and stop receiving ema= ils from it, send
>>>> an email to pandoc-discuss+unsubscribe@googlegroup= s.com.
>>>> > To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/pan= doc-discuss/CADAJKhC2g4z_H%2BK%2BVtGoVd1T2nmYeMuRrnUquhDPpoYfuxSwWw%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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.<= br> >> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-disc= uss/CAEe_xxj-bHpfTLDhz5QRz51x-zcs%2BVW5dgWbmRTRaNL%2Bx6Y31Q%40mail.gmail.co= m
>> <https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxj-bHpfTLDhz5QRz51= x-zcs%2BVW5dgWbmRTRaNL%2Bx6Y31Q%40mail.gmail.com?utm_medium=3Demail&utm= _source=3Dfooter>
>> .
>>
>
> --
> 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://grou= ps.google.com/d/msgid/pandoc-discuss/CADAJKhAr3Q_FR8FaubSDUxj692uSwAhKgdVV8= mDRw5eU7HmO0g%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 pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pando= c-discuss/m27dimg9nv.fsf%40Johns-Air.hsd1.ca.comcast.net.

--
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://group= s.google.com/d/msgid/pandoc-discuss/CAEe_xxh-geLJmwn4cuYftHAVzA6UZKq9wUkE7s= 5hPvsUw88%3DEw%40mail.gmail.com.
--0000000000006e5e8605c5576468--