Changeset 461:8732f15df5f3 in documentViewer for documentViewer.py


Ignore:
Timestamp:
Jul 26, 2011, 6:09:26 PM (13 years ago)
Author:
casties
Branch:
elementtree
Message:

more renovation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r460 r461  
    103103    return '/'.join(path.split('/')[0:-1])
    104104       
    105 def normalizeBibtype(bt):
     105def normalizeBibField(bt, underscore=True):
    106106    """returns normalised bib type for looking up mappings"""
    107107    bt = bt.strip().replace(' ', '-').lower()
     108    if underscore:
     109        bt = bt.replace('_', '-')
     110       
    108111    return bt
    109112
     
    115118        # put type in @type
    116119        type = bib.get('type')
    117         bibinfo['@type'] = normalizeBibtype(type)
     120        bibinfo['@type'] = normalizeBibField(type)
    118121        # put all subelements in dict
    119122        for e in bib:
    120             bibinfo[e.tag] = getText(e)
     123            bibinfo[normalizeBibField(e.tag)] = getText(e)
    121124           
    122125    return bibinfo
     126
    123127
    124128##
Note: See TracChangeset for help on using the changeset viewer.