فهرست منبع

Export: Improve centering, verse, and blockquote export

In verse environments, line breaks are now enforced both in LaTeX and
in HTML.  Centering is now implemented using a div rather than a
paragraph, so that there may be several paragraphs in the centering
environment.  Blockquotes now also may have several paragraphs.
Carsten Dominik 16 سال پیش
والد
کامیت
7059914423
3فایلهای تغییر یافته به همراه36 افزوده شده و 10 حذف شده
  1. 9 0
      lisp/ChangeLog
  2. 12 6
      lisp/org-exp.el
  3. 15 4
      lisp/org-export-latex.el

+ 9 - 0
lisp/ChangeLog

@@ -1,3 +1,12 @@
+2009-03-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-export-latex.el (org-export-latex-preprocess): Improve
+	export of verses.
+
+	* org-exp.el (org-export-as-html): Implement centering as a div
+	rather than a paragraph.  Do a better job with line-end in verse
+	environments.
+
 2009-03-17  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.el (org-open-at-point): Fix tags searches by mouse click.

+ 12 - 6
lisp/org-exp.el

@@ -3722,10 +3722,12 @@ lang=\"%s\" xml:lang=\"%s\">
 	  ;; Blockquotes, verse, and center
 	  (when (equal "ORG-BLOCKQUOTE-START" line)
 	    (org-close-par-maybe)
-	    (insert "<blockquote>\n<p>\n")
+	    (insert "<blockquote>\n")
+	    (org-open-par)
 	    (throw 'nextline nil))
 	  (when (equal "ORG-BLOCKQUOTE-END" line)
-	    (insert "</p>\n</blockquote>\n")
+	    (org-close-par-maybe)
+	    (insert "\n</blockquote>\n")
 	    (throw 'nextline nil))
 	  (when (equal "ORG-VERSE-START" line)
 	    (org-close-par-maybe)
@@ -3738,10 +3740,12 @@ lang=\"%s\" xml:lang=\"%s\">
 	    (throw 'nextline nil))
 	  (when (equal "ORG-CENTER-START" line)
 	    (org-close-par-maybe)
-	    (insert "\n<p style=\"text-align: center\">\n")
+	    (insert "\n<div style=\"text-align: center\">")
+	    (org-open-par)
 	    (throw 'nextline nil))
 	  (when (equal "ORG-CENTER-END" line)
-	    (insert "</p>\n")
+	    (org-close-par-maybe)
+	    (insert "\n</div>")
 	    (throw 'nextline nil))
 	  (when inverse
 	    (let ((i (org-get-string-indentation line)))
@@ -3749,10 +3753,12 @@ lang=\"%s\" xml:lang=\"%s\">
 		  (setq line (concat (mapconcat 'identity
 						(make-list (* 2 i) "\\nbsp") "")
 				     " " (org-trim line))))
-	      (setq line (concat line "\\\\"))))
+	      (unless (string-match "\\\\\\\\[ \t]*$" line)
+		(setq line (concat line "\\\\")))))
 
 	  ;; make targets to anchors
-	  (while (string-match "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line)
+	  (while (string-match
+		  "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line)
 	    (cond
 	     ((match-end 2)
 	      (setq line (replace-match

+ 15 - 4
lisp/org-export-latex.el

@@ -1361,10 +1361,21 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
   ;; Convert verse
   (goto-char (point-min))
   (while (search-forward "ORG-VERSE-START" nil t)
-    (replace-match "\\begin{verse}" t t))
-  (goto-char (point-min))
-  (while (search-forward "ORG-VERSE-END" nil t)
-    (replace-match "\\end{verse}" t t))
+    (replace-match "\\begin{verse}" t t)
+    (beginning-of-line 2)
+    (while (and (not (looking-at "[ \t]*ORG-VERSE-END.*")) (not (eobp)))
+      (when (looking-at "\\([ \t]+\\)\\([^ \t\n]\\)")
+	(goto-char (match-end 1))
+	(replace-match
+	 (org-export-latex-protect-string
+	  (concat "\\hspace*{1cm}" (match-string 2))) t t)
+	(beginning-of-line 1))
+      (unless (looking-at ".*?[^ \t\n].*?\\\\\\\\[ \t]*$")
+	(end-of-line 1)
+	(insert "\\\\"))
+      (beginning-of-line 2))
+    (and (looking-at "[ \t]*ORG-VERSE-END.*")
+	 (replace-match "\\end{verse}" t t)))
 
   ;; Convert center
   (goto-char (point-min))