From: Eric Schulte <schulte.eric@gmail.com>
To: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: unattractive list spacing in ox-html export
Date: Mon, 23 Jun 2014 17:36:29 -0400 [thread overview]
Message-ID: <87ionrfgcb.fsf@gmail.com> (raw)
In-Reply-To: 87tx7b74ki.fsf@nicolasgoaziou.fr
[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Eric Schulte <schulte.eric@gmail.com> 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 <p> 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-inhibit-p-wraps-in-list-for-all-or-none.patch --]
[-- Type: text/x-diff, Size: 1444 bytes --]
From 9af2b1c96e2062b1501cb930a1e1f95ab8c0882e Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
Date: Mon, 23 Jun 2014 17:33:18 -0400
Subject: [PATCH 1/2] inhibit <p> wraps in list for all or none
* lisp/ox-html.el (org-html-paragraph): Extend the special case of
inhibiting <p> 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
[-- Attachment #3: Type: text/plain, Size: 90 bytes --]
--
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)
next prev parent reply other threads:[~2014-06-23 21:48 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 [this message]
2014-06-23 22:31 ` Nicolas Goaziou
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=87ionrfgcb.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).