Browse Source

Fix bug with protected examples that look like table lines

* lisp/org-exp.el (org-export-remove-special-table-lines): Only fix table
lines that are not protected text.

Giovanni Moretti writes:

> I'm working up a presentation on orgmode for a local club and needed
> to prefix it with a brief emacs overview, and so included this:
>
> #+BEGIN_EXAMPLE
>                      ctrl-P (previous line)
>                           |
>                           |
> Ctrl-A <<<  Ctrl-B <---- o ----> Ctrl-F >>>  Ctrl-E
> Col 1      back char      !       fwd char        EOL
>                           !
>                      ctrl-N (next line)
> #+END_EXAMPLE
>
> :                       ctrl-P (previous line)
> :                            |
> :                            |
> : Ctrl-A <<<  Ctrl-B <---- o ----> Ctrl-F >>>  Ctrl-E
> : Col 1       back char      |       fwd char        EOL
> :                            |
> :                       ctrl-N (next line)
>
> I'm using Orgmode v6.36c and when exporting to HTML (and LaTex
> Beamer), the two lines containing the single vertical bar immediately
> below the "ctrl-P" line in the #+EXAMPLE block vanish, whereas using
> the alternate colon at the beginning of the line notation, the
> rendering is as expected.
>
> Interestingly, enabling the +n option (#+BEGIN_EXAMPLE +n) causes the
> missing lines (lines 2 & 3) to reappear.
Carsten Dominik 15 years ago
parent
commit
79b8411669
1 changed files with 17 additions and 16 deletions
  1. 17 16
      lisp/org-exp.el

+ 17 - 16
lisp/org-exp.el

@@ -1668,22 +1668,23 @@ When it is nil, all comments will be removed."
   "Remove tables lines that are used for internal purposes."
   (goto-char (point-min))
   (while (re-search-forward "^[ \t]*|" nil t)
-    (beginning-of-line 1)
-    (if (or (looking-at "[ \t]*| *[!_^] *|")
-	    (not
-	     (memq
-	      nil
-	      (mapcar
-	       (lambda (f)
-		 (or (= (length f) 0)
-		     (string-match
-		      "\\`<\\([0-9]\\|[rl]\\|[rl][0-9]+\\)>\\'" f)))
-	       (org-split-string ;; FIXME, can't we do this without splitting???
-		(buffer-substring (point-at-bol) (point-at-eol))
-		"[ \t]*|[ \t]*")))))
-	(delete-region (max (point-min) (1- (point-at-bol)))
-		       (point-at-eol))
-      (end-of-line 1))))
+    (org-if-unprotected-at (1- (point))
+      (beginning-of-line 1)
+      (if (or (looking-at "[ \t]*| *[!_^] *|")
+	      (not
+	       (memq
+		nil
+		(mapcar
+		 (lambda (f)
+		   (or (= (length f) 0)
+		       (string-match
+			"\\`<\\([0-9]\\|[rl]\\|[rl][0-9]+\\)>\\'" f)))
+		 (org-split-string ;; FIXME, can't we do without splitting???
+		  (buffer-substring (point-at-bol) (point-at-eol))
+		  "[ \t]*|[ \t]*")))))
+	  (delete-region (max (point-min) (1- (point-at-bol)))
+			 (point-at-eol))
+	(end-of-line 1)))))
 
 (defun org-export-protect-sub-super (s)
   (save-match-data