Changed the toc matching pattern to use the one produced by the TOC generation of pandoc, instead of the section titles in the output.  This simultaneously makes it so that the pandoc option for controlling the depth of TOCs has an effect, and fixes a problem due to a difference between pandoc versions 1.12.2 and 1.12.3.  The latter no longer produces an <a> element in the section titles, which fixes a bug in pandoc but broke my algorithm :-(.