The same proceedings shall be had, the same penalties may be imposed and the person charged may purge himself of the contempt in the same way, as in the case of a person who has committed a contempt in the trial of a civil action before a superior court.