Hi Nicolas, Nicolas Goaziou <n.goaz...@gmail.com> writes:
> I'd like to submit a branch for testing: > > git://github.com/ngz/org-mode-lists.git footnote-fix > > Here are the changes so far: > > - recognize and export inlined footnotes holding links in their definition, > - recognize and export two or more footnotes in a row, > - don't chock at footnotes or partial footnotes inside comments in Org buffer, > - export calls to already defined footnotes in LaTeX, > - export footnotes before first heading (LaTeX), > - export footnotes when selecting a subtree not holding their > definition (LaTeX), > - fontify more consistently footnotes in the org buffer (only labels > are "fontified" or fn in the case of an anonymous footnote). > Thanks for these changes! They are great. First, a general consideration: my vote would be for highlighting the entire footnote label, including the brackets. IMO, leaving the brackets in the default face makes it more difficult to scan the buffer. (Similarly, I think it might be nice to fontify the entire contents of inline footnotes.) Secondly, although the following issue is not explicitly addressed by your patch, I thought I'd bring it up now, as the footnotes export mechanism is fresh in your mind. Square brackets containing digits inside of footnotes cause some issues. The primary use for such brackets would be to include LaTeX cite macros inside of footnotes. I imagine this might be tricky to fix, as [25] looks exactly like a footnote label. Here is a test case: --8<---------------cut here---------------start------------->8--- * Headline This is the first footnote.[fn:5896a172] Another footnote.[fn::A footnote with a LaTeX citation.\cite[25]{bookid}] Another footnote.[fn:1e633fdb] Inline footnote with a link.[fn::[[http://www.orgmode.org][Org-mode]]] An inline footnote with square brackets [fn:: [John] Smith] [fn:5896a172] Here is my footnote. [fn:1e633fdb] Footnote with a link. [[http://www.orgmode.org][Org-mode]] --8<---------------cut here---------------end--------------->8--- v 1. The cite macro inside the inline footnote interferes with the fontification of the buffer. Only the first two footnote labels are highlighted. Everything else, including the footnote references, are not fontified. I know that your changes did not explicitly address cite macros inside a footnote, but any square brackets inside a footnote will cause fontification to fail. Are these explicitly prohibited in inline footnotes? Is there an escape character. 2. During export to LaTeX, the curly brackets are escaped within the footnote: --8<---------------cut here---------------start------------->8--- This is the first footnote.\footnote{Here is my footnote. } Another footnote.\footnote{A footnote with a LaTeX citation.\cite[25]\{bookid\} } Another footnote.\footnote{Footnote with a link. \href{http://www.orgmode.org}{Org-mode} } Inline footnote with a link.\footnote{\href{http://www.orgmode.org}{Org-mode} } An inline footnote with square brackets \footnote{[John] Smith } --8<---------------cut here---------------end--------------->8--- 3. Html export adds a superscript to the brackets containing digits (i.e., it treats them as a footnote within a footnote) --8<---------------cut here---------------start------------->8--- <p class="footnote"><sup><a class="footnum" name="fn.2" href="#fnr.2">2</a></sup> A footnote with a LaTeX citation.\cite<sup><a class="footref" name="fnr.25" href="#fn.25">25</a></sup>{bookid} </p> --8<---------------cut here---------------end--------------->8--- Thanks for considering these issues. Best, Matt