[Collab-qa-commits] r2299 - udd/sql
Andreas Tille
tille at alioth.debian.org
Wed May 9 09:41:23 UTC 2012
Author: tille
Date: 2012-05-09 09:41:23 +0000 (Wed, 09 May 2012)
New Revision: 2299
Modified:
udd/sql/bibref.sql
Log:
Try to do some logic to detect non-Articles like Books or Misc
Modified: udd/sql/bibref.sql
===================================================================
--- udd/sql/bibref.sql 2012-05-09 08:40:58 UTC (rev 2298)
+++ udd/sql/bibref.sql 2012-05-09 09:41:23 UTC (rev 2299)
@@ -17,7 +17,6 @@
GRANT SELECT ON bibref TO PUBLIC;
-COMMIT;
/************************************************************************************
* Create a BibTex file from references *
@@ -27,7 +26,9 @@
RETURNS SETOF TEXT LANGUAGE SQL
AS $$
SELECT DISTINCT
- '@Article{' || bibkey.value ||
+ CASE WHEN bibjournal.value IS NULL AND bibin.value IS NOT NULL AND bibpublisher.value IS NOT NULL THEN '@Book{'
+ ELSE CASE WHEN bibauthor.value IS NULL OR bibjournal.value IS NULL THEN '@Misc{'
+ ELSE '@Article{' END END || bibkey.value ||
CASE WHEN bibauthor.value IS NOT NULL THEN E',\n Author = {' || bibauthor.value || '}' ELSE '' END ||
CASE WHEN bibtitle.value IS NOT NULL THEN E',\n Title = "{' ||
replace(replace(replace(bibtitle.value,
@@ -126,3 +127,5 @@
ORDER BY package, bibkey
;
$$;
+
+COMMIT;
More information about the Collab-qa-commits
mailing list