refs #465: only put <P> element around orphaned media/image elements
Merge branch 'ticket465' into testing