I would like to use John Gruber's titlecase script (converts strings to titlecase with small-word exceptions).
My specific task is to search through multiple files and replace text strings within specific elements only (for example only h1's of a certain class name) with the titlecase.
For example, running titlecase on the following, everywhere it appears across files within multiple directories.
<div class="page-header"><h1>Replace me with appropriate title case, everywhere I appear</h1></div>
I can't figure out how to do this specifically. I was able to successfully use the javascript version of this script, and make the change onload in the browser, but I'd like to do it server-side so I can make the change permanently by actually writing the files.
Mojo::DOM looks useful, but I'm not sure exactly how to use it in this case.