More generic way of getting buttons

This works for both oerpub and github-book, by using the first button in
the "headings" area as the heading button rather than a specifically marked
item. Also, fix small bug that assumed the element in the range is the heading
itself.