Fix tail out of order issue

This issue was discovered when dealing with nested inlines.  In
treeprocessors.py it was incorrectly handling tails.  In short, tail
elements were being inserted earlier than they were supposed to be.

In order to fix this, the insertion index should be incremented by 1 so
that when the tails are inserted into the parent, they will be just
after the child they came from.

Also added a test in nested-patterns to catch this issue.