Comments: Rewrite comment-processing code

The new code is shorter, cleaner, it handles initial and terminal empty
lines in multi-line comments more consistently, and it also formats
multi-line comments that don't have a star on each line somewhat better
(it adds a space after "#").