public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Extra Blank Line in Native AST for RST Input with Include Directive with :code:
@ 2020-07-07  4:51 T. Kurt Bond
       [not found] ` <CAN1EhV_L54=mKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D+kAZ_KURg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: T. Kurt Bond @ 2020-07-07  4:51 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw; +Cc: CPaulBond

[-- Attachment #1: Type: text/plain, Size: 6931 bytes --]

Note

*The ``text/plain`` alternative may look … 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 need
it. Unfortunately, the automatic process that converts the text/html
alternative
into the text/plan alternative leaves blank lines before and after the file
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 end
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=elii-rst.native elii.rst
pandoc -r rst -w html --output=elii-rst.html elii.rst
pandoc -r rst -w ms --output=elii-rst.ms elii.rst
pandoc -r rst -w latex --pdf-engine=xelatex --output=elii-rst.ltx elii.rst
pandoc -r rst -w context --output=elii-rst.ctx elii.rst

(I'm only going to include the native and HTML output in this message, but
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:
------------------------------

<h1 id="extra-line-in-include-directive-output-for-html-ms-latex-and-context-output">Extra
Line in Include Directive Output for HTML, ms, LaTeX, and ConTeXt
Output</h1>
<p>Here's a <code>include</code> directive <strong>without</strong> a
<code>:code:</code> option:</p>
<p>1st line. 2nd line. 3rd line.</p>
<p>Did it have an extra line at the end? <strong>No</strong>, 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.</p>
<p>Here's a <code>include</code> directive with a <code>:code:</code>
option:</p>
<pre class=""><code>1st line.
2nd line.
3rd line.

</code></pre>
<p>Did it have an extra line at the end? <strong>Yes</strong>, in
HTML, ms, LaTeX, and ConTeXt output.</p>

------------------------------

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 with
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) because
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 *GNU
Make* to build all the various generated files.

-- 
T. Kurt Bond, tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, https://tkurtbond.github.io

-- 
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/CAN1EhV_L54%3DmKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D%2BkAZ_KURg%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 22145 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Extra Blank Line in Native AST for RST Input with Include Directive with :code:
       [not found] ` <CAN1EhV_L54=mKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D+kAZ_KURg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2020-07-07 15:07   ` Daniel Staal
  2020-07-12 20:47   ` John MacFarlane
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Staal @ 2020-07-07 15:07 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On 7/7/20 12:51 AM, T. Kurt Bond wrote:
> Note
> 
> *The ``text/plain`` alternative may look … 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 need it. Unfortunately, the 
> automatic process that converts the |text/html| alternative into the 
> |text/plan| alternative leaves blank lines before and after the file 
> contents, which is distressing since the bug I'm talking about is about 
> an extra blank line. Gmail, sometimes I hate you.
> 

As a Mac user of Pandoc, you may be interested in MailMate:
https://freron.com/

It allows you to write in Markdown, and will generate the HTML version 
based on that Markdown.

(Note that I'm not using it for this message - I keep separate email 
clients for work and home, and I find it's advanced features help my 
work email more.)

Daniel T. Staal

-- 
---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

-- 
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/0a435e67-42ce-4f88-324c-ff6663e726f7%40usa.net.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Extra Blank Line in Native AST for RST Input with Include Directive with :code:
       [not found] ` <CAN1EhV_L54=mKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D+kAZ_KURg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2020-07-07 15:07   ` Daniel Staal
@ 2020-07-12 20:47   ` John MacFarlane
       [not found]     ` <m2blkksbot.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: John MacFarlane @ 2020-07-12 20:47 UTC (permalink / raw)
  To: T. Kurt Bond, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw; +Cc: CPaulBond


I see why this is happening. In the RST reader, at line 487, we
have

  let contents' = 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" <tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Note
