Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 8
0
def xhspace(nd):
    s = nd.attributes['len']
    n = int(s.em*6)
    t = txt.tr(u"\u2006"*n)
    getap(nd).append(t)
    
    
Ejemplo n.º 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()
Ejemplo n.º 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    
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 20
0
def xstxt(nd):
    k = nd.nodeName
    v = _tum[k]
    getap(nd).append(txt.tr(v))
Ejemplo n.º 21
0
def xacchar(nd):
    getap(nd).append(txt.tr(nd.chars[nd.textContent]))
Ejemplo n.º 22
0
def xacchar(nd):
    getap(nd).append(txt.tr(nd.chars[nd.textContent]))
Ejemplo n.º 23
0
def xref(nd):
    getap(nd).append(txt.tr(nd.idref['label'].ref.textContent))
Ejemplo n.º 24
0
def xref(nd):
    getap(nd).append(txt.tr(nd.idref["label"].ref.textContent))
Ejemplo n.º 25
0
def xstxt(nd):
    k = nd.nodeName
    v = _tum[k]
    getap(nd).append(txt.tr(v))
Ejemplo n.º 26
0
def xhspace(nd):
    s = nd.attributes['len']
    n = int(s.em * 6)
    t = txt.tr(u"\u2006" * n)
    getap(nd).append(t)
Ejemplo n.º 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)
Ejemplo n.º 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)