Open bhugueney opened 4 years ago
There isn't currently a way to do this cleanly. You can do it like this with this advice I think.
(defun ipynb-rise-metadata (orig-func &rest args)
(let ((data (apply orig-func args)))
;; now add the desired rise metadata. this is the second element
(push '(rise . (("autolaunch" . "true"))) (cdr (second data)))
data))
(advice-add 'ox-ipynb-export-to-buffer-data :around #'ipynb-rise-metadata )
I think this is close to what you want.
Thank you so much for your answer ! When I add your code to my publishing code, it does generates an autolaunch presentation.
However, I would rather be able to set this on a per notebook basis for the org file. I hope you won't mind if I leave this issue open so that I know where to look should you want to make it possible to add custom non-org notebook metadata from inside the .org source file.
Best Regards.
PS: I tried to have the code in the org file and it corrupted the notebook in the funniest way ☺.
I usually do this like this:
* build :noexport:
#+BEGIN_SRC emacs-lisp
(defun ipynb-rise-metadata (orig-func &rest args)
(let ((data (apply orig-func args)))
;; now add the desired rise metadata. this is the second element
(push '(rise . (("autolaunch" . "true"))) (cdr (second data)))
data))
(progn
(advice-add 'ox-ipynb-export-to-buffer-data :around #'ipynb-rise-metadata )
(ox-ipynb-export-to-ipynb-file-and-open)
(advice-remove 'ox-ipynb-export-to-buffer-data #'ipynb-rise-metadata))
#+END_SRC
The section is not exported, and you manually run the build block, e.g. C-c C-c.
Thank you very much for the suggestion. However, my specific use case prevents me from any manual intervention in the build process as I make use of gitlab CI/CD to launch a build of the ipynb notebooks from the org sources in the repository. My goal is to enable students and co-workers (or anyboody !) to edit the org source files and regenerate to updated notebooks so that they don't strictly need to have emacs much less scimax to contribute.
Thank you again for the great software : I am very happy to use it to generate runnable Notebooks from org files . Your assistance in my last issue was very helpful !
However, I now wish to not only generate a Rise presentation (which I already do, but have it launch automatically on start-up, which would require adding the
"rise": {"autolaunch": true}
metadata to the notebook. I could see how to add "org" metadata to a notebook, or any metadata to cells, but I I could not see how to add non-org (i.e. "rise") metadata to the Notebook. Am I being dense again or is it not (yet !) possible / documented ?Again, thank you so much for enabling me to use emacs for writing Notebooks !
Best Regards.