Orm Finnendahl <orm.finnend...@selma.hfmdk-frankfurt.de> writes: >> Yes, roughly like this. Ideally, we should simply modify >> `org-export-as', but handling output file name may be a bit tricky - >> it is somewhat awkwardly placed in the current ox.el API (see the >> discussion in >> https://list.orgmode.org/orgmode/25393.61240.135445.401...@gargle.gargle.howl/T/#u). > > Today I had a look at ox.el when upgrading my code to > 9.8-pre. Unfortunately the code (and behaviour of org-element, etc.) > has changed quite a bit and I had to fix many things. > > Especially in org-export-as the parsing of the tree is now done in the > lexical context of a copy of the buffer which makes implementing a > multipage backend even more awkward. > > IMHO the code is just the wrong way around: org-export-to-file calls > org-export-as which combines the parsing with generating the output > string. The multipage code has to split that part and that doesn't get > easier when both parts have to be evaluated in the context of > org-export-with-buffer-copy. I'd rather have that turned inside out: > Instead of org-export-as being a part of > org-export-to-file/buffer/etc., its functionality could be at the > top-level and then call org-export-to... appropriately (either for > multipage output, single-page output, buffer-output...). I will handle > it by splitting org-export-as just before the > org-export-with-buffer-copy, but consider it a bit ugly.
Or we can make `org-export-as' retain INFO channel when returning the output. Then, we can make `org-export-to-file' make use of the INFO channel to decide the file name. This way, there will be no need to decide the file name before running the parsing. > There is something else: A lot of my energy in the multipage backend > went into getting links and footnotes correct. Footnotes aren't a big > deal, but I have no idea how to handle cross document links if > different backends are present (e.g. linking from html to a pdf > document and vice versa ;-) I think this requires quite a bit more > thinking and maybe is unrealistic altogether, but at least the > framework could be changed to be able to tackle that in the distant > future... Yes, it is an important feature we would need to implement - turning internal links into external when they no longer point inside the same document. Somewhat relevant code: `org-export--update-included-link' and ox-publish. For links to external pdfs and co, we have discussed what can be done in https://list.orgmode.org/orgmode/87a5rpoi4c.fsf@localhost/ TL;DR: In latex, \href{file.pdf#anchor} works; In web, anchors should also work with pdfjs. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>