emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: [ox-html, patch] More newlines around lists
Date: Tue, 14 Feb 2017 12:32:34 +0100	[thread overview]
Message-ID: <87a89pnh2l.fsf@gmx.us> (raw)

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

Hi,

This patch inserts more newlines around lists, and thus makes the source a
bit more readable (IMO).  It's an almost purely cosmetic change.

Can I apply this or are the newlines left out on purpose?

Rasmus

-- 
Hvor meget poesi tror De kommer ud af et glas isvand?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html-More-newlines-around-lists.patch --]
[-- Type: text/x-diff, Size: 2659 bytes --]

From f463b0f119c30b7ac89db2981df573bb26cf38f6 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Tue, 14 Feb 2017 12:03:16 +0100
Subject: [PATCH] ox-html: More newlines around lists

* lisp/ox-html.el (org-html-headline):
(org-html-format-list-item):
(org-html-section): Insert more newlines.
---
 lisp/ox-html.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index bb29d4a35..231fd41fc 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2560,16 +2560,16 @@ holding contextual information."
           (let* ((html-type (if numberedp "ol" "ul")))
 	    (concat
 	     (and (org-export-first-sibling-p headline info)
-		  (apply 'format "<%s class=\"org-%s\">"
+		  (apply 'format "<%s class=\"org-%s\">\n"
 			 (make-list 2 html-type)))
 	     (org-html-format-list-item
                    contents (if numberedp 'ordered 'unordered)
 		   nil info nil
                    (concat (org-html--anchor preferred-id nil nil info)
                            extra-ids
-                           full-text))
+                           full-text)) "\n"
 	     (and (org-export-last-sibling-p headline info)
-		  (format "</%s>" html-type))))
+		  (format "</%s>\n" html-type))))
 	;; Standard headline.  Export it as a section.
         (let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline))
               (first-content (car (org-element-contents headline))))
@@ -2696,7 +2696,8 @@ INFO is a plist holding contextual information.  See
 			   (symbol-name checkbox)) ""))
 	(checkbox (concat (org-html-checkbox checkbox info)
 			  (and checkbox " ")))
-	(br (org-html-close-tag "br" nil info)))
+	(br (org-html-close-tag "br" nil info))
+	(extra-newline (if (and (org-string-nw-p contents) headline) "\n" "")))
     (concat
      (pcase type
        (`ordered
@@ -2719,7 +2720,9 @@ INFO is a plist holding contextual information.  See
 			  class (concat checkbox term))
 		  "<dd>"))))
      (unless (eq type 'descriptive) checkbox)
-     (and contents (org-trim contents))
+     extra-newline
+     (and (org-string-nw-p contents) (org-trim contents))
+     extra-newline
      (pcase type
        (`ordered "</li>")
        (`unordered "</li>")
@@ -3266,7 +3269,7 @@ holding contextual information."
 		    #'number-to-string
 		    (org-export-get-headline-number parent info) "-"))))
         ;; Build return value.
-	(format "<div class=\"outline-text-%d\" id=\"text-%s\">\n%s</div>"
+	(format "<div class=\"outline-text-%d\" id=\"text-%s\">\n%s</div>\n"
 		class-num
 		(or (org-element-property :CUSTOM_ID parent)
 		    section-number
-- 
2.11.1


             reply	other threads:[~2017-02-14 11:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 11:32 Rasmus [this message]
2017-02-14 12:57 ` [ox-html, patch] More newlines around lists Nicolas Goaziou
2017-02-14 14:16   ` Rasmus
2017-02-14 14:25     ` Nicolas Goaziou

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=87a89pnh2l.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --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).