[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH] Special blocks: Make well-formed HTML
From: |
Christian Moe |
Subject: |
[O] [PATCH] Special blocks: Make well-formed HTML |
Date: |
Thu, 06 Oct 2011 11:53:32 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0 |
* org-special-blocks.el
(org-special-blocks-convert-html-special-cookies): Close paragraph
before opening or closing the <div>, and open paragraph after. Also
changed newline placement to be the same as for other blocks.
The problem was that special blocks did not produce well-formed HTML
because they wrapped the opening and closing
<div> tags in <p> tags.
TINYCHANGE
This patch only borrows a few lines from the handling of `CENTER'
blocks in org-export-as-html.
---
lisp/org-special-blocks.el | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/lisp/org-special-blocks.el b/lisp/org-special-blocks.el
index 2da57f0..f4e6258 100644
--- a/lisp/org-special-blocks.el
+++ b/lisp/org-special-blocks.el
@@ -78,15 +78,19 @@ seen. This is run after a few special cases are
taken care of."
(defvar line)
(defun org-special-blocks-convert-html-special-cookies ()
- "Converts the special cookies into div blocks."
- ;; Uses the dynamically-bound variable `line'.
- (when (string-match "^ORG-\\(.*\\)-\\(START\\|END\\)$" line)
-; (org-close-par-maybe)
- (message "%s" (match-string 1))
- (if (equal (match-string 2 line) "START")
- (insert "<div class=\"" (match-string 1 line) "\">\n")
- (insert "</div>\n"))
- (throw 'nextline nil)))
+"Converts the special cookies into div blocks."
+;; Uses the dynamically-bound variable `line'.
+(when (string-match "^ORG-\\(.*\\)-\\(START\\|END\\)$" line)
+ (message "%s" (match-string 1))
+ (when (equal (match-string 2 line) "START")
+ (org-close-par-maybe)
+ (insert "\n<div class=\"" (match-string 1 line) "\">")
+ (org-open-par))
+ (when (equal (match-string 2 line) "END")
+ (org-close-par-maybe)
+ (insert "\n</div>")
+ (org-open-par))
+ (throw 'nextline nil)))
(add-hook 'org-export-html-after-blockquotes-hook
'org-special-blocks-convert-html-special-cookies)
--
1.7.4.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [O] [PATCH] Special blocks: Make well-formed HTML,
Christian Moe <=