emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] unattractive list spacing in ox-html export


From: Nicolas Goaziou
Subject: Re: [O] unattractive list spacing in ox-html export
Date: Tue, 24 Jun 2014 00:31:35 +0200

Eric Schulte <address@hidden> writes:

> +        ;; every subsequent list element is a single element long

You need to start with a capital and a final period.

Also, it could be merged with the comment below. E.g., "Paragraphs have
no tag when any item in current list is either empty or consist of
a single paragraph."

> +        (let ((gp (org-export-get-parent parent))

Since you only use it once, you don't need to bind it. Just use it in
`org-element-map':

  (org-element-map (org-export-get-parent parent) 'item ...)

> +              (all-singles t))
> +          (org-element-map gp 'item
> +            (lambda (object)
> +              (let ((num-children (length (org-element-contents object))))
> +                (unless (= 1 num-children)
> +                  (setq all-singles nil))))
> +            info nil 'item)

This is not sufficient, as an item could contain a single center block
with many paragraphs within. IOW you also need to check the type of the
single element. We also need to accept empty items.

Moreover, the item could contain another element not exported (i.e.
a comment), but I guess that would go a bit too far.

Also, note that `org-element-map' has a mechanism to exit early
(argument FIRST-MATCH), so you can avoid mapping over all items if you
already know that one of them doesn't contain a single paragraph.

I think the following should do the job:

  (not (org-element-map (org-export-get-parent parent) 'item
         (lambda (item)
           (let ((contents (org-element-contents item)))
             (and contents
                  (or (cdr contents)
                      (not (eq (org-element-type (car contents)) 
'paragraph))))))
         info 'first-match 'item))

>        ;; Leading paragraph in a list item have no tags.

See above.


Regards,

-- 
Nicolas Goaziou



reply via email to

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