示例#1
0
文件: pp4tex.py 项目: nishio/pp4tex
def subst(s, ns):
    if isinstance(s, str):
        tree = texparse.parse(s)
    else:
        tree = s
    new_tree = traverse(tree, ns)
    s = texparse.unparse(new_tree, True)
    return s
示例#2
0
def subst(s, ns):
    if isinstance(s, str):
        tree = texparse.parse(s)
    else:
        tree = s
    new_tree = traverse(tree, ns)
    s = texparse.unparse(new_tree, True)
    return s
示例#3
0
文件: pp4tex.py 项目: nishio/pp4tex
def assert_is_single_token(frm, lno, **kw):
    fs = texparse.parse(frm)
    if len(fs) != 1:
        raise RuntimeError(
            "line %d: key '%s' should have only one token but has %s" %
            (lno + 1, frm, fs))
示例#4
0
def assert_is_single_token(frm, lno, **kw):
    fs = texparse.parse(frm)
    if len(fs) != 1:
        raise RuntimeError(
            "line %d: key '%s' should have only one token but has %s" %
            (lno + 1, frm, fs))