Sfoglia il codice sorgente

ob-lob: inline calls should export even when preceeded by an "="

* lisp/ob-exp.el (org-babel-in-example-or-verbatim): Also check for in
  verbatim emphasis.
  (org-babel-exp-lob-one-liners): Cleaner checking for escaped call
  lines.
Eric Schulte 13 anni fa
parent
commit
ef42f3cc9c
3 ha cambiato i file con 10 aggiunte e 11 eliminazioni
  1. 4 10
      lisp/ob-exp.el
  2. 3 0
      testing/examples/babel.org
  3. 3 1
      testing/lisp/test-ob-lob.el

+ 4 - 10
lisp/ob-exp.el

@@ -166,10 +166,11 @@ Example and verbatim code include escaped portions of
 an org-mode buffer code that should be treated as normal
 org-mode text."
   (or (org-in-indented-comment-line) 
-      (save-excursion
-	(save-match-data
+      (save-match-data
+	(save-excursion
 	  (goto-char (point-at-bol))
 	  (looking-at "[ \t]*:[ \t]")))
+      (org-in-verbatim-emphasis)
       (org-in-regexps-block-p "^[ \t]*#\\+begin_src" "^[ \t]*#\\+end_src")))
 
 (defvar org-babel-default-lob-header-args)
@@ -182,14 +183,7 @@ options are taken from `org-babel-default-header-args'."
     (goto-char start)
     (while (and (< (point) end)
 		(re-search-forward org-babel-lob-one-liner-regexp nil t))
-			     ; TODO: move this logic to `org-babel-lob-get-info'
-      (when (or		                        ; either this is:
-	     (not (match-string 12))	        ; not an inline call at all
-	     (let ((prefix (match-string 11)))
-	       (or (string= "" prefix)          ; is at the beginning of a line
-		   (let ((last (substring prefix (- (length prefix) 1))))
-		     (or (string= " " last)     ; or is preceded by whitespace
-			 (string= "\t" last))))))
+      (unless (and (match-string 12) (org-babel-in-example-or-verbatim))
 	(let* ((lob-info (org-babel-lob-get-info))
 	       (inlinep (match-string 11))
 	       (inline-start (match-end 11))

+ 3 - 0
testing/examples/babel.org

@@ -184,6 +184,9 @@ paragraph.
 And, a call with raw results call_double(4)[:results raw] should not
 have quoted results.
 
+The following 2*5=call_double(5) should export even when prefixed by
+an = sign.
+
 * parsing header arguments
   :PROPERTIES:
   :ID:       7eb0dc6e-1c53-4275-88b3-b22f3113b9c3

+ 3 - 1
testing/lisp/test-ob-lob.el

@@ -85,7 +85,9 @@
 	;; 8 should not be quoted
 	(should (re-search-forward "8" nil t))
 	(should (not (= ?= (char-after (point)))))
-	(should (not (= ?= (char-before (- (point) 1)))))))))
+	(should (not (= ?= (char-before (- (point) 1)))))
+	;; 10 should export
+	(should (re-search-forward "10" nil t))))))
 
 (provide 'test-ob-lob)