Pārlūkot izejas kodu

Bugfix: Avoid emphasis processing across lines and fields in tables.

Emphasis processing could cause problems in tables, with spurious
matches for the emphasis regexp across field boundaries and even
lines.  Fixed now.
Carsten Dominik 17 gadi atpakaļ
vecāks
revīzija
b2842d2b7e
2 mainītis faili ar 13 papildinājumiem un 3 dzēšanām
  1. 4 2
      lisp/org-exp.el
  2. 9 1
      lisp/org-export-latex.el

+ 4 - 2
lisp/org-exp.el

@@ -2097,8 +2097,10 @@ This is to make sure that the line-processing export backends
 can work correctly."
   (goto-char (point-min))
   (while (re-search-forward org-emph-re nil t)
-    (if (not (= (char-after (match-beginning 3))
-		(char-after (match-beginning 4))))
+    (if (and (not (= (char-after (match-beginning 3))
+		     (char-after (match-beginning 4))))
+	     (save-excursion (goto-char (match-beginning 0))
+			     (save-match-data (not (org-at-table-p)))))
 	(org-if-unprotected
 	 (subst-char-in-region (match-beginning 0) (match-end 0)
 			       ?\n ?\  t)

+ 9 - 1
lisp/org-export-latex.el

@@ -1153,8 +1153,16 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
     ;; The match goes one char after the *string*
     (let ((emph (assoc (match-string 3)
 		       org-export-latex-emphasis-alist))
+	  (beg (match-beginning 0))
+	  (end (match-end 0))
 	  rpl)
-      (unless (get-text-property (1- (point)) 'org-protected)
+      (unless (or (get-text-property (1- (point)) 'org-protected)
+		  (save-excursion
+		    (goto-char (match-beginning 1))
+		    (save-match-data
+		      (and (org-at-table-p)
+			   (string-match
+			    "[|\n]" (buffer-substring beg end))))))
 	(setq rpl (concat (match-string 1)
 			  (format (org-export-latex-protect-char-in-string
 				   '("\\" "{" "}") (cadr emph))