'doc' function improved

Using `case` instead of `if`/`elif`/`elif`/…/`fi`, you have a much cleaner code, which is easy to extend.