don't always replace <<noweb>> references when :exports both

* lisp/ob-exp.el (org-babel-exp-results): Alter a copy of info.
* testing/examples/babel.org (an): Example data for test behavior.
* testing/lisp/test-ob-exp.el (ob-exp/noweb-no-export-and-exports-both):
  Confirm proper behavior.
This commit is contained in:
Eric Schulte 2012-01-16 20:39:12 -07:00
parent bf1d5cfe95
commit 94f10ddfd7
3 changed files with 28 additions and 1 deletions

View File

@ -251,7 +251,8 @@ inhibit insertion of results into the buffer."
(when (and org-export-babel-evaluate
(not (and hash (equal hash (org-babel-current-result-hash)))))
(let ((lang (nth 0 info))
(body (nth 1 info)))
(body (nth 1 info))
(info (copy-sequence info)))
;; skip code blocks which we can't evaluate
(when (fboundp (intern (concat "org-babel-execute:" lang)))
(org-babel-eval-wipe-error-buffer)

View File

@ -288,3 +288,22 @@ exporting a code block with a name
#+begin_src sh :foo "baz"
echo bar
#+end_src
* noweb no-export and exports both
:PROPERTIES:
:ID: 8a820f6c-7980-43db-8a24-0710d33729c9
:END:
Weird interaction.
here is one block
#+name: noweb-no-export-and-exports-both-1
#+BEGIN_SRC sh :exports none
echo 1
#+END_SRC
and another
#+BEGIN_SRC sh :noweb no-export :exports both
# I am inside the code block
<<noweb-no-export-and-exports-both-1>>
#+END_SRC

View File

@ -217,6 +217,13 @@ elements in the final html."
(should (string-match "baz" ascii))
(should (string-match "replace" ascii))))))
(ert-deftest ob-exp/noweb-no-export-and-exports-both ()
(org-test-at-id "8a820f6c-7980-43db-8a24-0710d33729c9"
(org-narrow-to-subtree)
(let ((html (org-export-as-html nil nil nil 'string 'body-only)))
(should (string-match (regexp-quote "noweb-no-export-and-exports-both-1")
html)))))
(provide 'test-ob-exp)
;;; test-ob-exp.el ends here