Browse Source

org-export: Fix comma escape in included files

* contrib/lisp/org-export.el (org-export-expand-include-keyword): Use
  new functions to comma escape contents of included files when in an
  example or a src block.
Nicolas Goaziou 5 years ago
parent
commit
0af2f6068f
1 changed files with 4 additions and 11 deletions
  1. 4 11
      contrib/lisp/org-export.el

+ 4 - 11
contrib/lisp/org-export.el

@@ -2774,23 +2774,16 @@ paths."
 	      (insert
 	       (let ((ind-str (make-string ind ? ))
 		     (contents
-		      ;; Protect sensitive contents with commas.
-		      (replace-regexp-in-string
-		       "\\(^\\)\\([*]\\|[ \t]*#\\+\\)" ","
-		       (org-export--prepare-file-contents file lines)
-		       nil nil 1)))
+		      (org-escape-code-in-string
+		       (org-export--prepare-file-contents file lines))))
 		 (format "%s#+BEGIN_EXAMPLE\n%s%s#+END_EXAMPLE\n"
 			 ind-str contents ind-str))))
 	     ((stringp env)
 	      (insert
 	       (let ((ind-str (make-string ind ? ))
 		     (contents
-		      ;; Protect sensitive contents with commas.
-		      (replace-regexp-in-string
-		       (if (string= env "org") "\\(^\\)\\(.\\)"
-			 "\\(^\\)\\([*]\\|[ \t]*#\\+\\)") ","
-		       (org-export--prepare-file-contents file lines)
-		       nil nil 1)))
+		      (org-escape-code-in-string
+		       (org-export--prepare-file-contents file lines))))
 		 (format "%s#+BEGIN_SRC %s\n%s%s#+END_SRC\n"
 			 ind-str env contents ind-str))))
 	     (t