diff --git a/collects/scriblib/bibtex.rkt b/collects/scriblib/bibtex.rkt index bf6c8451..e298da49 100644 --- a/collects/scriblib/bibtex.rkt +++ b/collects/scriblib/bibtex.rkt @@ -137,7 +137,7 @@ (define-syntax-rule (define-bibtex-cite bib-pth - -cite-id citet-id generate-bibliography-id) + ~cite-id citet-id generate-bibliography-id) (begin (define bibtex-db (path->bibdb bib-pth)) (define-cite autobib-cite autobib-citet generate-bibliography-id) @@ -145,7 +145,7 @@ (apply citer (map (curry generate-bib bibtex-db) (append-map (curry regexp-split #rx" +") (cons f r))))) - (define -cite-id (make-citer autobib-cite)) + (define ~cite-id (make-citer autobib-cite)) (define citet-id (make-citer autobib-citet)))) (define (parse-author as) diff --git a/collects/scriblib/scribblings/bibtex.scrbl b/collects/scriblib/scribblings/bibtex.scrbl new file mode 100644 index 00000000..583d54ec --- /dev/null +++ b/collects/scriblib/scribblings/bibtex.scrbl @@ -0,0 +1,20 @@ +#lang scribble/manual +@(require (for-label scribble/struct + scriblib/bibtex + scriblib/autobib + racket/base + racket/contract)) + +@title[#:tag "bibtex"]{BibTeX Bibliographies} + +@defmodule[scriblib/bibtex] + +@defform[(define-bibtex-cite bib-pth ~cite-id citet-id generate-bibliography-id)]{ + +Parses @racket[bib-pth] as a BibTeX database. + +Uses @racket[define-cite] from @racketmodname[scriblib/autobib], but augments the @racket[~cite-id] and @racket[citet-id] functions so that rather than accepting @racket[bib?] structures, they accept citation key strings. + +Each string is broken along spaces into citations keys that are looked up in the BibTeX database and turned into @racket[bib?] structures. + +} \ No newline at end of file diff --git a/collects/scriblib/scribblings/scriblib.scrbl b/collects/scriblib/scribblings/scriblib.scrbl index 030ebba8..0e3fa63a 100644 --- a/collects/scriblib/scribblings/scriblib.scrbl +++ b/collects/scriblib/scribblings/scriblib.scrbl @@ -7,5 +7,6 @@ @include-section["gui-eval.scrbl"] @include-section["figure.scrbl"] @include-section["autobib.scrbl"] +@include-section["bibtex.scrbl"] @include-section["footnote.scrbl"] @include-section["render-cond.scrbl"] diff --git a/collects/tests/scriblib/bibtex.rkt b/collects/tests/scriblib/bibtex.rkt new file mode 100644 index 00000000..22c6e1cf --- /dev/null +++ b/collects/tests/scriblib/bibtex.rkt @@ -0,0 +1,23 @@ +#lang racket +(require racket/runtime-path + tests/eli-tester + scriblib/bibtex) + +(define-runtime-path example.bib "example.bib") + +(test + (let () + (define-bibtex-cite example.bib + ~cite-id citet-id generate-bibliography-id) + (test + (~cite-id "cryptoeprint:2000:067") + (~cite-id "Tobin-Hochstadt:2011fk") + (~cite-id "cryptoeprint:2000:067" "Tobin-Hochstadt:2011fk") + (~cite-id "cryptoeprint:2000:067 Tobin-Hochstadt:2011fk") + + (citet-id "cryptoeprint:2000:067") + (citet-id "Tobin-Hochstadt:2011fk") + (citet-id "Tobin-Hochstadt:2011fk" "Tobin-Hochstadt:2011fk") + (citet-id "Tobin-Hochstadt:2011fk Tobin-Hochstadt:2011fk") + + (generate-bibliography-id)))) \ No newline at end of file diff --git a/collects/tests/scriblib/example.bib b/collects/tests/scriblib/example.bib new file mode 100644 index 00000000..2c269379 --- /dev/null +++ b/collects/tests/scriblib/example.bib @@ -0,0 +1,311 @@ +%% This BibTeX bibliography file was created using BibDesk. +%% http://bibdesk.sourceforge.net/ + + +%% Created for Jay McCarthy at 2011-05-13 19:46:09 -0600 + + +%% Saved with string encoding Unicode (UTF-8) + + +@string{aadebug = {International Workshop on Automated and Algorithmic Debugging}} + +@string{acm = {Association for Computing Machinery}} + +@string{addison-wesley = {Addison-Wesley}} + +@string{addison-wesley-longman = {Addison Wesley Longman}} + +@string{aosd = {International Conference on Aspect-Oriented Software Development}} + +@string{ase = {{IEEE} International Symposium on Automated Software Engineering}} + +@string{asej = {Automated Software Engineering}} + +@string{aspnetpro = {asp.net{PRO}}} + +@string{aug = {August}} + +@string{brown-cs = {Computer Science Department, Brown University}} + +@string{cacm = {Communications of the {ACM}}} + +@string{cbse = {{ICSE} Workshop on Component-Based Software Engineering}} + +@string{cc = {Compiler Construction}} + +@string{computing-surveys = {{ACM} Computing Surveys}} + +@string{cup = {Cambridge University Press}} + +@string{dec = {December}} + +@string{dr-dobbs = {{Dr.\ Dobb's Journal}}} + +@string{dsl = {{USENIX} Conference on Domain-Specific Languages}} + +@string{ecoop = {European Conference on Object-Oriented Programming}} + +@string{esec/fse = {Joint European Software Engineering Conference and {ACM SIGSOFT} Symposium on the Foundations of Software Engineering}} + +@string{esop = {European Symposium on Programming}} + +@string{fdpe = {Functional and Declarative Programming in Education}} + +@string{foal = {Foundations of Aspect-Oriented Languages}} + +@string{fool = {Foundations of Object-Oriented Languages}} + +@string{fse = {{ACM SIGSOFT} International Symposium on the Foundations of Software Engineering}} + +@string{fsf = {Free Software Foundation}} + +@string{gcse = {International Symposium on Generative and Component-Based Software Engineering}} + +@string{gpce = {International Conference on Generative Programming and Component Engineering}} + +@string{hosc = {Higher-Order and Symbolic Computation}} + +@string{ic = {Information \& Computation}} + +@string{icalp = {International Conference on Automata, Languages and Programming}} + +@string{iccc = {Internationl Conference on Compiler Construction}} + +@string{icfp = {{ACM SIGPLAN} International Conference on Functional Programming}} + +@string{icse = {International Conference on Software Engineering}} + +@string{icsr = {International Conference on Software Reuse}} + +@string{ieee-software = {{IEEE} Software}} + +@string{ieee-tose = {{IEEE} Transactions on Software Engineering}} + +@string{info-proc-let = {Information Processing Letters}} + +@string{j-jucs = {Journal of Universal Computer Science}} + +@string{jan = {January}} + +@string{jcss = {Journal of Computer and System Sciences}} + +@string{jfp = {Journal of Functional Programming}} + +@string{jul = {July}} + +@string{jun = {June}} + +@string{lasc = {Lisp and Symbolic Computation}} + +@string{lfp = {{ACM} Symposium on Lisp and Functional Programming}} + +@string{lics = {{IEEE} Symposium on Logic in Computer Science}} + +@string{lncs = {Lecture Notes in Computer Science}} + +@string{manuscript = {Unpublished manuscript}} + +@string{mar = {March}} + +@string{mcgraw-hill = {McGraw-Hill}} + +@string{mit-lcs = {MIT Laboratory for Computer Science}} + +@string{mit-press = {{MIT} Press}} + +@string{monterey2001 = {Monterey Workshop on Engineering Automation for Software Intensive System Integration}} + +@string{nytimes = {New York Times}} + +@string{oopsla = {{ACM SIGPLAN} Conference on Object-Oriented Programming Systems, Languages \& Applications}} + +@string{padl = {Symposium on the Practical Aspects of Declarative Languages}} + +@string{paste = {Workshop on Program Analysis for Software Tools and Engineering}} + +@string{pepm = {{ACM SIGPLAN} Symposium on Partial Evaluation and Semantics-Based Program Manipulation}} + +@string{personal = {Personal communication}} + +@string{pldi = {{ACM SIGPLAN} Conference on Programming Language Design and Implementation}} + +@string{plilp = {International Symposium on Programming Languages: Implementations, Logics, and Programs}} + +@string{plop = {Pattern Languages of Program Design}} + +@string{pls = {Programming Languages and Systems}} + +@string{popl = {{ACM SIGPLAN-SIGACT} Symposium on Principles of Programming Languages}} + +@string{prentice-hall = {Prentice-Hall}} + +@string{pws = {{PWS} Publishing}} + +@string{schemecookbook = {Scheme Cookbook}} + +@string{scp = {Science of Computer Programming}} + +@string{sigplan-notices = {{ACM SIGPLAN} Notices}} + +@string{sosp = {Symposium on Operating System Principles}} + +@string{spe = {Software--Practice and Experience}} + +@string{spin-sw-mc = {{SPIN} Workshop on Software Model Checking}} + +@string{springer = {Springer-Verlag}} + +@string{sw = {Scheme Workshop}} + +@string{swconfmgmt = {International Workshop on Software Configuration Management}} + +@string{sws = {{ACM} Workshop on Secure Web Services (SWS)}} + +@string{tacas = {Conference on Tools and Algorithms for the Construction and Analysis of Systems}} + +@string{tcs = {Theoretical Computer Science}} + +@string{tocs = {{ACM} Transactions on Computer Systems}} + +@string{toit = {{ACM} Transactions on Internet Technology}} + +@string{tools-symp = {Technology of Object-Oriented Languages and Systems}} + +@string{toplas = {{ACM} Transactions on Programming Languages and Systems}} + +@string{tose = {{IEEE} Transactions on Software Engineering}} + +@string{tosem = {{ACM} Transactions on Software Engineering and Methodology}} + +@string{tr = {Technical Report}} + +@string{w3c = {{W}orld {W}ide {W}eb {C}onsortium}} + +@string{wiley = {Wiley}} + + +@misc{cryptoeprint:2000:067, + Author = {Ran Canetti}, + Date-Added = {2011-04-11 11:28:01 -0600}, + Date-Modified = {2011-04-11 11:29:32 -0600}, + Howpublished = {Cryptology ePrint Archive, Report 2000/067}, + Title = {Universally Composable Security: A New Paradigm for Cryptographic Protocols}, + Year = {2000}} + +@inproceedings{Tobin-Hochstadt:2011fk, + Author = {Sam Tobin-Hochstadt and Vincent St-Amour and Ryan Culpepper and Matthew Flatt and Matthias Felleisen}, + Booktitle = {PLDI}, + Date-Added = {2011-04-11 10:04:33 -0600}, + Date-Modified = {2011-04-11 10:28:07 -0600}, + Read = {1}, + Title = {Languages as Libraries}, + Year = {2011}, + Bdsk-File-1 = {YnBsaXN0MDDUAQIDBAUIJidUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLRBgdUcm9vdIABqAkKFRYXGyIjVSRudWxs0wsMDQ4RFFpOUy5vYmplY3RzV05TLmtleXNWJGNsYXNzog8QgASABqISE4ACgAOAB1lhbGlhc0RhdGFccmVsYXRpdmVQYXRo0hgNGRpXTlMuZGF0YU8RAc4AAAAAAc4AAgAADE1hY2ludG9zaCBIRAAAAAAAAAAAAAAAAAAAAMkCFiVIKwAAAC/hFxFwbGRpMTEtdGhhY2ZmLnBkZgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAT5pXyakRQgAAAAAAAAAAAAgABwAACSAAAAAAAAAAAAAAAAAAAAAFLVRtcC0AABAACAAAyQJ4lQAAABEACAAAyallogAAAAEAGAAv4RcACE4PAAhODgAAYloAAADYAAAA1gACAFdNYWNpbnRvc2ggSEQ6cHJpdmF0ZTp2YXI6Zm9sZGVyczpBLTpBLU5pTGNGSEdCaWw5bWJFYUR0dkYrKysrVEk6LVRtcC06cGxkaTExLXRoYWNmZi5wZGYAAA4AJAARAHAAbABkAGkAMQAxAC0AdABoAGEAYwBmAGYALgBwAGQAZgAPABoADABNAGEAYwBpAG4AdABvAHMAaAAgAEgARAASAEpwcml2YXRlL3Zhci9mb2xkZXJzL0EtL0EtTmlMY0ZIR0JpbDltYkVhRHR2RisrKytUSS8tVG1wLS9wbGRpMTEtdGhhY2ZmLnBkZgATAAEvAP//AACABdIcHR4fWCRjbGFzc2VzWiRjbGFzc25hbWWjHyAhXU5TTXV0YWJsZURhdGFWTlNEYXRhWE5TT2JqZWN0XxBaLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vdmFyL2ZvbGRlcnMvQS0vQS1OaUxjRkhHQmlsOW1iRWFEdHZGKysrK1RJLy1UbXAtL3BsZGkxMS10aGFjZmYucGRm0hwdJCWiJSFcTlNEaWN0aW9uYXJ5EgABhqBfEA9OU0tleWVkQXJjaGl2ZXIACAARABYAHwAoADIANQA6ADwARQBLAFIAXQBlAGwAbwBxAHMAdgB4AHoAfACGAJMAmACgAnICdAJ5AoICjQKRAp8CpgKvAwwDEQMUAyEDJgAAAAAAAAIBAAAAAAAAACgAAAAAAAAAAAAAAAAAAAM4}} + +@unpublished{cite-key, + Date-Added = {2011-04-11 10:04:14 -0600}, + Date-Modified = {2011-04-11 10:04:14 -0600}} + +@inproceedings{Braberman:2008:PPH:1375634.1375655, + Acmid = {1375655}, + Address = {New York, NY, USA}, + Author = {Braberman, V\'{\i}ctor and Fern\'{a}ndez, Federico and Garbervetsky, Diego and Yovine, Sergio}, + Booktitle = {Proceedings of the 7th international symposium on Memory management}, + Date-Added = {2011-02-18 10:02:51 -0700}, + Date-Modified = {2011-02-18 10:16:34 -0700}, + Doi = {http://doi.acm.org/10.1145/1375634.1375655}, + Isbn = {978-1-60558-134-7}, + Keywords = {heap consumption, heap space analysis, java, memory regions, Games, To-implement}, + Location = {Tucson, AZ, USA}, + Numpages = {10}, + Pages = {141--150}, + Publisher = {ACM}, + Read = {1}, + Series = {ISMM '08}, + Title = {Parametric prediction of heap memory requirements}, + Url = {http://doi.acm.org/10.1145/1375634.1375655}, + Year = {2008}, + Bdsk-Url-1 = {http://doi.acm.org/10.1145/1375634.1375655}} + +@inproceedings{Henglein:2011:REC:1926385.1926429, + Acmid = {1926429}, + Address = {New York, NY, USA}, + Author = {Henglein, Fritz and Nielsen, Lasse}, + Booktitle = {Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages}, + Date-Added = {2011-02-16 12:26:15 -0700}, + Date-Modified = {2011-02-16 13:03:08 -0700}, + Doi = {http://doi.acm.org/10.1145/1926385.1926429}, + Isbn = {978-1-4503-0490-0}, + Keywords = {axiomatization, coercion, coinduction, computational interpretation, containment, equivalence, regular expression, type, To-implement}, + Location = {Austin, Texas, USA}, + Numpages = {14}, + Pages = {385--398}, + Publisher = {ACM}, + Read = {1}, + Series = {POPL '11}, + Title = {Regular expression containment: coinductive axiomatization and computational interpretation}, + Url = {http://doi.acm.org/10.1145/1926385.1926429}, + Year = {2011}, + Bdsk-Url-1 = {http://doi.acm.org/10.1145/1926385.1926429}} + +@inproceedings{Hofmann:2011:SL:1926385.1926428, + Acmid = {1926428}, + Address = {New York, NY, USA}, + Author = {Hofmann, Martin and Pierce, Benjamin and Wagner, Daniel}, + Booktitle = {Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages}, + Date-Added = {2011-02-15 13:41:22 -0700}, + Date-Modified = {2011-02-15 14:17:16 -0700}, + Doi = {http://doi.acm.org/10.1145/1926385.1926428}, + Isbn = {978-1-4503-0490-0}, + Keywords = {algebra, category theory, lens, view-update}, + Location = {Austin, Texas, USA}, + Numpages = {14}, + Pages = {371--384}, + Publisher = {ACM}, + Read = {1}, + Series = {POPL '11}, + Title = {Symmetric lenses}, + Url = {http://doi.acm.org/10.1145/1926385.1926428}, + Year = {2011}, + Bdsk-Url-1 = {http://doi.acm.org/10.1145/1926385.1926428}} + +@inproceedings{Novark:2010:DSH:1866307.1866371, + Acmid = {1866371}, + Address = {New York, NY, USA}, + Author = {Novark, Gene and Berger, Emery D.}, + Booktitle = {Proceedings of the 17th ACM conference on Computer and communications security}, + Date-Added = {2011-02-14 12:53:15 -0700}, + Date-Modified = {2011-02-14 12:53:16 -0700}, + Doi = {http://doi.acm.org/10.1145/1866307.1866371}, + Isbn = {978-1-4503-0245-6}, + Keywords = {buffer overflow, dangling pointer, dynamic memory allocation, memory errors}, + Location = {Chicago, Illinois, USA}, + Numpages = {12}, + Pages = {573--584}, + Publisher = {ACM}, + Read = {1}, + Series = {CCS '10}, + Title = {DieHarder: securing the heap}, + Url = {http://doi.acm.org/10.1145/1866307.1866371}, + Year = {2010}, + Bdsk-Url-1 = {http://doi.acm.org/10.1145/1866307.1866371}} + +@inproceedings{Felleisen:1987:CAH:41625.41654, + Acmid = {41654}, + Address = {New York, NY, USA}, + Author = {Felleisen, Mattias and Friedman, D. P.}, + Booktitle = {Proceedings of the 14th ACM SIGACT-SIGPLAN symposium on Principles of programming languages}, + Date-Added = {2011-02-11 13:56:52 -0700}, + Date-Modified = {2011-02-11 13:56:52 -0700}, + Doi = {http://doi.acm.org/10.1145/41625.41654}, + Isbn = {0-89791-215-2}, + Location = {Munich, West Germany}, + Pages = {314--}, + Publisher = {ACM}, + Series = {POPL '87}, + Title = {A calculus for assignments in higher-order languages}, + Url = {http://doi.acm.org/10.1145/41625.41654}, + Year = {1987}, + Bdsk-Url-1 = {http://doi.acm.org/10.1145/41625.41654}} +