[Collab-qa-commits] r2284 - in udd: sql udd

Andreas Tille tille at alioth.debian.org
Tue May 8 09:10:05 UTC 2012


Author: tille
Date: 2012-05-08 09:10:05 +0000 (Tue, 08 May 2012)
New Revision: 2284

Modified:
   udd/sql/bibref.sql
   udd/udd/bibref_gatherer.py
Log:
When URL + DOI fields are regarded (for instance with natbib styles we need more escape sequences).  However, we can not (yet) really use plainnat style because of four overlongish author strings

$ bibtex debian
This is BibTeX, Version 0.99c (TeX Live 2009/Debian)
The top-level auxiliary file: debian.aux
The style file: plainnat.bst
Database file #1: debian.bib
Warning--you've exceeded 250, the entry-string-size, for entry bioperl
while executing--line 1347 of file plainnat.bst
*Please notify the bibstyle designer*
...



Modified: udd/sql/bibref.sql
===================================================================
--- udd/sql/bibref.sql	2012-05-08 03:00:31 UTC (rev 2283)
+++ udd/sql/bibref.sql	2012-05-08 09:10:05 UTC (rev 2284)
@@ -46,10 +46,27 @@
             CASE WHEN bibvolume.value  IS NOT NULL THEN E',\n  Volume  = "{' || bibvolume.value  || '}"' ELSE '' END ||
             CASE WHEN bibnumber.value  IS NOT NULL THEN E',\n  Number  = "{' || bibnumber.value  || '}"' ELSE '' END ||
             CASE WHEN bibpages.value   IS NOT NULL THEN E',\n  Pages   = "{' || regexp_replace(bibpages.value, '(\d)-(\d)', '\1--\2')   || '}"' ELSE '' END ||
-            CASE WHEN biburl.value     IS NOT NULL THEN E',\n  URL     = "{' || biburl.value     || '}"' ELSE '' END ||
-            CASE WHEN bibdoi.value     IS NOT NULL THEN E',\n  DOI     = "{' || bibdoi.value     || '}"' ELSE '' END ||
+            CASE WHEN biburl.value     IS NOT NULL THEN E',\n  URL     = "{' ||
+                  replace(replace(replace(biburl.value,
+                        '_', E'\\_'),           --
+                        '%', E'\\%'),           --
+                        '&', E'\\&')            --
+                   || '}"'
+                 ELSE '' END ||
+            CASE WHEN bibdoi.value     IS NOT NULL THEN E',\n  DOI     = "{' ||
+                  replace(replace(bibdoi.value,
+                        '_', E'\\_'),           --
+                        '&', E'\\&')            --
+                   || '}"'
+                 ELSE '' END ||
             CASE WHEN bibpmid.value    IS NOT NULL THEN E',\n  PMID    = "{' || bibpmid.value    || '}"' ELSE '' END ||
-            CASE WHEN bibeprint.value  IS NOT NULL THEN E',\n  EPrint  = "{' || bibeprint.value  || '}"' ELSE '' END ||
+            CASE WHEN bibeprint.value  IS NOT NULL THEN E',\n  EPrint  = "{' ||
+                  replace(replace(replace(bibeprint.value,
+                        '_', E'\\_'),           --
+                        '%', E'\\%'),           --
+                        '&', E'\\&')            --
+                   || '}"'
+                 ELSE '' END ||
             CASE WHEN bibin.value      IS NOT NULL THEN E',\n  In      = "{' || bibin.value      || '}"' ELSE '' END ||
             CASE WHEN bibissn.value    IS NOT NULL THEN E',\n  ISSN    = "{' || bibissn.value    || '}"' ELSE '' END ||
             E',\n}\n'

Modified: udd/udd/bibref_gatherer.py
===================================================================
--- udd/udd/bibref_gatherer.py	2012-05-08 03:00:31 UTC (rev 2283)
+++ udd/udd/bibref_gatherer.py	2012-05-08 09:10:05 UTC (rev 2284)
@@ -314,13 +314,14 @@
 
       # create LaTeX file to test BibTeX functionality
       bf = open(self.bibtex_example_tex, 'w')
-      print >>bf, """\documentclass{article}
+      print >>bf, """\documentclass[10]{article}
 \usepackage[T1]{fontenc}
 \usepackage[utf8]{inputenc}
 \usepackage[left=2mm,top=2mm,right=2mm,bottom=2mm,nohead,nofoot]{geometry}
 \usepackage{longtable}
 \setlongtables
 \\begin{document}
+\small
 \\begin{longtable}{llp{70mm}l}
 \\bf package & \\bf source & \\bf description & BibTeX key \\\\ \hline"""
 
@@ -331,6 +332,8 @@
       print >>bf, """\end{longtable}
 
 \\bibliographystyle{plain}
+% Try a bit harder ...
+%\\bibliographystyle{plainnat}
 \\bibliography{debian}
 
 \end{document}




More information about the Collab-qa-commits mailing list