replace html fragments by methods