Skip to content

Instantly share code, notes, and snippets.

View RbnAlexs's full-sized avatar
🏠
Working from home

Rubén Alejandro RbnAlexs

🏠
Working from home
  • UNAM
  • México
View GitHub Profile
@kmelve
kmelve / word generated html footnotes to bigfoot.js
Last active May 23, 2020 02:44
Takes HTML with footnotes generated in Word and – using jQuery – converts it to syntax compatible with [Bigfoot.js](http://cmsauve.com/labs/bigfoot/). I use it for a wordpress install. This is the first iteration of the code, and it can certainly be improved. I guess most of it can be done in pure Javascript.
var notes = [];
$('a[href*="ftnref"]').each(function (i) {
n = i + 1;
notes.push($(this[i]).parent().text());
$(this).parent().wrap('<li class="footnote" id=fn:' + n + '>' + notes[i] + '</li>');
$(this).remove();
});
$('.footnote').parent().wrapAll('<div class="footnotes" />');
$('div > .footnote').unwrap();
$('.footnotes').wrapInner('<ol></ol>');