public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Nested tables: HTML writer bug?
Date: Fri, 22 Jul 2022 13:16:07 +0200	[thread overview]
Message-ID: <8576E560-B7B5-49B5-9DDC-87EF9AC48F81@gmail.com> (raw)
In-Reply-To: <CAEe_xxg174vpMGdEwzx-USMNPPodVOC0LqVCx9SEGxpGA7pDiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

The `width: 44%` comes in because the nested table is 44% of the overall column width.

Browsers then interpret this as 44% of the containing cell, I guess, which is why you get the odd output.

I don't see a good solution here.  The problem is that 44% will be interpreted relative to line length in other formats (e.g. Markdown, LaTeX), so we don't want to change the markdown reader so that it assigns this embedded table a higher relative width.  Nor is it clear how we'd change the HTML writer to interpret this width differently.  I suppose we could keep track of the width of the containing cell and recompute based on that.  You can submit a bug report if you like.

> On Jul 22, 2022, at 1:00 PM, William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> wrote:
> 
> All,
> 
> [Forked from https://groups.google.com/g/pandoc-discuss/c/5O6iYmUwFJ8/m/biiwj2njAAAJ]
> 
> In the above thread I presented the grid.md example shown at the bottom of this message. I also couldn't resist trying another level of nesting, resulting in the grid2.md example shown below. This works, but I'm wondering whether there's a bug (in the HTML writer) relating to how nested grid table widths are calculated:
> 	• pandoc -s grid2.md -o grid2.html gives the first image shown below the markdown, in which the nested grid table has a scroll bar
> 	• The table and column widths are as shown immediately below and I'm wondering where the width:44% came from. Removing it gives the second image below the markdown (no scroll bar)
> I'm not seriously suggesting actually using a text editor to create deeply nested tables such as these... but given that it works I wanted to understand what was going on with the table width calculation.
> 
> Thanks,
> William
> 
> % xmllint -format grid2.html | egrep -e '<(\/?table|col )'
>     <table style="width:79%;">
>         <col style="width: 18%"/>
>         <col style="width: 11%"/>
>         <col style="width: 50%"/>
>             <table style="width:44%;">
>                 <col style="width: 18%"/>
>                 <col style="width: 26%"/>
>                     <table>
>                     </table>
>             </table>
>     </table>
> 
> grid2.md
> 
> +------------+-------+-----------------------------------+
> | Fruit      | Price | Advantages                        |
> +============+=======+===================================+
> | Bananas    | $1.34 | - built-in wrapper                |
> |            |       | - bright color                    |
> +------------+-------+-----------------------------------+
> | Oranges    | $2.10 | - cures scurvy                    |
> |            |       | - tasty                           |
> +------------+-------+-----------------------------------+
> | Apple (pi) | $3.14 | +------------+------------------+ |
> |            |       | | One        | Two              | |
> |            |       | +============+==================+ |
> |            |       | | my         | table            | |
> |            |       | +------------+------------------+ |
> |            |       | | is         | | Three | Four | | |
> |            |       | |            | |-------+------| | |
> |            |       | |            | | very  | nice | | |
> |            |       | +------------+------------------+ |
> +------------+-------+-----------------------------------+
> 
> <Screenshot 2022-07-22 at 11.46.56.png>
> 
> <Screenshot 2022-07-22 at 11.57.56.png>
> 
> grid.md
> 
> +---------------+---------------+--------------------+
> | Fruit         | Price         | Advantages         |
> +===============+===============+====================+
> | Bananas       | $1.34         | - built-in wrapper |
> |               |               | - bright color     |
> +---------------+---------------+--------------------+
> | Oranges       | $2.10         | - cures scurvy     |
> |               |               | - tasty            |
> +---------------+---------------+--------------------+
> | Apple (pi)    | $3.14         | | One | Two   |    |
> |               |               | |-----+-------|    |
> |               |               | | my  | table |    |
> |               |               | | is  | nice  |    |
> +---------------+---------------+--------------------+
> 
> <Screenshot 2022-07-20 at 23.36.36.png>
> 
> -- 
> 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_xxg174vpMGdEwzx-USMNPPodVOC0LqVCx9SEGxpGA7pDiA%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/8576E560-B7B5-49B5-9DDC-87EF9AC48F81%40gmail.com.


  parent reply	other threads:[~2022-07-22 11:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 11:00 William Lupton
     [not found] ` <CAEe_xxg174vpMGdEwzx-USMNPPodVOC0LqVCx9SEGxpGA7pDiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-22 11:16   ` John MacFarlane [this message]
     [not found]     ` <8576E560-B7B5-49B5-9DDC-87EF9AC48F81-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-07-22 11:55       ` William Lupton
     [not found]         ` <CAEe_xxiXYY7V5J5t0HEc1tNrdTuHhXhny2rizBw=RsY-1dEFqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-23 21:24           ` EBkysko
     [not found]             ` <1e1779ab-afde-43e0-8c07-ffa63125e07en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-07-24 12:00               ` William Lupton
     [not found]                 ` <CAEe_xxgpYb4c4JnkpZFZHq-ogsEw2n-C2rkjNMxs9VGz9+DjFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-24 18:16                   ` EBkysko
     [not found]                     ` <4137c27d-9458-47d4-8a81-af1002db785an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-07-25 16:44                       ` William Lupton
     [not found]                         ` <CAEe_xxj=LxGTmE+Y5rum7+6JQ7PmfFhRcgP4ppo-gH_=pyT78g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-25 17:52                           ` John MacFarlane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8576E560-B7B5-49B5-9DDC-87EF9AC48F81@gmail.com \
    --to=fiddlosopher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).