emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [ox-html, patch] More newlines around lists
@ 2017-02-14 11:32 Rasmus
  2017-02-14 12:57 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus @ 2017-02-14 11:32 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [ox-html, patch] More newlines around lists
  2017-02-14 11:32 [ox-html, patch] More newlines around lists Rasmus
@ 2017-02-14 12:57 ` Nicolas Goaziou
  2017-02-14 14:16   ` Rasmus
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2017-02-14 12:57 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hello,

Rasmus <rasmus@gmx.us> writes:

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

Thank you.

> Can I apply this or are the newlines left out on purpose?
> +		  (apply 'format "<%s class=\"org-%s\">\n"

Gotcha: #'format

LGTM.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ox-html, patch] More newlines around lists
  2017-02-14 12:57 ` Nicolas Goaziou
@ 2017-02-14 14:16   ` Rasmus
  2017-02-14 14:25     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus @ 2017-02-14 14:16 UTC (permalink / raw)
  To: emacs-orgmode

> Gotcha: #'format

Jeez...

> LGTM.

Good; I pushed the patch.

Rasmus

-- 
Human: An animal that complicates things more than strictly necessary

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ox-html, patch] More newlines around lists
  2017-02-14 14:16   ` Rasmus
@ 2017-02-14 14:25     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2017-02-14 14:25 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hello,

Rasmus <rasmus@gmx.us> writes:

> Good; I pushed the patch.

Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-14 14:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 11:32 [ox-html, patch] More newlines around lists Rasmus
2017-02-14 12:57 ` Nicolas Goaziou
2017-02-14 14:16   ` Rasmus
2017-02-14 14:25     ` Nicolas Goaziou

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).