I didn't generalize this into a helper since the HTML spec doesn't seem to use this particular algorithm for anything else. This makes the ACID1 test title show up correctly. :^)