emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] Checkbox item is broken in html export with table content [9.6


From: Ihor Radchenko
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

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 via email to

[Prev in Thread] Current Thread [Next in Thread]