瀏覽代碼

Fix broken regexp.

Julien Barnier writes:

> I recntly noticed that in some specific cases, the final '}' was
> esacped when exproting an emphasis element to LaTeX.
>
> For example, the following element :
>
> /aa/
>
> Is exported to :
>
> \emph{aa\}
>
> This does not append if the string begins with a space or if it
> is ASCII-only. For example, the followig strings are exported
> correctly :
>
> /aaa/
> //
>
> I don't understand why the problem only occurs with non-ASCII chars,
> but I think that the regexp to protect added special chars in the
> org-export-latex-fontify function is missing a '?' in the
> beginning. Tha attached patch corrects it.
Carsten Dominik 15 年之前
父節點
當前提交
0ad032380e
共有 2 個文件被更改,包括 4 次插入1 次删除
  1. 3 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-latex.el

+ 3 - 0
lisp/ChangeLog

@@ -1,6 +1,9 @@
 2009-12-09  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-latex.el (org-export-latex-make-header): Remove \obeylines.
+	(org-export-latex-fontify): Fix regexp bug that takes special
+	care of protecting the right boundary characters in emphasis
+	matches.
 
 	* org.el (org-make-link-regexps): Use John Gruber's regexp for
 	urls.

+ 1 - 1
lisp/org-latex.el

@@ -1506,7 +1506,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 	(if (caddr emph)
 	    (setq rpl (org-export-latex-protect-string rpl))
 	  (save-match-data
-	    (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl)
+	    (if (string-match "\\`.?\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl)
 		(progn
 		  (add-text-properties (match-beginning 1) (match-end 1)
 				       '(org-protected t) rpl)