From 3b3b6fa8367e0b7707b6f6393b40d933b511f668 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 25 Feb 2013 09:17:51 +0100 Subject: [PATCH] ox-ascii: Ignore empty lines between comments * lisp/ox-ascii.el (ascii): Add new filter. (org-ascii-filter-comment-spacing): New function. --- lisp/ox-ascii.el | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 874bacadb..37418c2b5 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -127,7 +127,8 @@ (lambda (a s v b) (org-ascii-export-to-ascii a s v b '(:ascii-charset utf-8)))))) :filters-alist ((:filter-headline . org-ascii-filter-headline-blank-lines) - (:filter-parse-tree . org-ascii-filter-paragraph-spacing) + (:filter-parse-tree org-ascii-filter-paragraph-spacing + org-ascii-filter-comment-spacing) (:filter-section . org-ascii-filter-headline-blank-lines)) :options-alist ((:ascii-charset nil nil org-ascii-charset))) @@ -1791,8 +1792,7 @@ TREE is the parse tree. BACK-END is the symbol specifying back-end used for export. INFO is a plist used as a communication channel. -This function only applies to `ascii' back-end. See -`org-ascii-paragraph-spacing' for information." +See `org-ascii-paragraph-spacing' for information." (when (wholenump org-ascii-paragraph-spacing) (org-element-map tree 'paragraph (lambda (p) @@ -1802,6 +1802,18 @@ This function only applies to `ascii' back-end. See p :post-blank org-ascii-paragraph-spacing))))) tree) +(defun org-ascii-filter-comment-spacing (tree backend info) + "Filter removing blank lines between comments. +TREE is the parse tree. BACK-END is the symbol specifying +back-end used for export. INFO is a plist used as +a communication channel." + (org-element-map tree '(comment comment-block) + (lambda (c) + (when (memq (org-element-type (org-export-get-next-element c info)) + '(comment comment-block)) + (org-element-put-property c :post-blank 0)))) + tree) + ;;; End-user functions -- 2.11.4.GIT