scripts/bib2dox.py
changeset 810 3b53491bf643
parent 745 68792fb2870f
child 836 c841ae1aca29
equal deleted inserted replaced
1:b4f0d412542a 2:1d40aeddfb0c
    68 #
    68 #
    69 # define global regular expression variables
    69 # define global regular expression variables
    70 #
    70 #
    71 author_rex = re.compile('\s+and\s+')
    71 author_rex = re.compile('\s+and\s+')
    72 rembraces_rex = re.compile('[{}]')
    72 rembraces_rex = re.compile('[{}]')
    73 capitalize_rex = re.compile('({\w*})')
    73 capitalize_rex = re.compile('({[^}]*})')
    74 
    74 
    75 # used by bibtexkeywords(data)
    75 # used by bibtexkeywords(data)
    76 keywords_rex = re.compile('[,;]')
    76 keywords_rex = re.compile('[,;]')
    77 
    77 
    78 # used by concat_line(line)
    78 # used by concat_line(line)
   361                     entry.append(entrycont['month'] + ' ' + entrycont['year'] + '.')
   361                     entry.append(entrycont['month'] + ' ' + entrycont['year'] + '.')
   362                 else:
   362                 else:
   363                     entry.append(entrycont['year'] + '.')
   363                     entry.append(entrycont['year'] + '.')
   364             if entrycont.has_key('note') and (entrycont['note'] != ''):
   364             if entrycont.has_key('note') and (entrycont['note'] != ''):
   365                 entry.append(entrycont['note'] + '.')
   365                 entry.append(entrycont['note'] + '.')
       
   366             if entrycont.has_key('url') and (entrycont['url'] != ''):
       
   367                 entry.append(entrycont['url'] + '.')
   366 
   368 
   367             # generate keys for sorting and for the output
   369             # generate keys for sorting and for the output
   368             sortkey = ''
   370             sortkey = ''
   369             bibkey = ''
   371             bibkey = ''
   370             if entrycont.has_key('author'):
   372             if entrycont.has_key('author'):
   408             # field = data entries
   410             # field = data entries
   409             elif data_rex.match(line):
   411             elif data_rex.match(line):
   410                 field = field_rex.sub('\g<1>', line)
   412                 field = field_rex.sub('\g<1>', line)
   411                 field = string.lower(field)
   413                 field = string.lower(field)
   412                 data =  data_rex.sub('\g<2>', line)
   414                 data =  data_rex.sub('\g<2>', line)
       
   415 
       
   416             if field == 'url':
       
   417                 data = '\\url{' + data.strip() + '}'
   413             
   418             
   414             if field in ('author', 'editor'):
   419             if field in ('author', 'editor'):
   415                 entrycont[field] = bibtexauthor(data)
   420                 entrycont[field] = bibtexauthor(data)
   416                 line = ''
   421                 line = ''
   417             elif field == 'title':
   422             elif field == 'title':