Open methuselah-0 opened 4 years ago
ox-ipynb is not a regular kind of exporter, so I am not sure this is possible to support. you might have to first export your org file to an org-file, which might work with noweb, and then export that org-file to a notebook.
Ok, thanks for the tip. I did that and it worked. I wrote a bash-script for it that runs these with emacs --batch mode, but it's too long to post here. This method (with an intermediate org-export) doesn't perfectly equal a proper noweb expansion with links between source-blocks etc, but its better than not using noweb at all.
could you send me a small example file that illustrates the issues?
could you send me a small example file that illustrates the issues?
I don't think I know what else would help to illustrate than the example I already gave, but if lucky, this :noweb example helps:
In the most simple case, the contents of a single source block is inserted within other blocks. Thus, in following example,
(setq sentence "Never a foot too far, even.")
<<initialization>>
(reverse sentence)
the second code block is expanded as [upon export]:
(setq sentence "Never a foot too far, even.") (reverse sentence)
So the second code block is what I would expect to see in the ipynb file - not with the <<noweb-reference-name>>
preserved.
I am using ox-ipynb to convert from org-babel format -> ipynb format -> then nbdev to produce jekyll-website documentation. Currently, I am expanding the noweb-refs in the org-file, to another org-file by using the org-exporter, and then to ipynb since the :noweb yes and :noweb are not interpreted by the ox-ipynb exporter directly.
See this example(compare the org and exported ipynb files): https://github.com/methuselah-0/nbdev-org-babel-example/blob/master/nbs/ob_example/testscript.org https://github.com/methuselah-0/nbdev-org-babel-example/blob/master/nbs/ob_example/testscript_temp.ipynb
I have not forgotten about this. I don't currently have time to fix it though. I am leaving it open, because I hope I will get time later this year.
For example:
+BEGIN_SRC python :tangle picture_output.py :noweb-ref "" :noweb yes
+END_SRC
is not exported with the #<># noweb-reference expanded. The cell in the resulting ipynb file looks like: