Пример #1
0
def xthebibliography(nd):
    r = txt.tr('References')
    p = spar('section')
    p.append(r)
    getap(nd).append(p)
    setx(nd, p, getap(nd))
    ct.cnl(nd)
Пример #2
0
def xcaption(nd):
    p =  getap(nd)
    s = nd.captionName.textContent + ' ' + nd.ref.textContent + ': ' 
    r = txt.tr(s)
    p.append(r)
    setap(nd, p)
    ct.cnl(nd)
Пример #3
0
def xcaption(nd):
    p = getap(nd)
    s = nd.captionName.textContent + ' ' + nd.ref.textContent + ': '
    r = txt.tr(s)
    p.append(r)
    setap(nd, p)
    ct.cnl(nd)
Пример #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()
Пример #5
0
def xthebibliography(nd):
    r = txt.tr('References')
    p = spar('section')
    p.append(r)
    getap(nd).append(p)
    setx(nd, p, getap(nd))
    ct.cnl(nd)
Пример #6
0
def xabstract(nd):
    r = txt.tr('Abstract')
    p = spar('section')
    p.append(r)
    getap(nd).append(p)
    setx(nd, p, getap(nd))
    ct.cnl(nd)
Пример #7
0
def xabstract(nd):
    r = txt.tr('Abstract')
    p = spar('section')
    p.append(r)
    getap(nd).append(p)
    setx(nd, p, getap(nd))
    ct.cnl(nd)
Пример #8
0
def xhspace(nd):
    s = nd.attributes['len']
    n = int(s.em*6)
    t = txt.tr(u"\u2006"*n)
    getap(nd).append(t)
    
    
Пример #9
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()
Пример #10
0
def setbase(nd):
    p = getap(nd)
    if len(p)==0:
        x = txt.tr(u'\u200B')
        p.append(x)
    else:
        x = p[-1]
    
        n = nd.previousSibling.nodeName
        if n=='active::_' or n=='active::^':
            return x
        if n=='#text':
            t = x.find(NSM+'t')
            tt = t.text
            if len(tt)>1:
                tt1 = tt[-1]
                x1 = deepcopy(x)
                t1 = x1.find(NSM+'t')
                t1.text = tt1
                t.text = tt[:-1]
                x = x1
            else:
                p.remove(x)
        else:
            p.remove(x)
    
    if nd.nodeName == 'active::_':
        if nd.nextSibling == None:
            s = etree.Element(NSM+'sSub')
            e = etree.SubElement(s, NSM+'e')
            e.append(x)
            p.append(s)
        elif nd.nextSibling.nodeName != 'active::^':
            s = etree.Element(NSM+'sSub')
            e = etree.SubElement(s, NSM+'e')
            e.append(x)
            p.append(s)
        else:
            s = etree.Element(NSM+'sSubSup')
            e = etree.SubElement(s, NSM+'e')
            e.append(x)
            p.append(s)
    elif nd.nodeName == 'active::^':
        if nd.nextSibling==None:
            s = etree.Element(NSM+'sSup')
            e = etree.SubElement(s, NSM+'e')
            e.append(x)
            p.append(s)
        elif nd.nextSibling.nodeName != 'active::_':
            s = etree.Element(NSM+'sSup')
            e = etree.SubElement(s, NSM+'e')
            e.append(x)
            p.append(s)
        else:
            s = etree.Element(NSM+'sSubSup')
            e = etree.SubElement(s, NSM+'e')
            e.append(x)
            p.append(s)
    return s    
Пример #11
0
def setbase(nd):
    p = getap(nd)
    if len(p) == 0:
        x = txt.tr(u'\u200B')
        p.append(x)
    else:
        x = p[-1]

        n = nd.previousSibling.nodeName
        if n == 'active::_' or n == 'active::^':
            return x
        if n == '#text':
            t = x.find(NSM + 't')
            tt = t.text
            if len(tt) > 1:
                tt1 = tt[-1]
                x1 = deepcopy(x)
                t1 = x1.find(NSM + 't')
                t1.text = tt1
                t.text = tt[:-1]
                x = x1
            else:
                p.remove(x)
        else:
            p.remove(x)

    if nd.nodeName == 'active::_':
        if nd.nextSibling == None:
            s = etree.Element(NSM + 'sSub')
            e = etree.SubElement(s, NSM + 'e')
            e.append(x)
            p.append(s)
        elif nd.nextSibling.nodeName != 'active::^':
            s = etree.Element(NSM + 'sSub')
            e = etree.SubElement(s, NSM + 'e')
            e.append(x)
            p.append(s)
        else:
            s = etree.Element(NSM + 'sSubSup')
            e = etree.SubElement(s, NSM + 'e')
            e.append(x)
            p.append(s)
    elif nd.nodeName == 'active::^':
        if nd.nextSibling == None:
            s = etree.Element(NSM + 'sSup')
            e = etree.SubElement(s, NSM + 'e')
            e.append(x)
            p.append(s)
        elif nd.nextSibling.nodeName != 'active::_':
            s = etree.Element(NSM + 'sSup')
            e = etree.SubElement(s, NSM + 'e')
            e.append(x)
            p.append(s)
        else:
            s = etree.Element(NSM + 'sSubSup')
            e = etree.SubElement(s, NSM + 'e')
            e.append(x)
            p.append(s)
    return s
