瀏覽代碼

Allow footnote markers like [1] to occur in verbatim emphasis

Carsten Dominik 15 年之前
父節點
當前提交
7507bdd922
共有 5 個文件被更改,包括 21 次插入6 次删除
  1. 8 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-exp.el
  3. 1 1
      lisp/org-footnote.el
  4. 7 4
      lisp/org-latex.el
  5. 4 0
      lisp/org.el

+ 8 - 0
lisp/ChangeLog

@@ -1,3 +1,11 @@
+2009-10-29  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-latex.el (org-export-latex-fontify): Apply verbatim
+	emphasis.
+
+	* org-exp.el (org-export-protect-verbatim): Add an
+	`org-verbatim-emph' property to such text.
+
 2009-10-28  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-icalendar.el (org-icalendar-use-plain-timestamp): New option.

+ 1 - 1
lisp/org-exp.el

@@ -1686,7 +1686,7 @@ from the buffer."
   (goto-char (point-min))
   (while (re-search-forward org-verbatim-re nil t)
     (add-text-properties (match-beginning 4) (match-end 4)
-			 '(org-protected t))
+			 '(org-protected t org-verbatim-emph t))
     (goto-char (1+ (match-end 4)))))
 
 (defun org-export-protect-colon-examples ()

+ 1 - 1
lisp/org-footnote.el

@@ -365,7 +365,7 @@ referenced sequence."
       ;; Now find footnote references, and extract the definitions
       (goto-char (point-min))
       (while (re-search-forward org-footnote-re nil t)
-	(unless (org-in-commented-line)
+	(unless (or (org-in-commented-line) (org-in-verbatim-emphasis))
 	  (org-if-unprotected
 	   (setq def (match-string 4)
 		 idef def

+ 7 - 4
lisp/org-latex.el

@@ -1469,7 +1469,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
       (unless emph
 	(message "`org-export-latex-emphasis-alist' has no entry for formatting triggered by \"%s\""
 		 (match-string 3)))
-      (unless (or (get-text-property (- (point) 2) 'org-protected)
+      (unless (or (and (get-text-property (- (point) 2) 'org-protected)
+		       (not (get-text-property
+			     (- (point) 2) 'org-verbatim-emph)))
 		  (save-excursion
 		    (goto-char (match-beginning 1))
 		    (save-match-data
@@ -1799,9 +1801,10 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
     (goto-char (point-min))
     (while (re-search-forward "\\[\\([0-9]+\\)\\]" nil t)
       (org-if-unprotected
-       (when (save-match-data
-	       (save-excursion (beginning-of-line)
-			       (looking-at "[^:|#]")))
+       (when (and (save-match-data
+		    (save-excursion (beginning-of-line)
+				    (looking-at "[^:|#]")))
+		  (not (org-in-verbatim-emphasis)))
 	 (let ((foot-beg (match-beginning 0))
 	       (foot-end (match-end 0))
 	       (foot-prefix (match-string 0))

+ 4 - 0
lisp/org.el

@@ -15890,6 +15890,10 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
   "Is point in a line starting with `#'?"
   (equal (char-after (point-at-bol)) ?#))
 
+(defun org-in-verbatim-emphasis ()
+  (save-match-data
+    (and (org-in-regexp org-emph-re 2) (member (match-string 3) '("=" "~")))))
+
 (defun org-goto-marker-or-bmk (marker &optional bookmark)
   "Go to MARKER, widen if necessary.  When marker is not live, try BOOKMARK."
   (if (and marker (marker-buffer marker)