1#lang scribble/manual 2@(require (for-label scribble/struct 3 scriblib/bibtex 4 scriblib/autobib 5 racket/base 6 racket/contract)) 7 8@title[#:tag "bibtex"]{BibTeX Bibliographies} 9 10@defmodule[scriblib/bibtex] 11 12@defform[(define-bibtex-cite bib-pth ~cite-id citet-id generate-bibliography-id 13 option ...)]{ 14 15Expands into: 16@racketblock[ 17(begin 18 (define-cite autobib-cite autobib-citet generate-bibliography-id 19 option ...) 20 (define-bibtex-cite* bib-pth 21 autobib-cite autobib-citet 22 ~cite-id citet-id))] 23} 24 25@defform[(define-bibtex-cite* bib-pth autobib-cite autobib-citet 26 ~cite-id citet-id)]{ 27 28Parses @racket[bib-pth] as a BibTeX database, and augments 29@racket[autobib-cite] and @racket[autobib-citet] into 30@racket[~cite-id] and @racket[citet-id] functions so that rather than 31accepting @racket[bib?] structures, they accept citation key strings. 32 33Each string is broken along spaces into citations keys that are looked up in the BibTeX database and turned into @racket[bib?] structures. 34 35The only BibTeX entries that are supported are: @litchar{misc}, 36@litchar{book}, @litchar{article}, @litchar{inproceedings}, 37@litchar{webpage}, @litchar{mastersthesis}, and @litchar{techreport}. 38 39} 40 41@defstruct*[bibdb ([raw (hash/c string? (hash/c string? string?))] 42 [bibs (hash/c string? bib?)])]{ 43 Represents a BibTeX database. The @racket[_raw] hash table maps the labels in the file to hash tables of the attributes and their values. The @racket[_bibs] hash table maps the same labels to Scribble data-structures representing the same information. 44 } 45 46@defproc[(path->bibdb [path path-string?]) 47 bibdb?]{ 48 Parses a path into a BibTeX database. 49 } 50 51@defproc[(bibtex-parse [ip input-port?]) 52 bibdb?]{ 53 Parses an input port into a BibTeX database. 54 } 55