>
> *The ``text/plain`` alternative may look … 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 need
> it. Unfortunately, the automatic process that converts the text/html
> alternative
> into the text/plan alternative leaves blank lines before and after the file
> 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 end
> 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=elii-rst.native elii.rst
> pandoc -r rst -w html --output=elii-rst.html elii.rst
> pandoc -r rst -w ms --output=elii-rst.ms elii.rst
> pandoc -r rst -w latex --pdf-engine=xelatex --output=elii-rst.ltx elii.rst
> pandoc -r rst -w context --output=elii-rst.ctx elii.rst
>
> (I'm only going to include the native and HTML output in this message, but
> 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:
> ------------------------------
>
> <h1 id="extra-line-in-include-directive-output-for-html-ms-latex-and-context-output">Extra
> Line in Include Directive Output for HTML, ms, LaTeX, and ConTeXt
> Output</h1>
> <p>Here's a <code>include</code> directive <strong>without</strong> a
> <code>:code:</code> option:</p>
> <p>1st line. 2nd line. 3rd line.</p>
> <p>Did it have an extra line at the end? <strong>No</strong>, 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.</p>
> <p>Here's a <code>include</code> directive with a <code>:code:</code>
> option:</p>
> <pre class=""><code>1st line.
> 2nd line.
> 3rd line.
>
> </code></pre>
> <p>Did it have an extra line at the end? <strong>Yes</strong>, in
> HTML, ms, LaTeX, and ConTeXt output.</p>
>
> ------------------------------
>
> 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 with
> 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) because
> 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 *GNU
> Make* to build all the various generated files.
>
> -- 
> T. Kurt Bond, tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, https://tkurtbond.github.io
>
> -- 
> 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/CAN1EhV_L54%3DmKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D%2BkAZ_KURg%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/m2blkksbot.fsf%40johnmacfarlane.net.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Extra Blank Line in Native AST for RST Input with Include Directive with :code:
       [not found]     ` <m2blkksbot.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2020-07-12 20:48       ` John MacFarlane
       [not found]         ` <m28sfosbmr.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: John MacFarlane @ 2020-07-12 20:48 UTC (permalink / raw)
  To: T. Kurt Bond, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw; +Cc: CPaulBond


Okay, I see how to fix this and will push a fix soon.

John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:

> I see why this is happening. In the RST reader, at line 487, we
> have
>
>   let contents' = 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" <tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
>> Note
>>
>> *The ``text/plain`` alternative may look … 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 need
>> it. Unfortunately, the automatic process that converts the text/html
>> alternative
>> into the text/plan alternative leaves blank lines before and after the file
>> 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 end
>> 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=elii-rst.native elii.rst
>> pandoc -r rst -w html --output=elii-rst.html elii.rst
>> pandoc -r rst -w ms --output=elii-rst.ms elii.rst
>> pandoc -r rst -w latex --pdf-engine=xelatex --output=elii-rst.ltx elii.rst
>> pandoc -r rst -w context --output=elii-rst.ctx elii.rst
>>
>> (I'm only going to include the native and HTML output in this message, but
>> 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:
>> ------------------------------
>>
>> <h1 id="extra-line-in-include-directive-output-for-html-ms-latex-and-context-output">Extra
>> Line in Include Directive Output for HTML, ms, LaTeX, and ConTeXt
>> Output</h1>
>> <p>Here's a <code>include</code> directive <strong>without</strong> a
>> <code>:code:</code> option:</p>
>> <p>1st line. 2nd line. 3rd line.</p>
>> <p>Did it have an extra line at the end? <strong>No</strong>, 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.</p>
>> <p>Here's a <code>include</code> directive with a <code>:code:</code>
>> option:</p>
>> <pre class=""><code>1st line.
>> 2nd line.
>> 3rd line.
>>
>> </code></pre>
>> <p>Did it have an extra line at the end? <strong>Yes</strong>, in
>> HTML, ms, LaTeX, and ConTeXt output.</p>
>>
>> ------------------------------
>>
>> 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 with
>> 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) because
>> 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 *GNU
>> Make* to build all the various generated files.
>>
>> -- 
>> T. Kurt Bond, tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, https://tkurtbond.github.io
>>
>> -- 
>> 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/CAN1EhV_L54%3DmKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D%2BkAZ_KURg%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/m28sfosbmr.fsf%40johnmacfarlane.net.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Extra Blank Line in Native AST for RST Input with Include Directive with :code:
       [not found]         ` <m28sfosbmr.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2021-06-09 17:54           ` tkur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
       [not found]             ` <74b0adbe-6552-4553-98c4-f31e3afcdc31n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: tkur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org @ 2021-06-09 17:54 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 9875 bytes --]

