Пример #1
0
def xpar(nd):
    if nd.childNodes:
        if nd.firstChild.nodeName in {'enumerate', 'itemize', 'equation', 'abstract', 'thebibliography', 
                                      'table', 'centering', 'tabular', 'center'}:
            setap(nd, getap(nd))
            ct.cnl(nd)
            return
    else:
        return
    
    
    if mmf.isset():
        setap(nd, getap(nd))
        ct.cnl(nd)
        return
    
    if nd.parentNode.nodeName=='item':
        enum.itempar(nd)
        return
        
    p = etree.Element(NSW+'p')
    setAlign(p)
    setx(nd, p, p)
    npf.clear()
    ct.cnl(nd)
    if npf.isset():
        getap(nd).append(p)
Пример #2
0
def xpar(nd):
    if nd.childNodes:
        if nd.firstChild.nodeName in {
                'enumerate', 'itemize', 'equation', 'abstract',
                'thebibliography', 'table', 'centering', 'tabular', 'center'
        }:
            setap(nd, getap(nd))
            ct.cnl(nd)
            return
    else:
        return

    if mmf.isset():
        setap(nd, getap(nd))
        ct.cnl(nd)
        return

    if nd.parentNode.nodeName == 'item':
        enum.itempar(nd)
        return

    p = etree.Element(NSW + 'p')
    setAlign(p)
    setx(nd, p, p)
    npf.clear()
    ct.cnl(nd)
    if npf.isset():
        getap(nd).append(p)
Пример #3
0
def xtheorem(nd):
    cap = nd.caption
    p = etree.Element(NSW+'p')
    setap(cap, p)
    rbf.push()
    rbf.set()
    ct.cnl(cap)
    p.append(txt.tr(' '+nd.ref.textContent))
    rbf.pop()

    rif.push()
    rif.set()
    i = 1
    if nd.childNodes[0].firstChild.nodeName == 'displaymath':
        i = 0
    else:
        setap(nd.childNodes[0], p)
        ct.cnl(nd.childNodes[0])
    np = getap(nd.parentNode)
    setap(nd, np)
    np.append(p)
    for par in nd.childNodes[i:]:
        ct.cnd(par)
    rif.pop()
    npf.clear()
Пример #4
0
def xtheorem(nd):
    cap = nd.caption
    p = etree.Element(NSW + 'p')
    setap(cap, p)
    rbf.push()
    rbf.set()
    ct.cnl(cap)
    p.append(txt.tr(' ' + nd.ref.textContent))
    rbf.pop()

    rif.push()
    rif.set()
    i = 1
    if nd.childNodes[0].firstChild.nodeName == 'displaymath':
        i = 0
    else:
        setap(nd.childNodes[0], p)
        ct.cnl(nd.childNodes[0])
    np = getap(nd.parentNode)
    setap(nd, np)
    np.append(p)
    for par in nd.childNodes[i:]:
        ct.cnd(par)
    rif.pop()
    npf.clear()