[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `info` swallows vertical space and indentation after `@image`
From: |
Gavin Smith |
Subject: |
Re: `info` swallows vertical space and indentation after `@image` |
Date: |
Sun, 25 Apr 2021 13:08:07 +0100 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
On Fri, Apr 16, 2021 at 08:46:30PM +0000, Werner LEMBERG wrote:
>
> [commit 2a15ed35d]
>
>
> Consider this example file `foo.texi`
>
> ```
> @node Top
>
> @image{test,,,foo,}
>
> bar
>
> baz
>
> @bye
> ```
>
> If processed with
>
> makeinfo `foo.texi`
>
> and viewed with `info ./foo.info` I get the following output:
>
> ```
> Up: (dir)
>
> [foo]
> bar
>
> baz
> ```
>
> I see two problems.
>
> (1) The empty line after the image is missing.
> (2) There is no indentation of `bar`. This is most likely a consequence
> of (1).
>
> For me, this looks like a bug.
I acknowledge it's a bug, at least the first point. It's related to the
fact when the document is parsed, the image is not viewed as being part
of a paragraph - it is a "top level" object within the node. If there is
extra text after the image, thus -
> @node Top
>
> @image{test,,,foo,} aaa
>
> bar
>
> baz
>
> @bye
- then there is a line added after the paragraph including the image.
The second point is not a bug because "bar" is the first paragraph in the
node so doesn't get indented.
The parse tree is like:
{
'args' => [
{
'contents' => [
{
'text' => 'image',
'parent' => {}
}
],
'type' => 'brace_command_arg',
'parent' => {}
}
],
'cmdname' => 'image',
'contents' => [],
'line_nr' => {
'line_nr' => 3,
'file_name' => 'test.texi',
'macro' => ''
},
'extra' => {
'input_perl_encoding' => 'utf-8'
},
'parent' => {}
},
{
'parent' => {},
'text' => '
'
},
{
'text' => '
',
'parent' => {},
'type' => 'empty_line'
},
{
'parent' => {},
'contents' => [
{
'text' => 'baz
',
'parent' => {}
}
],
'type' => 'paragraph'
},
After the image there is an element without a type, containing the newline
after the image. I am guessing that that newline is not output.
Looking at the code, I think a line is being added after the image by the
code in Plaintext.pm in _convert, where the comment says "First handle
empty lines", but there should have been another newline output before
this.
I haven't worked out where the extra newline should be output and it could
take me a while to do this, and I don't know if I will have time anytime
soon to work this out, so help on this would be appreciated.
Another option is to always include an image inside a paragraph, and
never have "free" images, but this would change the HTML output to
wrap <img> inside <p>, which would be disruptive and maybe not correct.