def spu_sub()

in pelican/plugins/spu.py [0:0]


def spu_sub(call):
    my_functions = {k: v for k, v in globals().items() if callable(v) and k.startswith("spu_cmd_")}
    cmd = call.group(1)
    args = [x[1] for x in re.findall(r"(['\"]?)(.*?)\1(?:,\s*)?", call.group(2)) if x[1]]
    fnc = "spu_cmd_" + cmd
    if fnc in my_functions:
        return my_functions[fnc](args)
    return ""