Autoindex: rendering code moved to a separate function.

No functional changes.
Autoindex: implemented JSON output format.
Autoindex: implemented XML output format.