コード例 #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))