From: "Charles C. Berry" <ccberry@ucsd.edu>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] md backend needs to add blank line before some lists
Date: Sun, 2 Nov 2014 13:41:25 -0800 [thread overview]
Message-ID: <alpine.OSX.2.00.1411021321030.1632@charlessmacbook.gateway.2wire.net> (raw)
[-- Attachment #1: Type: TEXT/PLAIN, Size: 705 bytes --]
John Hendy pointed out [1] that
list
- item1
- item2
Isn't the same as this:
list
- item1
- item2
when exported using the `md' backend (or its derivatives). But it needs to
be to generate a proper document (at least with engines like pandoc.)
The attached patch enables this by adding a blank line after a
`paragraph', but before a `plain-list' as long as the `paragraph' is not
itself inside a list.
In other words, with the patch, the `md' export renders both lists with a
blank line after the preceeding paragraph.
HTH,
Chuck
p.s. I have assigned copyright to FSF as `Charles Chester Berry' on Sept
23, 2014 (RT: 945490).
Footnote [1]: http://thread.gmane.org/gmane.emacs.orgmode/92289
[-- Attachment #2: ox-md.el patch --]
[-- Type: TEXT/PLAIN, Size: 1680 bytes --]
From 8e82dbb23109e2bf13281d3f929bdddb9096d13d Mon Sep 17 00:00:00 2001
From: chasberry <ccberry@ucsd.edu>
Date: Sun, 2 Nov 2014 13:16:55 -0800
Subject: [PATCH] lisp/ox-md.el: Fix lists following paragraphs
* lisp/ox-md.el (org-md-separate-elements): Add a line after a
paragraph that preceeds a list, but is not itself contained in a
list.
Markdown needs a blank line following a paragraph to understand that
a list really is a list. However, nested lists do not need this and
adding the blank line would result in extra whitespace when
formatted for display.
---
lisp/ox-md.el | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 9625948..fd950d2 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -110,7 +110,7 @@ exceptions to this rule:
1. Preserve blank lines between sibling items in a plain list,
- 2. Outside of plain lists, preserve blank lines between
+ 2. Outside of plain lists, preserve or add blank lines between
a paragraph and a plain list,
3. In an item, remove any blank line before the very first
@@ -127,6 +127,13 @@ Assume BACKEND is `md'."
((not (eq (org-element-type (org-element-property :parent e)) 'item)))
(t (org-element-put-property
e :post-blank (if (org-export-get-previous-element e info) 1 0))))))
+ (org-element-map tree 'paragraph
+ (lambda (e)
+ (if
+ (eq (org-element-type (org-export-get-next-element e info))
+ 'plain-list)
+ (org-element-put-property e :post-blank 1)))
+ nil nil 'plain-list)
;; Return updated tree.
tree)
--
1.9.3 (Apple Git-50)
next reply other threads:[~2014-11-02 21:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-02 21:41 Charles C. Berry [this message]
2014-11-02 22:15 ` [PATCH] md backend needs to add blank line before some lists 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=alpine.OSX.2.00.1411021321030.1632@charlessmacbook.gateway.2wire.net \
--to=ccberry@ucsd.edu \
--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).