emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: unattractive list spacing in ox-html export
Date: Tue, 24 Jun 2014 00:31:35 +0200	[thread overview]
Message-ID: <87ionr6ywo.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87ionrfgcb.fsf@gmail.com> (Eric Schulte's message of "Mon, 23 Jun 2014 17:36:29 -0400")

Eric Schulte <schulte.eric@gmail.com> 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	other threads:[~2014-06-23 22:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 20:11 unattractive list spacing in ox-html export Eric Schulte
2014-06-23 20:29 ` Nicolas Goaziou
2014-06-23 21:36   ` Eric Schulte
2014-06-23 22:31     ` Nicolas Goaziou [this message]
2014-06-24  0:09       ` Eric Schulte
2014-06-23 20:46 ` Achim Gratz
2014-06-23 21:20   ` Eric Schulte
2014-06-24 12:46     ` Achim Gratz
2014-06-24 13:24       ` Nicolas Goaziou
2014-06-25 14:43         ` Rick Frankel
2014-06-24 13:34       ` Rick Frankel
2014-06-24 13:34       ` Eric Schulte
2014-06-24 17:10         ` Achim Gratz

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=87ionr6ywo.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.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).