version 1.175.2.7, 2011/07/20 19:36:57
|
version 1.175.2.8, 2011/07/26 18:09:26
|
Line 102 def getParentDir(path):
|
Line 102 def getParentDir(path):
|
"""returns pathname shortened by one""" |
"""returns pathname shortened by one""" |
return '/'.join(path.split('/')[0:-1]) |
return '/'.join(path.split('/')[0:-1]) |
|
|
def normalizeBibtype(bt): |
def normalizeBibField(bt, underscore=True): |
"""returns normalised bib type for looking up mappings""" |
"""returns normalised bib type for looking up mappings""" |
bt = bt.strip().replace(' ', '-').lower() |
bt = bt.strip().replace(' ', '-').lower() |
|
if underscore: |
|
bt = bt.replace('_', '-') |
|
|
return bt |
return bt |
|
|
def getBibdataFromDom(dom): |
def getBibdataFromDom(dom): |
Line 114 def getBibdataFromDom(dom):
|
Line 117 def getBibdataFromDom(dom):
|
if bib is not None: |
if bib is not None: |
# put type in @type |
# put type in @type |
type = bib.get('type') |
type = bib.get('type') |
bibinfo['@type'] = normalizeBibtype(type) |
bibinfo['@type'] = normalizeBibField(type) |
# put all subelements in dict |
# put all subelements in dict |
for e in bib: |
for e in bib: |
bibinfo[e.tag] = getText(e) |
bibinfo[normalizeBibField(e.tag)] = getText(e) |
|
|
return bibinfo |
return bibinfo |
|
|
|
|
## |
## |
## documentViewer class |
## documentViewer class |
## |
## |