Hello, Rasmus <ras...@gmx.us> writes:
> When using LINES in `org-export--prepare-file-contents' the footnotes > section is not preserved causing export to fail. > > Minimal example > > $> cat t{1,2}.org > # this is t1.org > * intro > foo[fn:1] > * sec2 > bar > * Footnotes > > [fn:1] baz > > > # this is t2.org > #+INCLUDE: "./t1.org::#intro" > > And export t2.org. > > The attached patch fixes this by explicitly saving the footnote section > > (Aside: org-footnote-section is used in hackish ways; should we make a > function that returns to correct regexp for the footnotes section?). > > It works in a rather large document of mine and in the minimal test. > > Should I apply it, or is there a better way to fix this bug? Thanks for the patch. However, it is incorrect. First `org-footnote-section' could be nil, in which case there is no headline to look after. Also, there may be multiple footnote sections in the included document, or even some footnote definitions inside and some outside the single section... Eventually, you are inserting a headline in the source document, which could break its structure (e.g., if you're only inserting a table). You should only extract the definitions associated to the references within the included part of the document. However, you cannot insert them right after the included text, as it could break the surrounding environment, e.g., - item #+INCLUDE: some-table.org A possible solution would be to somehow postpone insertion of footnotes at the very end of the source document, not at the location of the keyword. However it would need some testing. Regards, -- Nicolas Goaziou