The Hahn-Mazurkiewicz theorem for finitely Suslinian continua