emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: nunnery-09-bayside@icloud.com
Cc: emacs-orgmode@gnu.org
Subject: 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/)]
Date: Sat, 31 Dec 2022 14:08:41 +0000	[thread overview]
Message-ID: <875ydracnq.fsf@localhost> (raw)
In-Reply-To: <54753EE7-FEE5-41A5-AE2F-D83D24CA2937@icloud.com>

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>


  reply	other threads:[~2022-12-31 14:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-01-01  6:33   ` Max Nikulin
2023-01-02  8:50     ` Ihor Radchenko
2023-01-04  8:17       ` Max Nikulin

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=875ydracnq.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=nunnery-09-bayside@icloud.com \
    /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.
Code repositories for project(s) associated with this public inbox

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

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 read-only IMAP folder(s) and NNTP newsgroup(s).