emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [ox-html, patch] More newlines around lists


From: Rasmus
Subject: [O] [ox-html, patch] More newlines around lists
Date: Tue, 14 Feb 2017 12:32:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

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?
>From f463b0f119c30b7ac89db2981df573bb26cf38f6 Mon Sep 17 00:00:00 2001
From: Rasmus <address@hidden>
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 via email to

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