all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [BUG] Checkbox item is broken in html export with table content [9.6 (9.6-??-bed47b437 @ /Users/hw/.emacs.d/.local/straight/build-28.1/org/)]
@ 2022-12-28 18:12 nunnery-09-bayside
  2022-12-31 14:08 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: nunnery-09-bayside @ 2022-12-28 18:12 UTC (permalink / raw)
  To: emacs-orgmode

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

The HTML Export is a bit broken when the checkbox item has table
content. See the HTML exporting difference between section A and B in follow code. (also attached a screenshot below)

#+BEGIN_SRC org
* A
1. [ ] test
2. [ ] foo
3. [ ] bar

* B
a. [ ] foo
b. [ ] bar

   | a | b | c |
   |---+---+---|
   | 1 | 1 | 1 |
   | 2 | 2 | 2 |
#+END_SRC

Emacs  : GNU Emacs 28.1 (build 2, aarch64-apple-darwin21.6.0, NS appkit-2113.60 Version 12.5 (Build 21G72))
of 2022-08-12
Package: Org mode version 9.6 (9.6-??-bed47b437 @ /Users/hw/.emacs.d/.local/straight/build-28.1/org/)


[-- Attachment #2: Screenshot 2022-12-28 at 10.11.38 AM.png --]
[-- Type: image/png, Size: 31977 bytes --]

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

* Re: [BUG] Checkbox item is broken in html export with table content [9.6 (9.6-??-bed47b437 @ /Users/hw/.emacs.d/.local/straight/build-28.1/org/)]
  2022-12-28 18:12 [BUG] Checkbox item is broken in html export with table content [9.6 (9.6-??-bed47b437 @ /Users/hw/.emacs.d/.local/straight/build-28.1/org/)] nunnery-09-bayside
@ 2022-12-31 14:08 ` Ihor Radchenko
  2023-01-01  6:33   ` Max Nikulin
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2022-12-31 14:08 UTC (permalink / raw)
  To: nunnery-09-bayside; +Cc: emacs-orgmode

nunnery-09-bayside@icloud.com writes:

> The HTML Export is a bit broken when the checkbox item has table
> content. See the HTML exporting difference between section A and B in follow code. (also attached a screenshot below)
>
> #+BEGIN_SRC org
> * A
> 1. [ ] test
> 2. [ ] foo
> 3. [ ] bar
>
> * B
> a. [ ] foo
> b. [ ] bar
>
>    | a | b | c |
>    |---+---+---|
>    | 1 | 1 | 1 |
>    | 2 | 2 | 2 |
> #+END_SRC

Confirmed, but my HTML-foo is not good enough to understand what is
wrong.

The HTML fragment in question is

<li class="off"><code>[&#xa0;]</code> foo</li>
<li class="off"><code>[&#xa0;]</code> <p>bar</p>

  <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">

The second item is _rendered_ with a newline when paragraph is inserted.

Probably, the reason is <p> tag in the first paragraph of the item.
I am not sure, however, if it is safe to drop it.

`org-html-paragraph' only drops <p> for first paragraph in an item that
is followed by either plain string or a sub-list:

((and (eq parent-type 'item)
	   (not (org-export-get-previous-element paragraph info))
	   (let ((followers (org-export-get-next-element paragraph info 2)))
	     (and (not (cdr followers))
		  (memq (org-element-type (car followers)) '(nil plain-list)))))
      ;; First paragraph in an item has no tag if it is alone or
      ;; followed, at most, by a sub-list.
      contents)

The relevant commit is 9a34a13c:

9a34a13c077f592c5528d95c155ecdf2d655937e
Author:     Nicolas Goaziou <mail@nicolasgoaziou.fr>
AuthorDate: Tue Aug 26 09:51:20 2014 +0200
Commit:     Nicolas Goaziou <mail@nicolasgoaziou.fr>
CommitDate: Tue Aug 26 09:55:54 2014 +0200
ox-html: Better criterion for first paragraphs in lists

* lisp/ox-html.el (org-html-paragraph): Do not wrap first paragraph in
  an item within <p> tags in the most simple cases.

Thanks to Daniel Clemente for suggesting it.
http://permalink.gmane.org/gmane.emacs.orgmode/89413

The diff in the commit suggests that dropping <p> is not desirable when
non-paragraphs are present in the list. In the above example, a table is
present.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] Checkbox item is broken in html export with table content [9.6 (9.6-??-bed47b437 @ /Users/hw/.emacs.d/.local/straight/build-28.1/org/)]
  2022-12-31 14:08 ` Ihor Radchenko
@ 2023-01-01  6:33   ` Max Nikulin
  2023-01-02  8:50     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Max Nikulin @ 2023-01-01  6:33 UTC (permalink / raw)
  To: emacs-orgmode

On 31/12/2022 21:08, Ihor Radchenko wrote:
> nunnery-09-bayside writes:
> 
>> a. [ ] foo
>> b. [ ] bar
>>
>>     | a | b | c |
> 
> <li class="off"><code>[&#xa0;]</code> foo</li>
> <li class="off"><code>[&#xa0;]</code> <p>bar</p>

I would expect e.g.

     <li class="off"><p><code>[&#xa0;]</code> bar</p>

>    <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">

> Probably, the reason is <p> tag in the first paragraph of the item.
> I am not sure, however, if it is safe to drop it.

If an item contains block-level element then text paragraphs should be 
wrapped with <p>...</p>, however there is no reason to put checkboxes 
outside of first paragraphs.

> http://permalink.gmane.org/gmane.emacs.orgmode/89413

https://list.orgmode.org/87ppgg26wd.wl%25n142857@gmail.com/T/#u
HTML lists are including paragraphs (<li><p>…</p></li>)
Mon, 04 Aug 2014 11:52:34 +0700




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

* Re: [BUG] Checkbox item is broken in html export with table content [9.6 (9.6-??-bed47b437 @ /Users/hw/.emacs.d/.local/straight/build-28.1/org/)]
  2023-01-01  6:33   ` Max Nikulin
@ 2023-01-02  8:50     ` Ihor Radchenko
  2023-01-04  8:17       ` Max Nikulin
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-01-02  8:50 UTC (permalink / raw)
  To: Max Nikulin, Timothy; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> On 31/12/2022 21:08, Ihor Radchenko wrote:
>> nunnery-09-bayside writes:
>> 
>>> a. [ ] foo
>>> b. [ ] bar
>>>
>>>     | a | b | c |
>> 
>> <li class="off"><code>[&#xa0;]</code> foo</li>
>> <li class="off"><code>[&#xa0;]</code> <p>bar</p>
>
> I would expect e.g.
>
>      <li class="off"><p><code>[&#xa0;]</code> bar</p>
>
>>    <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
>
>> Probably, the reason is <p> tag in the first paragraph of the item.
>> I am not sure, however, if it is safe to drop it.
>
> If an item contains block-level element then text paragraphs should be 
> wrapped with <p>...</p>, however there is no reason to put checkboxes 
> outside of first paragraphs.

Timothy, may you take a look?
This is a bit non-trivial because paragraph is transcoded before the
containing list item. So, we may need to pair parent lookup and child
lookup in the transcoders - not ideal.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] Checkbox item is broken in html export with table content [9.6 (9.6-??-bed47b437 @ /Users/hw/.emacs.d/.local/straight/build-28.1/org/)]
  2023-01-02  8:50     ` Ihor Radchenko
@ 2023-01-04  8:17       ` Max Nikulin
  0 siblings, 0 replies; 5+ messages in thread
From: Max Nikulin @ 2023-01-04  8:17 UTC (permalink / raw)
  To: emacs-orgmode

On 02/01/2023 15:50, Ihor Radchenko wrote:
> Max Nikulin writes:
>> If an item contains block-level element then text paragraphs should be
>> wrapped with <p>...</p>, however there is no reason to put checkboxes
>> outside of first paragraphs.
> 
> Timothy, may you take a look?
> This is a bit non-trivial because paragraph is transcoded before the
> containing list item. So, we may need to pair parent lookup and child
> lookup in the transcoders - not ideal.

It seems, the only way is to prepend checkbox symbol in 
`org-html-paragraph' (unless it is a descriptive list). The function 
already has an exception for list items. The hack to get cleaner HTML 
markup becomes dirtier.




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

end of thread, other threads:[~2023-01-04  8:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-28 18:12 [BUG] Checkbox item is broken in html export with table content [9.6 (9.6-??-bed47b437 @ /Users/hw/.emacs.d/.local/straight/build-28.1/org/)] nunnery-09-bayside
2022-12-31 14:08 ` Ihor Radchenko
2023-01-01  6:33   ` Max Nikulin
2023-01-02  8:50     ` Ihor Radchenko
2023-01-04  8:17       ` Max Nikulin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.