next/prev commands

Refactored next/prev commands. @lydell would you like to review before merging?
Why `role`? As far as I know, there is a fixed set of allowed keywords for the `role` attribute, so it shouldn’t be pattern-matched. Which `role` values do you have in mind?