# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1255155307 -7200
# Node ID 2de0fc6308995568fa8c554feb97ed3a49d451d5
# Parent  b7e3662faf02cb4a397373a6f97f2942a9193b33
Handle url fields in bib2dox.py (#184)
and modify the bibtex file using url fields.

diff -r b7e3662faf02 -r 2de0fc630899 doc/references.bib
--- a/doc/references.bib	Mon Oct 05 20:21:54 2009 +0200
+++ b/doc/references.bib	Sat Oct 10 08:15:07 2009 +0200
@@ -12,16 +12,14 @@
   key =          {EGRES},
   title =        {{EGRES} -- {E}gerv{\'a}ry {R}esearch {G}roup on
                   {C}ombinatorial {O}ptimization},
-  howpublished = {\url{http://www.cs.elte.hu/egres/}},
-  year =         2009
+  url =          {http://www.cs.elte.hu/egres/}
 }
 
 @misc{coinor,
   key =          {COIN-OR},
   title =        {{COIN-OR} -- {C}omputational {I}nfrastructure for
                   {O}perations {R}esearch},
-  howpublished = {\url{http://www.coin-or.org/}},
-  year =         2009
+  url =          {http://www.coin-or.org/}
 }
 
 
@@ -30,8 +28,7 @@
 @misc{boost,
   key =          {Boost},
   title =        {{B}oost {C++} {L}ibraries},
-  howpublished = {\url{http://www.boost.org/}},
-  year =         2009
+  url =          {http://www.boost.org/}
 }
 
 @book{bglbook,
@@ -47,8 +44,7 @@
   key =          {LEDA},
   title =        {{LEDA} -- {L}ibrary of {E}fficient {D}ata {T}ypes and
                   {A}lgorithms},
-  howpublished = {\url{http://www.algorithmic-solutions.com/}},
-  year =         2009
+  url =          {http://www.algorithmic-solutions.com/}
 }
 
 @book{ledabook,
@@ -67,16 +63,14 @@
 @misc{cmake,
   key =          {CMake},
   title =        {{CMake} -- {C}ross {P}latform {M}ake},
-  howpublished = {\url{http://www.cmake.org/}},
-  year =         2009
+  url =          {http://www.cmake.org/}
 }
 
 @misc{doxygen,
   key =          {Doxygen},
   title =        {{Doxygen} -- {S}ource code documentation generator
                   tool},
-  howpublished = {\url{http://www.doxygen.org/}},
-  year =         2009
+  url =          {http://www.doxygen.org/}
 }
 
 
@@ -85,37 +79,32 @@
 @misc{glpk,
   key =          {GLPK},
   title =        {{GLPK} -- {GNU} {L}inear {P}rogramming {K}it},
-  howpublished = {\url{http://www.gnu.org/software/glpk/}},
-  year =         2009
+  url =          {http://www.gnu.org/software/glpk/}
 }
 
 @misc{clp,
   key =          {Clp},
   title =        {{Clp} -- {Coin-Or} {L}inear {P}rogramming},
-  howpublished = {\url{http://projects.coin-or.org/Clp/}},
-  year =         2009
+  url =          {http://projects.coin-or.org/Clp/}
 }
 
 @misc{cbc,
   key =          {Cbc},
   title =        {{Cbc} -- {Coin-Or} {B}ranch and {C}ut},
-  howpublished = {\url{http://projects.coin-or.org/Cbc/}},
-  year =         2009
+  url =          {http://projects.coin-or.org/Cbc/}
 }
 
 @misc{cplex,
   key =          {CPLEX},
   title =        {{ILOG} {CPLEX}},
-  howpublished = {\url{http://www.ilog.com/}},
-  year =         2009
+  url =          {http://www.ilog.com/}
 }
 
 @misc{soplex,
   key =          {SoPlex},
   title =        {{SoPlex} -- {T}he {S}equential {O}bject-{O}riented
                   {S}implex},
-  howpublished = {\url{http://soplex.zib.de/}},
-  year =         2009
+  url =          {http://soplex.zib.de/}
 }
 
 
diff -r b7e3662faf02 -r 2de0fc630899 scripts/bib2dox.py
--- a/scripts/bib2dox.py	Mon Oct 05 20:21:54 2009 +0200
+++ b/scripts/bib2dox.py	Sat Oct 10 08:15:07 2009 +0200
@@ -70,7 +70,7 @@
 #
 author_rex = re.compile('\s+and\s+')
 rembraces_rex = re.compile('[{}]')
-capitalize_rex = re.compile('({\w*})')
+capitalize_rex = re.compile('({[^}]*})')
 
 # used by bibtexkeywords(data)
 keywords_rex = re.compile('[,;]')
@@ -363,6 +363,8 @@
                     entry.append(entrycont['year'] + '.')
             if entrycont.has_key('note') and (entrycont['note'] != ''):
                 entry.append(entrycont['note'] + '.')
+            if entrycont.has_key('url') and (entrycont['url'] != ''):
+                entry.append(entrycont['url'] + '.')
 
             # generate keys for sorting and for the output
             sortkey = ''
@@ -410,6 +412,9 @@
                 field = field_rex.sub('\g<1>', line)
                 field = string.lower(field)
                 data =  data_rex.sub('\g<2>', line)
+
+            if field == 'url':
+                data = '\\url{' + data.strip() + '}'
             
             if field in ('author', 'editor'):
                 entrycont[field] = bibtexauthor(data)