From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/25632 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: Extra Blank Line in Native AST for RST Input with Include Directive with :code: Date: Sun, 12 Jul 2020 13:48:28 -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="37135"; mail-complaints-to="usenet@ciao.gmane.io" Cc: CPaulBond To: "T. Kurt Bond" , pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBKPOVX4AKGQESPYOUZQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Jul 12 22:48:46 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-vk1-f192.google.com ([209.85.221.192]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1juitw-0009Xx-I9 for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 12 Jul 2020 22:48:44 +0200 Original-Received: by mail-vk1-f192.google.com with SMTP id j198sf1868022vkc.15 for ; Sun, 12 Jul 2020 13:48:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1594586923; cv=pass; d=google.com; s=arc-20160816; b=QhGIjyjzEd7uHDc77Yb4ru0dKJgF0j4mBB2QK8DkpKCtN878UNiQ5cMK6QXMx3h74N U8zitdiE8n6/zeMBgHGYCvVkIfUaYYqwqjqhxhAANGMUDFa68ANtT2fa5wC2XGaoQvtM 6Vi41XcWt5pTP7hTDVZkBFS2c9v1tzptoZw7nPn2UX0i7SFp4/Fs1HsP+TAllMdlBBDK NNtyfmNzXKhozzmZwbPPjE4O3niiL8S3pYRFH/4EU2fnpnb/wSw9g+f730hKQi6IY/Qv sZm/Pz+lWojpzAsE+Fbfq8iM6bieRkCvLXGhvtX0JHHGWaqkX24GXxklEol/ZkPff/gh 0vjw== 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=ULNOawLCYl2q9WdVHJoIE5WymvyZJgfsEX5XoYOK0xE=; b=qPTTYHuQrW37vP7jf4T0+Dv/isCOF2SIwOAyNSPyShXLtlyq8tuwZO0zYckyZ4OSp4 SchFl56VyHfNd0FAjbw+SQSVvaaKMluP0xQ4Is8fw/QMtQCABOAhEf8hM8puOsXEHkiR k8WLfr3el9z2clVma/Hc7KB37th+mJuGVWL3PO6DyL6/fSBEHNPy66K0G5AqxvULBpW9 iDzGY7qKvlvbvHlgQ/CAdKYa2riscl9nakRXvQ/JgjvcFEs7BftzVJ5QchkEpi7IMYBy swp5bJw1jGYxUqJGFjcJKcUfKMQ8+6Fs7QTKuGumw70PYjioTWXpLbX68gdsxmf85nud o+Jw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=BhHCFSem; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::630 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=ULNOawLCYl2q9WdVHJoIE5WymvyZJgfsEX5XoYOK0xE=; b=YyXDAJvDd7cqKcnk+/2U7FfeuKJ/r8o0Ph009d2e6z31U1vNRubI4tx8MlggvBdAYM QvNwIPhG/R3KjcLLgXSdfClfrHJu5y2nMyM930RCwIKemxtYQSvN8ej5s4lqhypA1CUU 31KGEPLJvh7dj4CGFbHhRN4C6avrYHTALgI95V+Omgn5MLrDmlsQ8Viva5hlxYpINlwA lUY5opet0qnpkQRslrZ96FpYcnYvDBqp3V4BrcNIPMIcSq0iX4iRxsQr2XpEr2I1z9jn HtuO0ikNU7NLnAf04pwkL5Zc+mtmjNrvpTkcCKNdXFNAq8Yws5uN6i3qxuKLziY5PTqg tB/Q== 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=ULNOawLCYl2q9WdVHJoIE5WymvyZJgfsEX5XoYOK0xE=; b=pEgGDwzhqwZJJNco4w2jtJXPLE6j+I4g2nP8w4IQdT250dw1Cwb4XJW6ceCD5m0fmD +nGr24g+j/zP4QuYmZQvPtHM3hI+gNy/U7hIrpjmb53nfYbSeA8Wo4S0OEZMHlDur6fg ZZVTZud7e4ikqO9qobpqyVz/N3VRrfQJLwooqOTRS2OihS9G25Mit4JufCVy4hYh9VIk iCgEmBkPDr9puvcUwkmssss2KclfyDcEJH9EOVHRtzWOEfbV9zTYRQhC+v9dZgRrgqEp pdiL32lwAlx0Hx+X7u6CHUoRrfpBVIeYnuYhX9kaa7xD8nrfk3Rk0aVWwB1XMhUOeBMP Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533m7kS3NQFGN2EV/TuSXi255MYJTuVaRpofY4/+pIMXlX0WtDNQ VyqUXCMJpOvDL9XYf0eS7bk= X-Google-Smtp-Source: ABdhPJyZ0XnyfChrJsPdOmhbcQvM85mAHIN/dusrhS+MvRsDcR1VzMnG1LrIhUKYAMCWbuxTXav0Rw== X-Received: by 2002:a1f:bf85:: with SMTP id p127mr47508963vkf.70.1594586923610; Sun, 12 Jul 2020 13:48:43 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a67:dc0f:: with SMTP id x15ls1677509vsj.3.gmail; Sun, 12 Jul 2020 13:48:41 -0700 (PDT) X-Received: by 2002:a67:d78f:: with SMTP id q15mr44767776vsj.124.1594586921244; Sun, 12 Jul 2020 13:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594586921; cv=none; d=google.com; s=arc-20160816; b=tNkyHy0dxHuGjvVrsNrWEkL3ozPwAc1LxwU/F/Qg2AiQ6UacBzot4b6qZeqB5Ser1B hPfCVShMpM59J1dFksPmnFa4M6PYtEygEo51bgb9OvBmo92WpZyihY/rAGp27c8aNvqh klANv2tS0+Buk9p7nPrwnEXdI2NLRvqW1PCTrxmBJXEQ7Y5L7OrGpviOx3xUuZK86WHD JbO7i7n9Ua0Z3/EL9dOh+wPInFfoyvzcflFUc+tn07DTZ4b843itP2/7yQc0k6Ez5rh9 4mu1OXiSZ1Zw54GSOvo+emNAe+EAes3DOClCw5b9jZp8/XuVz++qDo0SKS2y4Lwia1My 5N3Q== 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=VD6ZtDYxNaMS9gZhKTABeFsyEsuAaLErgn+kKnX2pBY=; b=I/uyNANPhnc3Gxm+vjEdpQUkXjd8jIS1nQa/icM13u4IdALP5km5OtTpjI3T38P7Lp KQwX2VV4c4+FGRwTPyjY3G3tKNzO8B22zX2DFSNlQCaeizWcHjynm6UYch3ASBMBIixW OfNuzH8B0RLjZ8reKhSu7tB5TxxVv5hGTTY1w9/VKNZXrQBz6Ihhk5PQBOv0f63z/GOc 25kmhvPCnnaJ7Zrpzqf88/M+Z7tJQFIUH3Yu3LHXKWfHPn9q5QTV2q4aU/QalTqj7ZAh Bcr5FfjxXnkPnaYXCQyL8eB2fjM3i8at3Ci1SZXhV2dSxnB74e/Yve3kabVw+p3mrcX/ 5WJQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=BhHCFSem; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::630 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com. [2607:f8b0:4864:20::630]) by gmr-mx.google.com with ESMTPS id y7si524656vko.5.2020.07.12.13.48.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Jul 2020 13:48:41 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::630 as permitted sender) client-ip=2607:f8b0:4864:20::630; Original-Received: by mail-pl1-x630.google.com with SMTP id k4so4539738pld.12 for ; Sun, 12 Jul 2020 13:48:41 -0700 (PDT) X-Received: by 2002:a17:90a:ab96:: with SMTP id n22mr16803485pjq.52.1594586920184; Sun, 12 Jul 2020 13:48:40 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id d18sm12075579pjz.11.2020.07.12.13.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 13:48:39 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id AB0B7A1ED; Sun, 12 Jul 2020 16:48:28 -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=BhHCFSem; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::630 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:25632 Archived-At: Okay, I see how to fix this and will push a fix soon. John MacFarlane writes: > I see why this is happening. In the RST reader, at line 487, we > have > > let contents' =3D T.unlines contentLines'' <> "\n" > > which will produce \n\n. I have no idea why the "\n" was added > originally. > > This was added in 8fcf66453cc4f9d1cf9413aa466477e56290d733 > > > "T. Kurt Bond" writes: > >> Note >> >> *The ``text/plain`` alternative may look =E2=80=A6 odd.* >> >> I'm trying to make this readable both as text/html e-mail and text/plain= but >> have little control over how the text/plain alternative comes out. I've >> added extra horizontal rules before the included files to make the file >> contents stand out more, even though the text/html alternative doesn't n= eed >> it. Unfortunately, the automatic process that converts the text/html >> alternative >> into the text/plan alternative leaves blank lines before and after the f= ile >> contents, which is distressing since the bug I'm talking about is about = an >> extra blank line. Gmail, sometimes I hate you. >> >> It turns out that the -w native output of an RST input file with an >> include directive >> with the :code: option shows that there is an extra blank line at the en= d >> of the CodeBlock in the AST. This causes the generated output for HTML, = ms, >> LaTeX, and ConTeXt to have extra blank lines at the ends of those code >> blocks. >> >> My Pandoc version is: >> >> pandoc 2.9.2.1 >> Compiled with pandoc-types 1.20, texmath 0.12.0.1, skylighting 0.8.3.2 >> >> My OS information is: >> >> Mac OS X, Version 10.15.4, Build 19E287 >> >> I generated the output to check with the following commands: >> >> pandoc -r rst -w native --output=3Delii-rst.native elii.rst >> pandoc -r rst -w html --output=3Delii-rst.html elii.rst >> pandoc -r rst -w ms --output=3Delii-rst.ms elii.rst >> pandoc -r rst -w latex --pdf-engine=3Dxelatex --output=3Delii-rst.ltx el= ii.rst >> pandoc -r rst -w context --output=3Delii-rst.ctx elii.rst >> >> (I'm only going to include the native and HTML output in this message, b= ut >> I did check the other output formats.) >> >> So, for the ReStructuredText input (file elii.rst): >> ------------------------------ >> >> Extra Line in Include Directive Output for HTML, ms, LaTeX, and ConTeXt = Output >> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@= @@@@@@ >> >> Here's a ``include`` directive **without** a ``:code:`` option: >> >> .. include:: three.txt >> >> Did it have an extra line at the end? **No**, in HTML, ms, LaTeX, >> and ConTeXt output. Note that this will not show up when the HTML is >> rendered as a web page, just in the HTML source itself. >> >> Here's a ``include`` directive with a ``:code:`` option: >> >> .. include:: three.txt >> :code: >> >> Did it have an extra line at the end? **Yes**, in HTML, ms, LaTeX, >> and ConTeXt output. >> >> ------------------------------ >> >> which includes a text file (three.txt) using the include directive with = a >> :code: option: >> ------------------------------ >> >> 1st line. >> 2nd line. >> 3rd line. >> >> ------------------------------ >> >> the resulting native output (elii-rst.native) is generated: >> ------------------------------ >> >> [Header 1 ("extra-line-in-include-directive-output-for-html-ms-latex-and= -context-output",[],[]) >> [Str "Extra",Space,Str "Line",Space,Str "in",Space,Str >> "Include",Space,Str "Directive",Space,Str "Output",Space,Str >> "for",Space,Str "HTML,",Space,Str "ms,",Space,Str "LaTeX,",Space,Str >> "and",Space,Str "ConTeXt",Space,Str "Output"] >> ,Para [Str "Here's",Space,Str "a",Space,Code ("",[],[]) >> "include",Space,Str "directive",Space,Strong [Str "without"],Space,Str >> "a",Space,Code ("",[],[]) ":code:",Space,Str "option:"] >> ,Para [Str "1st",Space,Str "line.",SoftBreak,Str "2nd",Space,Str >> "line.",SoftBreak,Str "3rd",Space,Str "line."] >> ,Para [Str "Did",Space,Str "it",Space,Str "have",Space,Str >> "an",Space,Str "extra",Space,Str "line",Space,Str "at",Space,Str >> "the",Space,Str "end?",Space,Strong [Str "No"],Str ",",Space,Str >> "in",Space,Str "HTML,",Space,Str "ms,",Space,Str >> "LaTeX,",SoftBreak,Str "and",Space,Str "ConTeXt",Space,Str >> "output.",Space,Str "Note",Space,Str "that",Space,Str "this",Space,Str >> "will",Space,Str "not",Space,Str "show",Space,Str "up",Space,Str >> "when",Space,Str "the",Space,Str "HTML",Space,Str "is",SoftBreak,Str >> "rendered",Space,Str "as",Space,Str "a",Space,Str "web",Space,Str >> "page,",Space,Str "just",Space,Str "in",Space,Str "the",Space,Str >> "HTML",Space,Str "source",Space,Str "itself."] >> ,Para [Str "Here's",Space,Str "a",Space,Code ("",[],[]) >> "include",Space,Str "directive",Space,Str "with",Space,Str >> "a",Space,Code ("",[],[]) ":code:",Space,Str "option:"] >> ,CodeBlock ("",[""],[]) "1st line.\n2nd line.\n3rd line.\n\n" >> ,Para [Str "Did",Space,Str "it",Space,Str "have",Space,Str >> "an",Space,Str "extra",Space,Str "line",Space,Str "at",Space,Str >> "the",Space,Str "end?",Space,Strong [Str "Yes"],Str ",",Space,Str >> "in",Space,Str "HTML,",Space,Str "ms,",Space,Str >> "LaTeX,",SoftBreak,Str "and",Space,Str "ConTeXt",Space,Str "output."]] >> >> ------------------------------ >> >> If you look at the CodeBlock element you can see it ends with \n\n. The >> original included text file ends with just one \n. >> >> The HTML output (elii-rst.html) is: >> ------------------------------ >> >>

