Method code for $parse_lib.filter_ctext()

[Turn on line numbering]
arg what, @defaults;
var dic, output, prop, eff, ctext;

dic = #[['receiver, sender()], ['time, 'post], ['formatter, $plain_format]];
if (defaults && type(defaults[1]) == 'dictionary)
    dic = dict_union(dic, defaults[1]);
switch (class(what)) {
    case $ctext_frob:
        output = what.set_vars(dic).format();
    case $message_frob:
        output = what.format(dic);
    case $filtered_frob:
        if ((prop = (| sender().default_propagator() |)))
            what = what.propagate(prop);
        if (!what) {
            output = `[];
        } else {
            ctext = what.message().to_ctext(dic);
            for eff in (what.effects()) {
                if (type(eff) == 'string)
                    ctext = $ctext_frob.new_with([eff + " "], ctext.vars()).append(ctext);
                else
                    ctext = $propagator_effects.(eff[1])(ctext, dic, eff.subrange(2));
            }
            ctext = ctext.set_vars(what.sensory());
            output = ctext.format();
        }
    default:
        output = what;
}
return output;

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon