Esempio n. 1
0
def std_string(args, ctxt=None):
    "convert argument into a string, default is context node"
    argver(args, maxargs=1)
    if len(args) > 0:
        return core.string(args[0])
    elif ctxt:
        return core.string(ctxt.nodelist[0])
Esempio n. 2
0
def std_normalize_space(args, ctxt):
    "remove all leading/trailing ws, all internal ws rep as single space"
    argver(args, maxargs=1)
    if len(args) > 0:
        s = core.string(args[0])
    elif ctxt:
        s = core.string(ctxt.nodelist[0])
    else: return ""
    return ' '.join(s.split())