Improve bib2dox.py using \section for entiries (#184)
authorPeter Kovacs <kpeter@inf.elte.hu>
Fri, 02 Oct 2009 17:03:43 +0200
changeset 79268792fb2870f
parent 791 f8c468367dab
child 793 e4554cd6b2bf
Improve bib2dox.py using \section for entiries (#184)
scripts/bib2dox.py
     1.1 --- a/scripts/bib2dox.py	Sat Sep 26 10:15:49 2009 +0200
     1.2 +++ b/scripts/bib2dox.py	Fri Oct 02 17:03:43 2009 +0200
     1.3 @@ -86,6 +86,10 @@
     1.4  
     1.5  url_rex = re.compile('\\\url\{([^}]*)\}')
     1.6  
     1.7 +#
     1.8 +# styles for html formatting
     1.9 +#
    1.10 +divstyle = 'margin-top: -4ex; margin-left: 8em;'
    1.11  
    1.12  #
    1.13  # return the string parameter without braces
    1.14 @@ -284,7 +288,7 @@
    1.15              entry = []
    1.16              entrytype = pubtype_rex.sub('\g<1>',line)
    1.17              entrytype = string.lower(entrytype)
    1.18 -            # entryid   = pubtype_rex.sub('\g<2>', line)
    1.19 +            entryid   = pubtype_rex.sub('\g<2>', line)
    1.20  
    1.21          # end entry if just a }
    1.22          elif endtype_rex.match(line):
    1.23 @@ -379,6 +383,7 @@
    1.24                  bibkey = entrycont['key']
    1.25              entry.insert(0, sortkey)
    1.26              entry.insert(1, bibkey)
    1.27 +            entry.insert(2, entryid)
    1.28             
    1.29              # add the entry to the file contents
    1.30              filecont.append(entry)
    1.31 @@ -439,6 +444,7 @@
    1.32      for entry in filecont:
    1.33          # generate output key form the bibtex key
    1.34          bibkey = entry[1]
    1.35 +        entryid = entry[2]
    1.36          if keytable[bibkey] == 1:
    1.37              outkey = bibkey
    1.38          else:
    1.39 @@ -446,13 +452,11 @@
    1.40          counttable[bibkey] += 1
    1.41          
    1.42          # append the entry code to the output
    1.43 -        file.append('<tr valign="top">\n' + \
    1.44 -                    '<td>[' + outkey + ']</td>')
    1.45 -        file.append('<td>')
    1.46 -        file.append('\\anchor ' + outkey)
    1.47 -        for line in entry[2:]:
    1.48 +        file.append('\\section ' + entryid + ' [' + outkey + ']')
    1.49 +        file.append('<div style="' + divstyle + '">')
    1.50 +        for line in entry[3:]:
    1.51              file.append(line)
    1.52 -        file.append('</td>\n</tr>')
    1.53 +        file.append('</div>')
    1.54          file.append('')
    1.55  
    1.56      return file
    1.57 @@ -780,12 +784,8 @@
    1.58      print '/**'
    1.59      print '\page references References'
    1.60      print
    1.61 -    print '<table border="0" cellspacing="5px" width="100%">'
    1.62 -    print
    1.63      for line in outdata:
    1.64          print line
    1.65 -    print '</table>'
    1.66 -    print
    1.67      print '*/'
    1.68  
    1.69