示例#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
文件: mm.py 项目: nvminhtu/LaTex2Docx
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
文件: mm.py 项目: hao-han/LaTex2Docx
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
文件: mm.py 项目: hao-han/LaTex2Docx
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
文件: mm.py 项目: nvminhtu/LaTex2Docx
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
文件: mm.py 项目: nvminhtu/LaTex2Docx
def xref(nd):
    getap(nd).append(txt.tr(nd.idref['label'].ref.textContent))
示例#24
0
文件: mm.py 项目: hao-han/LaTex2Docx
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)