Text this: Variational analysis of soliton scattering by external potentials