1

Normally, when I use orgmode's export function on a buffer that contains noweb references, they get expanded, resulting in lots of duplicated code throughout the exported HTML document.

Is there a way to export an orgmode buffer without expanding noweb references, so they still show up as <<reference>> in the exported document?

Daniel Ziltener
  • 244
  • 1
  • 8

1 Answers1

2

To export a buffer without expanding noweb references, you can set the following at your src header, as per documentation:

#+begin_src language :noweb no-export

To define that globally, you can add the following at the top of your Org File:

#+property: header-args :noweb no-export

Or language specific:

#+property: header-args:languagename  :noweb no-export
Daniel
  • 3,563
  • 16
  • 41
  • It seems that adding this property to anything except the specific `begin_src` block fails when there is already a `:noweb yes` added to it. It also seems that only either `:noweb no-export` or `:noweb yes` can be set, not both... – Daniel Ziltener Nov 26 '18 at 17:43
  • 1
    What I left out: I tried just adding `#+property: header-args :noweb no-export`, but that resulted in `org-babel-tangle` not expanding them either, despite the documentation saying otherwise. – Daniel Ziltener Nov 26 '18 at 17:49
  • @DanielZiltener Yes, properties on the top of the file will be overwritten by properties at the block level. Blocks inherit parent properties, but can override them. In fact, the header args can be used for any argument, not only `:noweb`. – Daniel Nov 26 '18 at 18:11
  • If the documentation says something that does not correspond to the behaviour you experience, and if that functionality is important to you, I'd suggest creating a minimum example and opening an issue at the mailing list. – Daniel Nov 26 '18 at 18:14
  • Thing is, even when there's no `:noweb` property at block level, the global property has no effect. On block level, it works though. – Daniel Ziltener Nov 26 '18 at 18:21
  • Could it be that `#+PROPERTY:` has to be written in caps? Also check out https://emacs.stackexchange.com/a/33646/10292 – Daniel Nov 26 '18 at 18:39
  • Uppercase writing makes no difference. I think I'll just add the property to the top level element, thanks for the link. – Daniel Ziltener Nov 29 '18 at 13:23
  • @DanielZiltener if you added the top-level `#+PROPERTY:...` tag, you need to refresh your loaded buffer's settings to reflect it, using `C-c C-c`, or close and reopen emacs. See https://lists.gnu.org/archive/html/emacs-orgmode/2011-02/msg00672.html – hraban Mar 17 '20 at 01:32