It seems to me you should just be doing this part in LaTeX. Suppose you just prepended each intended endnote with ‘ZZZ’, and then on the LaTeX side…
% Relies on packages endnotes, ifthen, and xstring.
\let\fnote\footnote
\renewcommand{\footnote}[1]{
\IfBeginWith{#1}{ZZZ}
{\endnote{\StrDel[1]{#1}{ZZZ}}}
{\fnote{#1}}
}
Voila! We get the desired split between footnotes and endnotes in the typeset output. Also notice your prepended string need not be totally unique — it just needs to be something that you would never start a foot/endnote with.
Works for me.
gr
Addendum: What the code does, line by line:
- Use the let cmd to set aside original footnote cmd under new name fnote (cuz we still need to call on it).
- Co-opt footnote cmd so we can adjudicate by contents.
- Is the content of the note prepended by ‘ZZZ’?
- If so, push it out as an endnote, but first delete the prepended ‘ZZZ’ marker.
- Otherwise, send it out as an fnote.