From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28525 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 13:20:10 -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="19933"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pandoc-discuss To: William Lupton Original-X-From: pandoc-discuss+bncBCJZJHG45QDBB55T36CQMGQEBURAONQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jun 02 21:20:27 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pl1-f185.google.com ([209.85.214.185]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1loWPi-0004wU-T2 for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 02 Jun 2021 21:20:26 +0200 Original-Received: by mail-pl1-f185.google.com with SMTP id 62-20020a1709020544b02900f0a8e26363sf1515047plf.5 for ; Wed, 02 Jun 2021 12:20:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1622661625; cv=pass; d=google.com; s=arc-20160816; b=NyoKg1/o0FtvmofB+FMPIGEMrFldq/SZfAus70H1TwZhLvN07bTnbmd0N43JVcjs1a FC63Fc0ygGzwMc7yHrliTsJo5NrQSf8xXt3bNSTODkXkE5fm4bQSvaco2IssdCXAvYCR Fag0VLdX+BNsRnZEuEe01qZfiBR75+5T2kD+wA9zkhkO0evTto//EgZizwYfot9Jr0fz hincsBqV1FavzpNOvT6JZELwpQ8aiCigyv3aA+kPR82WPY/bZ0+uRUtfuvPuOSYXNOLD mjjHA6a/mwSnju+bwwMzfSkoP+Lr0m/V3Z9oMkS22RWZL6zs2VNBGDsMwfrwdSSQ126u lWHw== 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=ZcTqRJVanxcZvxcpTsBsrW6AjIMiF/XqIoH+2rr6uqs=; b=rLCqmhjJthO1Kfp+/anYq5pnXpPoxN6eP8dS5oqUd7PC3wVQdn6Ix3hQ/7Jux+E+2j GiyU8cVyBx1BAEQ1FXENbmDH404ZgK7EYrB62wCBmPiItN+dYl+ACsZdC9pX5Blz1+LM Cg528cZujsB1fWAgeuSYu1PjmGKky1ck0ycIZrKruqL4Wo6Qd/o2QdWszkt5utjhFkVb hzg/r3VpeE/eLMB9v97s28x9X7Jd7hc8NB+qoqNnRCnvLUjPQufoVPKcbcPUi/5WmUdI bWMhwbl+gZm/jSygnoyCK6a4WkzygQ35cCk+/5WFDrPfJWg54zDxIiL/BHv/RhJf3Jg/ DHVA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=MSSKy30O; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::636 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=ZcTqRJVanxcZvxcpTsBsrW6AjIMiF/XqIoH+2rr6uqs=; b=EhzV+eycm3P3KfK6LDD62eo/1RMX1oTyWIVmBfX1/xWwHmOCohuoydXyd80Efi/4vS lCRbGjRYgb+pDG29a8A77NTCrfSuHkAcXZ74bAbSnP9Fgy+mhApkUBDUcJtHZZ/bKpI5 NUarYKJozUmQhexN27GMlzuWOGVNfFZoc/r/5u+wh39kPKZcOlcPsk5R28ppIJQTEonK NCwTCUSU8nFhEZ4skHqcUPj5GMWt4kIlv46svBRNv0IewMHkx7Kud725Um5WfNO9fx66 lrxEHLXh+jZgtPhR2YZgri9dAAeZ+Y3x03kIXTPQOoMeC/U5KKIwcEaHWeW+QWFnGZmu wT/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=ZcTqRJVanxcZvxcpTsBsrW6AjIMiF/XqIoH+2rr6uqs=; b=Bfu6iIFJ880/n4+TU8w9WkYImhNfm6m/Efe9l1X4VPUaeqI/RDVpi+Xo7dtCL0pxyC PYhsPt8dTWPvdH90f/eOvbwhPNA8fAavNnhdJRGF79S/Ovp8+oZd6mhCK+gRm9mWcMWi rCOfwbizC+49lTmj+3eruWQ79phiWpOSmUgl2WQFADP2C4M/9YfwnDu9CUpyhZNlx4ay 9qa2RGJgrmfcR9r22lWhB/AYmdFsi0jsU9vMH3wvRRuOm410qRE+cKO6c1aOWGQHbkAA xx12KwJxlNB+D1Bepfu5O/aMdVsinknPgUeDefPQUuTWGDDbP+syfEp207EGfDfezGaH Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531TDAKMJdkXeeIokKZHgrJGgogDLtfHtj+AT596pauEdwmozR2A /fFtAM4v/uy5IrVI/x2aw/k= X-Google-Smtp-Source: ABdhPJyOiKN4vAAzhVRy36NPgT/2yVLB2S6pqrIDTpslB2KxfAnTdLDk7iW5mF0S8kSnxT5h1y6/+Q== X-Received: by 2002:a63:521a:: with SMTP id g26mr35817362pgb.279.1622661625294; Wed, 02 Jun 2021 12:20:25 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a17:90a:2848:: with SMTP id p8ls1563091pjf.0.canary-gmail; Wed, 02 Jun 2021 12:20:23 -0700 (PDT) X-Received: by 2002:a17:902:8307:b029:103:c733:e5e0 with SMTP id bd7-20020a1709028307b0290103c733e5e0mr19445144plb.8.1622661623123; Wed, 02 Jun 2021 12:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622661623; cv=none; d=google.com; s=arc-20160816; b=F8T/9lyxZdSmAJPDzV8qiK9QtHayQdWHKwVfuIRAR38zvUIRkw6HOXTORJzLmsms36 NT/1vorro70I1Mt+4tAJA0Oj+q1vH4KXGu60SgmH3Rz2cAIoBbeOrOjlDbJGOowORJCt dML6bq7Pz3wkxoRqzoB3s7RGkHww0nOWFf+bEqQEdf5kvlYLmKGd+KKpXxOhQtN2yvBq fr8vBbrst7MHVXbm2ISG8Q5KnfRo4wnUvtlCNnD1sXw7QVQ1Fh3rbulMp11E8hR//36q 0L41XaaCGXrFo4C9Cr8B3ghMAtI5RA6ZVSi1NOSZGE6aYIXRVRbKPrdp+d774C6Uudvw iP3A== 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=ikowj2TUUEZM5wIYf5VB2YGpRFf4rwopCb46L2gzpKM=; b=iPurv4dytVbCgz7Z+idDCyng1YBM+IL1UBtJBT2rn+H63TKCn1MyTJUsogL8J3fBur NCrPFUeiltlz8Wr4WJ9pJvGZ6YTsRFakQvqKQighneX3sT2VRriz+GI8sv5iTcR6fOBF LnaVcH42+QuAjzFYuwA6mVtm2125ewC4kzOAB0S2NCoatU/nvmCNy3UBxTfiHga6ym/K JDGU2eIfvG2MlvZ8UXJUkMbpxfZzswUZpINp2VEWxC90fHczghjA5vHvzjfN63WD+whq vLBigjm0SAig1qX9jlcoWXFJbyAgUpqGzqBTSrnPmqs27FiqAP1XlYKKs/mE3tSDO2Ul oY/A== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=MSSKy30O; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::636 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com. [2607:f8b0:4864:20::636]) by gmr-mx.google.com with ESMTPS id b24si83979pfd.3.2021.06.02.12.20.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Jun 2021 12:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::636 as permitted sender) client-ip=2607:f8b0:4864:20::636; Original-Received: by mail-pl1-x636.google.com with SMTP id x10so1617341plg.3 for ; Wed, 02 Jun 2021 12:20:23 -0700 (PDT) X-Received: by 2002:a17:90b:1094:: with SMTP id gj20mr22810579pjb.45.1622661622464; Wed, 02 Jun 2021 12:20:22 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id t20sm231297pjs.11.2021.06.02.12.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 12:20:21 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id D5079A23E; Wed, 2 Jun 2021 15:20:10 -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=MSSKy30O; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::636 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:28525 Archived-At: 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 "..." (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 i= s > 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 report= ed? >> > >> > 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-xg5UOs7u= ReZ5cO27TATA%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/m2a6o8ul91.fsf%40johnmacfarlane.net.