# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1254495823 -7200
# Node ID f92258d6ea4739e3e57f526226997991bc82c207
# Parent  2e1eff023cf357749d9691254d56e308717137ec
Improve bib2dox.py using \section for entiries (#184)

diff --git a/doc/Makefile.am b/doc/Makefile.am
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -69,7 +69,7 @@
 references.dox: doc/references.bib
 	if test ${python_found} = yes; then \
 	  cd doc; \
-	  python $(abs_top_srcdir)/scripts/bib2dox.py $(abs_top_builddir)/$< >$@; \
+	  python @abs_top_srcdir@/scripts/bib2dox.py @abs_top_builddir@/$< >$@; \
 	  cd ..; \
 	else \
 	  echo; \
diff --git a/scripts/bib2dox.py b/scripts/bib2dox.py
--- a/scripts/bib2dox.py
+++ b/scripts/bib2dox.py
@@ -86,6 +86,10 @@
 
 url_rex = re.compile('\\\url\{([^}]*)\}')
 
+#
+# styles for html formatting
+#
+divstyle = 'margin-top: -4ex; margin-left: 8em;'
 
 #
 # return the string parameter without braces
@@ -284,7 +288,7 @@
             entry = []
             entrytype = pubtype_rex.sub('\g<1>',line)
             entrytype = string.lower(entrytype)
-            # entryid   = pubtype_rex.sub('\g<2>', line)
+            entryid   = pubtype_rex.sub('\g<2>', line)
 
         # end entry if just a }
         elif endtype_rex.match(line):
@@ -379,6 +383,7 @@
                 bibkey = entrycont['key']
             entry.insert(0, sortkey)
             entry.insert(1, bibkey)
+            entry.insert(2, entryid)
            
             # add the entry to the file contents
             filecont.append(entry)
@@ -439,6 +444,7 @@
     for entry in filecont:
         # generate output key form the bibtex key
         bibkey = entry[1]
+        entryid = entry[2]
         if keytable[bibkey] == 1:
             outkey = bibkey
         else:
@@ -446,13 +452,11 @@
         counttable[bibkey] += 1
         
         # append the entry code to the output
-        file.append('<tr valign="top">\n' + \
-                    '<td>[' + outkey + ']</td>')
-        file.append('<td>')
-        file.append('\\anchor ' + outkey)
-        for line in entry[2:]:
+        file.append('\\section ' + entryid + ' [' + outkey + ']')
+        file.append('<div style="' + divstyle + '">')
+        for line in entry[3:]:
             file.append(line)
-        file.append('</td>\n</tr>')
+        file.append('</div>')
         file.append('')
 
     return file
@@ -780,12 +784,8 @@
     print '/**'
     print '\page references References'
     print
-    print '<table border="0" cellspacing="5px" width="100%">'
-    print
     for line in outdata:
         print line
-    print '</table>'
-    print
     print '*/'
 
 
