From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: unattractive list spacing in ox-html export Date: Mon, 23 Jun 2014 17:36:29 -0400 Message-ID: <87ionrfgcb.fsf@gmail.com> References: <87tx7bgzdy.fsf@gmail.com> <87tx7b74ki.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzC6R-0001Ys-TD for emacs-orgmode@gnu.org; Mon, 23 Jun 2014 17:48:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzC6N-0002mq-Ee for emacs-orgmode@gnu.org; Mon, 23 Jun 2014 17:48:39 -0400 Received: from mail-qa0-x230.google.com ([2607:f8b0:400d:c00::230]:41093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzC6N-0002mh-At for emacs-orgmode@gnu.org; Mon, 23 Jun 2014 17:48:35 -0400 Received: by mail-qa0-f48.google.com with SMTP id x12so6229645qac.35 for ; Mon, 23 Jun 2014 14:48:34 -0700 (PDT) Received: from bagel (pool-74-111-105-28.pitbpa.fios.verizon.net. [74.111.105.28]) by mx.google.com with ESMTPSA id v10sm25009262qaj.25.2014.06.23.14.48.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jun 2014 14:48:33 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode Mailing List --=-=-= Content-Type: text/plain Nicolas Goaziou writes: > Hello, > > Eric Schulte writes: > >> When the lists with spaces in some (but not all) elements are exported >> to HTML, they result in unattractive spacing. This is due to the use of >> paragraph tags in some list elements, which cause large spaces between >> some list elements but no spaces between others. >> >> I believe something should be done to ensure consistent spacing in the >> HTML export of list elements. I'd suggest that every list element >> should be wrapped in a paragraph tag, but maybe a different solution is >> more appropriate. > > Actually, there's a special case in ox-html.el (see line 2960) that > prevents the first paragraph in an item to get

tag. I guess that > this rule is meant for short lists, e.g., > > - item 1 > - item 2 > > where you do not want a new paragraph for each item. So, the special > case could be extended to also check if there's another element in the > item before ignoring the tags. > This sounds like the best approach. The attached patch implements this change, if it looks good I'll go ahead and apply it to master. Thanks, Eric --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-inhibit-p-wraps-in-list-for-all-or-none.patch >From 9af2b1c96e2062b1501cb930a1e1f95ab8c0882e Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 23 Jun 2014 17:33:18 -0400 Subject: [PATCH 1/2] inhibit

wraps in list for all or none * lisp/ox-html.el (org-html-paragraph): Extend the special case of inhibiting

wrappers to only perform such inhibition when *every* element of the list is a single element long. Otherwise unsightly spacing results. --- lisp/ox-html.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 762e1dc..d95ce79 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2956,7 +2956,17 @@ the plist used as a communication channel." (cond ((and (eq (org-element-type parent) 'item) (= (org-element-property :begin paragraph) - (org-element-property :contents-begin parent))) + (org-element-property :contents-begin parent)) + ;; every subsequent list element is a single element long + (let ((gp (org-export-get-parent parent)) + (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) + all-singles)) ;; Leading paragraph in a list item have no tags. contents) ((org-html-standalone-image-p paragraph info) -- 2.0.0 --=-=-= Content-Type: text/plain -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D (see https://u.fsf.org/yw) --=-=-=--