I see that this was fixed in 
commit https://github.com/jgm/pandoc/commit/37e68a818bd0adafa4b90048eab0efc94a4980c4 
but it I noticed today that it's back.

pandoc version:
pandoc 2.14.0.1
Compiled with pandoc-types 1.22, texmath 0.12.3, skylighting 0.10.5.1,
citeproc 0.4.0.1, ipynb 0.1.0.1

OS Version: 
Mac OS X, Version 10.15.7, Build 19H1030

To reproduce, run 
pandoc -r rst -w native -o simple.native simple.rst

give the following two files (delimited by lines with equals signs)
===== simple.rst ===========================================
.. include:: three.txt
   :code:
============================================================
===== three.txt ============================================
1st line.
2nd line.
3rd line.
============================================================

That produces:
===== simple.native ========================================
[CodeBlock ("",[""],[("code","")]) "1st line.\n2nd line.\n3rd line.\n\n"]
============================================================

Notice the *two* newlines at the end.

On Sunday, July 12, 2020 at 4:48:44 PM UTC-4 John MacFarlane wrote:

>
> Okay, I see how to fix this and will push a fix soon.
>
> John MacFarlane <j...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>
> > I see why this is happening. In the RST reader, at line 487, we
> > have
> >
> > let contents' = 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" <tkur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> >
> >> Note
> >>
> >> *The ``text/plain`` alternative may look … 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 
> need
> >> it. Unfortunately, the automatic process that converts the text/html
> >> alternative
> >> into the text/plan alternative leaves blank lines before and after the 
> file
> >> 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 
> end
> >> 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=elii-rst.native elii.rst
> >> pandoc -r rst -w html --output=elii-rst.html elii.rst
> >> pandoc -r rst -w ms --output=elii-rst.ms elii.rst
> >> pandoc -r rst -w latex --pdf-engine=xelatex --output=elii-rst.ltx 
> elii.rst
> >> pandoc -r rst -w context --output=elii-rst.ctx elii.rst
> >>
> >> (I'm only going to include the native and HTML output in this message, 
> but
> >> 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:
> >> ------------------------------
> >>
> >> <h1 
> id="extra-line-in-include-directive-output-for-html-ms-latex-and-context-output">Extra
> >> Line in Include Directive Output for HTML, ms, LaTeX, and ConTeXt
> >> Output</h1>
> >> <p>Here's a <code>include</code> directive <strong>without</strong> a
> >> <code>:code:</code> option:</p>
> >> <p>1st line. 2nd line. 3rd line.</p>
> >> <p>Did it have an extra line at the end? <strong>No</strong>, 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.</p>
> >> <p>Here's a <code>include</code> directive with a <code>:code:</code>
> >> option:</p>
> >> <pre class=""><code>1st line.
> >> 2nd line.
> >> 3rd line.
> >>
> >> </code></pre>
> >> <p>Did it have an extra line at the end? <strong>Yes</strong>, in
> >> HTML, ms, LaTeX, and ConTeXt output.</p>
> >>
> >> ------------------------------
> >>
> >> 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 
> with
> >> 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) 
> because
> >> 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 
> *GNU
> >> Make* to build all the various generated files.
> >>
> >> -- 
> >> T. Kurt Bond, tkur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, https://tkurtbond.github.io
> >>
> >> -- 
> >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/CAN1EhV_L54%3DmKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D%2BkAZ_KURg%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/74b0adbe-6552-4553-98c4-f31e3afcdc31n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 14776 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Extra Blank Line in Native AST for RST Input with Include Directive with :code:
       [not found]             ` <74b0adbe-6552-4553-98c4-f31e3afcdc31n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-06-09 22:27               ` John MacFarlane
  0 siblings, 0 replies; 6+ messages in thread
From: John MacFarlane @ 2021-06-09 22:27 UTC (permalink / raw)
  To: tkur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, pandoc-discuss


If it's a regression, why don't you submit a report on our bug
tracker. This will ensure that we have a look.