Extra >> Line in Include Directive Output for HTML, ms, LaTeX, and ConTeXt >> Output

>>

Here's a include directive without a >> :code: option:

>>

1st line. 2nd line. 3rd line.

>>

Did it have an extra line at the end? No, in HTML, >> ms, LaTeX, and ConTeXt output. Note that this will not show up when >> the HTML is rendered as a web page, just in the HTML source >> itself.

>>

Here's a include directive with a :code: >> option:

>>
1st line.
>> 2nd line.
>> 3rd line.
>>
>> 
>>

Did it have an extra line at the end? Yes, in >> HTML, ms, LaTeX, and ConTeXt output.

>> >> ------------------------------ >> >> I've checked and HTML, ms, LaTeX, and ConTeXt output all have these blan= k >> lines at the end of generated text for those code blocks. >> ------------------------------ >> >> *Note:* This message was written as RST input with include directives wi= th >> the :code: option but does not have the extra blank lines at the ends of >> the included code (at least in the text/html alternative, see the note >> about the text/plain alternative at the beginning of this message) becau= se >> I preprocessed it with >> >> pandoc -s -r rst -w rst -o elii-email.rst elii-email-in.rst >> >> which converted the include directives with the :code: option to >> inline code directives, >> which don't the extra lines at the end. Very useful workaround. I use *G= NU >> Make* to build all the various generated files. >> >> --=20 >> T. Kurt Bond, tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, https://tkurtbond.github.io >> >> --=20 >> 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/msg= id/pandoc-discuss/CAN1EhV_L54%3DmKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D%2BkAZ_KURg%4= 0mail.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/m28sfosbmr.fsf%40johnmacfarlane.net.