From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/25631 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:47:14 -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="32293"; mail-complaints-to="usenet@ciao.gmane.io" Cc: CPaulBond To: "T. Kurt Bond" , pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBX7NVX4AKGQED2W2PPY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Jul 12 22:47:31 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pf1-f185.google.com ([209.85.210.185]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1juisk-0008Ea-PH for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 12 Jul 2020 22:47:30 +0200 Original-Received: by mail-pf1-f185.google.com with SMTP id o5sf7790275pfg.10 for ; Sun, 12 Jul 2020 13:47:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1594586849; cv=pass; d=google.com; s=arc-20160816; b=MEadH0fqKo+UCNh665llkxlQwBqOSzxFMDb8WQ9KPnfN5dPU4EwUisUuWA3AALPQWT XKt3N7xBBMiO2Do6DfHklX90Rysvp3BMYjq5cQT+7egnozsaoGxMwillHAAGl4yZwkXu XDD1o03F+3nhxAm0ijq1bB3UBDEsydzAunUEsQoqKjAROhh6T+m+k9lwIRhPabZYVfT5 Oo0kgmjDONkM0HJBtjO3z0xHEG1r2GIF86j+NsjJTJPOsTPnHlG6KkAby/0Fc6MfucFr igZEdBcHV+RgK7ubiD68CQvtMuiADpKpKN5obWuHTT0OeXNXm0y2EmFa3qs+kbQ6W4xM 4Vyw== 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=+r+Y4YN6/3kAYiDIFLjKRysIgzHRqGtCnQqmENCHTso=; b=MTj0YlGOEKlK0Eh5DrpSo8isQy6U2WulYBxBni+6bXvI68zn9umcI5uZ/so8PNavTu u9ecB5GR24ZlxaXhstm6+4Vs1a5uWGI7PNuLFnMh9e23zxfffu1HVrh9E86euLBOAR3q a7pQmDap4UkjIFs/jplPmN2l4CVwr7+RnlxdqqWiO+Wemd5ZSeGIneUf0kYhhWKPXGCR xvMMnQIgUKZMtFPcBb6kEaRw0FAHzBQvl8vLC4JAEH3Jy3m2XkJQnbrW3NDCB1grn4no O6yzqCLJ96JVljHMJKgdUiTvC81TXYUcBfI0W/+7YXIhg6saeCUEnnGrRLtLfL/S15y0 SOcw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=TLhjsPft; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::434 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=+r+Y4YN6/3kAYiDIFLjKRysIgzHRqGtCnQqmENCHTso=; b=qT/v9LjkJFn2yaZXElQ4PniTHslfEF99YDgaRKynawY7j5M2J+pVBqOhCxX8oCZZUz iSoWL0HweSUyrtg4X3Ksm3Qcyr9IgnQgYUwa4XMaQHO/KK+UqcjKirjLsBdEOXsJbM5h TjcEKYjV7M5VmBrIzOx1hWF5rzpsoG3rVeFeW7Slif9smXir7AgTFDNDJ8z7Gq0GNJZ4 LFo8GWBnIE+nxkOOAHke8SfGCFkGJc5OFmEH4jk6uzbBVggYTa8lJZm352HcqXv0Jmep LuIe6UXVTiDxLOfIpTF1vtRMehlkDHZq0aADsntuAiA6Foot97zSVj3M2r8c9Lwab/tC lTjg== 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=+r+Y4YN6/3kAYiDIFLjKRysIgzHRqGtCnQqmENCHTso=; b=RUL+CihBJcSWK4ImKOAEW835lIqIkyUjUG+QE3Rtub6IOMvkdKeyvI+mKPDUkM1S/l m2vRpGxIm0Gk5QUzILSyhrNVbc5l9Wz4WQ2MLVL5o7Qrqg3VOrH5XEp31SkmOO7kRqsd xUgR/JbSWz76dan88WEeu5enb8AT9EcW1ibgoSLdV6d5QGN2kAGhQ2EG+HGKi3DKH50Q cIxwwFKZgwk3qjbst2COELlDRRdobpFdkfN1ryE+tPKRQzHgKq5GPRqK6bvwrmYq85fS D8GMvoHMtFrdMOj4Cz3+NYSpU85ZaDIQmGcZsq7t4tfY5uLuUcDL2auHKBkGGEtnKe/s Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533YqvAgiN0d94CZQBrLb067Ulo7atoqnKitFZzxBVBy+R0GzlEb VpHAPQuc84HSYHemV8LqcKA= X-Google-Smtp-Source: ABdhPJy7sw89DBrBXEduIVmN/YVlF5z00Zcn0inmOMNuMu2lQKpLM5gMHSWl2x15Av7AtnkrVxpmEA== X-Received: by 2002:a63:be4e:: with SMTP id g14mr67121927pgo.193.1594586849573; Sun, 12 Jul 2020 13:47:29 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a63:730d:: with SMTP id o13ls4118272pgc.1.gmail; Sun, 12 Jul 2020 13:47:26 -0700 (PDT) X-Received: by 2002:a62:7b0d:: with SMTP id w13mr59940887pfc.82.1594586846549; Sun, 12 Jul 2020 13:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594586846; cv=none; d=google.com; s=arc-20160816; b=QgmCcz4YprsxhTwJFg9Sq/bBcn+zqMsP9Jx8R39eu+Oclp70Imy5TL0ncASKkAsZJ8 cD/SV19GwCg6Q6FkG+CJyLxV09RsKlH1rYbPhnw6bCM1l2w36FujDNV5DLxVo+feF0wn h1FRx1mvN5pRnItgzBjDDVqOCeiJGAVct+4IbywwJ28UIM7LoGL1dhyRNbQrXB0nbKqW DGSoAQPqPm9dgveu7R9RDiZeb9A6qTD1WTzBhnQrYZBeg9IOFTH4Ml/5VxveIHsdJqTK WPRJUQQrcM7w/97SnWSfaYVrZSd//PqPydoAfjeKy4eHZ/LZbrCFW5eqwtrxE91bWrc+ 42mw== 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=7Osz1OKFsaCsltWlksXsm3SZKFeOihlGPqW2d+vwiEQ=; b=zATQeaiB9CKlX76lE7c5FwlqsMHMEB39pqeIFH5XOKl47OPHR4NvY1vXkP7Nnll8mb hcSCc0eBSXcxB4pdjyf9WOuy01rGuus6ozFYZzqH74Cnox48X6XjbDszegWAIElOfxeo 7cC/WssUNfyKMIOjchefD5zOZ9J+XI0V2776l+/BLt64F9K9GlIT9vQhf3GCzGSwoi7a eA6QDQURx7dC4h3Tb0qeHOjwIbrhZSATHqvmhaAmUEVx6kKKT1PdEl+P4HeG6aIMrozW Vzj4mhFjyCjM8QpVM8UTxB2O4u/icwMla9zikqvk06TWpU+balVTVsv5Eh/xcDmU/44p qbwA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=TLhjsPft; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::434 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com. [2607:f8b0:4864:20::434]) by gmr-mx.google.com with ESMTPS id q13si602956pfc.6.2020.07.12.13.47.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Jul 2020 13:47:26 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::434 as permitted sender) client-ip=2607:f8b0:4864:20::434; Original-Received: by mail-pf1-x434.google.com with SMTP id 1so5037288pfn.9 for ; Sun, 12 Jul 2020 13:47:26 -0700 (PDT) X-Received: by 2002:aa7:8edc:: with SMTP id b28mr60899350pfr.230.1594586845879; Sun, 12 Jul 2020 13:47:25 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id t5sm11533976pgl.38.2020.07.12.13.47.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 13:47:25 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 72E37A1ED; Sun, 12 Jul 2020 16:47:14 -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=TLhjsPft; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::434 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:25631 Archived-At: 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 ne= ed > it. Unfortunately, the automatic process that converts the text/html > alternative > into the text/plan alternative leaves blank lines before and after the fi= le > contents, which is distressing since the bug I'm talking about is about a= n > 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 end > of the CodeBlock in the AST. This causes the generated output for HTML, m= s, > 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 eli= i.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, bu= t > 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 O= utput > @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@= @@@@@ > > 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 blank > lines at the end of generated text for those code blocks. > ------------------------------ > > *Note:* This message was written as RST input with include directives wit= h > 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) becaus= e > 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 *GN= U > 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 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/CAN1EhV_L54%3DmKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D%2BkAZ_KURg%40= mail.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/m2blkksbot.fsf%40johnmacfarlane.net.