Yue Yi <[email protected]> writes:

> A localized change within ox-html.el is the right path forward. For any
> descriptive items residing within a non-descriptive plain list (such as
> an unordered list), the patch manually prepends the TERM component back
> onto the item contents before handing it down to the formatter.
> ...
> In this diff patch, I have also deliberately changed the last argument passed
> to `org-html-format-list-item' from (or tag counter) to an if expression:
> (if (eq type 'descriptive) tag counter).
>
> My reasoning is that under the old or logic, when a pseudo-descriptive
> item appears within a non-descriptive list (like an unordered list), the
> extracted TERM is passed down and inadvertently becomes the id attribute
> of the <li> tag (e.g., <li id="term">). This can be quite problematic:
> ...

Agree.

> (While I believe it is somewhat absurd to handle counter syntax like
> [@num] for unordered lists, it is probably best to either preserve this
> compatibility for now or leave it for a separate discussion.)

> To better demonstrate the effect of this patch, consider the following
> examples and their exported HTML output under the old vs. new logic:
>
> - test1
> - hello :: world
>
>
> - test2
> - [@3] *Bold* :: foobar

Yes [@num] makes 0 sense in unordered lists.

> --- a/lisp/ox-html.el
> +++ b/lisp/ox-html.el
> @@ -3047,9 +3047,14 @@ contextual information."
>        (counter (org-element-property :counter item))
>        (checkbox (org-element-property :checkbox item))
>        (tag (let ((tag (org-element-property :tag item)))
> -             (and tag (org-export-data tag info)))))
> +             (and tag (org-export-data tag info))))
> +         ;; type is not descriptive but get tag
> +         (ditem-in-others (and tag (not (eq type 'descriptive))))
> +         (contents (if (not ditem-in-others) contents
> +                     (concat tag " :: " contents))))
>      (org-html-format-list-item
> -     contents type checkbox info (or tag counter))))
> +     contents type checkbox info
> +     (if (eq type 'descriptive) tag counter))))

LGTM, especially if you also add a test.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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