Пример #12
0
def xsection(nd):
    s = nd.ref.textContent + '. ' + nd.attributes['title'].textContent
    r = txt.tr(s)
    p = spar('section')
    p.append(r)
    Body.append(p)
    setx(nd, p, Body)
    ct.cnl(nd)
Пример #13
0
def xsection(nd):
    s = nd.ref.textContent + '. ' + nd.attributes['title'].textContent
    r = txt.tr(s)
    p = spar('section')
    p.append(r)
    Body.append(p)
    setx(nd, p, Body)
    ct.cnl(nd)
Пример #14
0
def xArrayRow(nd):
    mr = etree.Element(NSM + 'mr')
    getap(nd).append(mr)
    setx(nd, mr, mr)
    ct.cnl(nd)
    if nd.parentNode.nodeName == 'eqnarray':
        e = etree.Element(NSM + 'e')
        mr.append(e)
        if nd.ref != None:
            ntf.push()
            ntf.set()
            e.append(txt.tr('     (' + nd.ref.textContent + ')'))
            ntf.pop()
Пример #15
0
def xArrayRow(nd):
    mr = etree.Element(NSM + "mr")
    getap(nd).append(mr)
    setx(nd, mr, mr)
    ct.cnl(nd)
    if nd.parentNode.nodeName == "eqnarray":
        e = etree.Element(NSM + "e")
        mr.append(e)
        if nd.ref != None:
            ntf.push()
            ntf.set()
            e.append(txt.tr("     (" + nd.ref.textContent + ")"))
            ntf.pop()
Пример #16
0
def xmaketitle(nd):
    i = 0
    if 'title' in _mt.keys():
        Body.insert(i,_mt['title'])
        i = i+1
    if 'author' in _mt.keys():
        Body.insert(i,_mt['author'])
        i = i+1
    if 'date' in _mt.keys():
        Body.insert(i,_mt['date'])
    else:
        npf.push()
        p = spar('author')
        p.append(txt.tr(datetime.date.strftime(datetime.date.today(),'%B %d, %Y')))
        Body.insert(2, p)
        npf.pop()
Пример #17
0
def xmaketitle(nd):
    i = 0
    if 'title' in _mt.keys():
        Body.insert(i, _mt['title'])
        i = i + 1
    if 'author' in _mt.keys():
        Body.insert(i, _mt['author'])
        i = i + 1
    if 'date' in _mt.keys():
        Body.insert(i, _mt['date'])
    else:
        npf.push()
        p = spar('author')
        p.append(
            txt.tr(datetime.date.strftime(datetime.date.today(), '%B %d, %Y')))
        Body.insert(2, p)
        npf.pop()
Пример #18
0
def xequation(nd):
    t = deepcopy(_tbe)
    it = t.iter(NSW + "p")
    lp = it.next()
    mp = it.next()
    rp = it.next()
    p = etree.SubElement(mp, NSM + "oMathPara")
    m = etree.SubElement(p, NSM + "oMath")

    ref = "(" + nd.ref.textContent + ")"
    rp.append(txt.tr(ref))

    Body.append(t)
    setx(nd, p, m)
    mmf.push()
    mmf.set()
    ct.cnl(nd)
    mmf.pop()
Пример #19
0
def xequation(nd):
    t = deepcopy(_tbe)
    it = t.iter(NSW + 'p')
    lp = it.next()
    mp = it.next()
    rp = it.next()
    p = etree.SubElement(mp, NSM + 'oMathPara')
    m = etree.SubElement(p, NSM + 'oMath')

    ref = '(' + nd.ref.textContent + ')'
    rp.append(txt.tr(ref))

    Body.append(t)
    setx(nd, p, m)
    mmf.push()
    mmf.set()
    ct.cnl(nd)
    mmf.pop()
Пример #20
0
def xstxt(nd):
    k = nd.nodeName
    v = _tum[k]
    getap(nd).append(txt.tr(v))
Пример #21
0
def xacchar(nd):
    getap(nd).append(txt.tr(nd.chars[nd.textContent]))
Пример #22
0
def xacchar(nd):
    getap(nd).append(txt.tr(nd.chars[nd.textContent]))
Пример #23
0
def xref(nd):
    getap(nd).append(txt.tr(nd.idref['label'].ref.textContent))
Пример #24
0
def xref(nd):
    getap(nd).append(txt.tr(nd.idref["label"].ref.textContent))
Пример #25
0
def xstxt(nd):
    k = nd.nodeName
    v = _tum[k]
    getap(nd).append(txt.tr(v))
Пример #26
0
def xhspace(nd):
    s = nd.attributes['len']
    n = int(s.em * 6)
    t = txt.tr(u"\u2006" * n)
    getap(nd).append(t)
Пример #27
0
def xbibitem(nd):
    p = etree.Element(NSW+'p')
    p.append(txt.tr('['+nd.bibcite.childNodes[0]+'] '))
    setap(nd.firstChild, p)
    ct.cnl(nd.firstChild)
    getap(nd).append(p)
Пример #28
0
def xbibitem(nd):
    p = etree.Element(NSW + 'p')
    p.append(txt.tr('[' + nd.bibcite.childNodes[0] + '] '))
    setap(nd.firstChild, p)
    ct.cnl(nd.firstChild)
    getap(nd).append(p)