Browse Source

Export: Fix some problems with protection.

The previous changes had created problems with lines stating with a
colon, there where no longer protected.  They are now again.
Carsten Dominik 16 years ago
parent
commit
1ed9c50457
2 changed files with 13 additions and 9 deletions
  1. 8 0
      lisp/ChangeLog
  2. 5 9
      lisp/org-exp.el

+ 8 - 0
lisp/ChangeLog

@@ -1,3 +1,11 @@
+2009-01-01  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-exp.el (org-export-preprocess-string): Call
+	`org-export-protect-colon-examples'.
+	(org-export-protect-colon-examples): Renamed from
+	`org-export-protect-examples', and scope limited to lines starting
+	with a colon.
+
 2008-12-31  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-exp.el (org-export-preprocess-string): Move the preprocess

+ 5 - 9
lisp/org-exp.el

@@ -1556,6 +1556,9 @@ on this string to produce the exported version."
       ;; but mark them as targets that should be invisible
       (setq target-alist (org-export-handle-invisible-targets target-alist))
 
+      ;; Protect short examples
+      (org-export-protect-colon-examples)
+
       ;; Protect backend specific stuff, throw away the others.
       (org-export-select-backend-specific-text backend)
 
@@ -1851,14 +1854,8 @@ from the buffer."
 			 '(org-protected t))
     (goto-char (1+ (match-end 4)))))
 
-(defun org-export-protect-examples (&optional indent)
-  "Protect code that should be exported as monospaced examples."
-  (goto-char (point-min))
-  (while (re-search-forward "^#\\+BEGIN_EXAMPLE[ \t]*\n" nil t)
-    (goto-char (match-end 0))
-    (while (and (not (looking-at "#\\+END_EXAMPLE")) (not (eobp)))
-      (insert (if indent ":  " ":"))
-      (beginning-of-line 2)))
+(defun org-export-protect-colon-examples ()
+  "Protect lines starting with a colon."
   (goto-char (point-min))
   (while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t)
     (add-text-properties (match-beginning 0) (match-end 0)
@@ -3401,7 +3398,6 @@ lang=\"%s\" xml:lang=\"%s\">
 		(replace-match "\\2\n"))
 	      (insert line "\n")
 	      (while (and lines
-			  (not (string-match "^[ \t]*:" (car lines)))
 			  (or (= (length (car lines)) 0)
 			      (get-text-property 0 'org-protected (car lines))))
 		(insert (pop lines) "\n"))