???  the if statement at the top of the function tests for a non-match with toc.html among other things.  Help me understand the logic here?