I'm using rake to create a Table of contents from a bunch of static HTML files.
The question is how do I insert it into all files from within rake?
I have a <ul id="toc">
in each file to aim for. The entire content of that I want to replace.
I was thinking about using Nokogiri or similar to parse the document and replace the DOM node ul#toc
. However, I don't like the idea that I have to write the parser's DOM to the HTML file. What if it changes my layouts/indents etc.??
Any thoughts/ideas? Or perhaps links to working examples?