"tkur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <tkurtbond-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I see that this was fixed in 
> commit https://github.com/jgm/pandoc/commit/37e68a818bd0adafa4b90048eab0efc94a4980c4 
> but it I noticed today that it's back.
>
> pandoc version:
> pandoc 2.14.0.1
> Compiled with pandoc-types 1.22, texmath 0.12.3, skylighting 0.10.5.1,
> citeproc 0.4.0.1, ipynb 0.1.0.1
>
> OS Version: 
> Mac OS X, Version 10.15.7, Build 19H1030
>
> To reproduce, run 
> pandoc -r rst -w native -o simple.native simple.rst
>
> give the following two files (delimited by lines with equals signs)
> ===== simple.rst ===========================================
> .. include:: three.txt
>    :code:
> ============================================================
> ===== three.txt ============================================
> 1st line.
> 2nd line.
> 3rd line.
> ============================================================
>
> That produces:
> ===== simple.native ========================================
> [CodeBlock ("",[""],[("code","")]) "1st line.\n2nd line.\n3rd line.\n\n"]
> ============================================================
>
> Notice the *two* newlines at the end.
>
> On Sunday, July 12, 2020 at 4:48:44 PM UTC-4 John MacFarlane wrote:
>
>>
>> Okay, I see how to fix this and will push a fix soon.
>>
>> John MacFarlane <j...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>>
>> > I see why this is happening. In the RST reader, at line 487, we
>> > have
>> >
>> > let contents' = 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" <tkur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>> >
>> >> Note
>> >>
>> >> *The ``text/plain`` alternative may look … 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 
>> need
>> >> it. Unfortunately, the automatic process that converts the text/html
>> >> alternative
>> >> into the text/plan alternative leaves blank lines before and after the 
>> file
>> >> 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 
>> end
>> >> 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=elii-rst.native elii.rst
>> >> pandoc -r rst -w html --output=elii-rst.html elii.rst
>> >> pandoc -r rst -w ms --output=elii-rst.ms elii.rst
>> >> pandoc -r rst -w latex --pdf-engine=xelatex --output=elii-rst.ltx 
>> elii.rst
>> >> pandoc -r rst -w context --output=elii-rst.ctx elii.rst
>> >>
>> >> (I'm only going to include the native and HTML output in this message, 
>> but
>> >> 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:
>> >> ------------------------------
>> >>
>> >> <h1 
>> id="extra-line-in-include-directive-output-for-html-ms-latex-and-context-output">Extra
>> >> Line in Include Directive Output for HTML, ms, LaTeX, and ConTeXt
>> >> Output</h1>
>> >> <p>Here's a <code>include</code> directive <strong>without</strong> a
>> >> <code>:code:</code> option:</p>
>> >> <p>1st line. 2nd line. 3rd line.</p>
>> >> <p>Did it have an extra line at the end? <strong>No</strong>, 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.</p>
>> >> <p>Here's a <code>include</code> directive with a <code>:code:</code>
>> >> option:</p>
>> >> <pre class=""><code>1st line.
>> >> 2nd line.
>> >> 3rd line.
>> >>
>> >> </code></pre>
>> >> <p>Did it have an extra line at the end? <strong>Yes</strong>, in
>> >> HTML, ms, LaTeX, and ConTeXt output.</p>
>> >>
>> >> ------------------------------
>> >>
>> >> 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 
>> with
>> >> 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) 
>> because
>> >> 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 
>> *GNU
>> >> Make* to build all the various generated files.
>> >>
>> >> -- 
>> >> T. Kurt Bond, tkur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, https://tkurtbond.github.io
>> >>
>> >> -- 
>> >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> >> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/CAN1EhV_L54%3DmKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D%2BkAZ_KURg%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/74b0adbe-6552-4553-98c4-f31e3afcdc31n%40googlegroups.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/m2sg1qvflc.fsf%40MacBook-Pro-2.hsd1.ca.comcast.net.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-09 22:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07  4:51 Extra Blank Line in Native AST for RST Input with Include Directive with :code: T. Kurt Bond
     [not found] ` <CAN1EhV_L54=mKnSxiNwKNoKZ2CXNe7pVXM8ZtBe_D+kAZ_KURg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-07 15:07   ` Daniel Staal
2020-07-12 20:47   ` John MacFarlane
     [not found]     ` <m2blkksbot.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2020-07-12 20:48       ` John MacFarlane
     [not found]         ` <m28sfosbmr.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2021-06-09 17:54           ` tkur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
     [not found]             ` <74b0adbe-6552-4553-98c4-f31e3afcdc31n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-06-09 22:27               ` John MacFarlane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).