Add href, basename, mimetype, and ext attributes for media elements, and move external and internal media-tag generating into a single method.