We should probably raise an exception (ValueError?) if neither `script` nor `doc` are specified.