WARNING: | works but currently very crude and rough! (no special characters; macros alpha-lower only) |
---|---|
copyright: | 2006 by Alan Isaac, see AUTHORS |
license: | MIT, see LICENSE |
TODO: | add checking for unique key |
TODO: | allow multiple entries |
TODO: | allow correcting entries |
TODO: | use style file for HTML formatting |
TODO: | check for macros against @string defs in .bib file |
TODO: | macro handling (journals) |
TODO: | add crossreferencing as option for inbook and incollection |
TODO: | change default format to legal HTML names |
Return string representation of journal, allowing opportunity to provide name to replace macro. TODO: automate macro substitution.
Return bool, a crude guess if this is a macro. TODO: rethink this.
Create a bibtex entry by prompting the user for input
Todo: | Should this be moved to a script? |
---|
author or editor (Æ), author(A), address(a), booktitle(b), chapter(c), crossref(x), edition(e), editor(E), howpublished(h), institution(I), isbn(i), journal(j), key(k), month(m), note(z), number(n), organization(O), pages(p), publisher(P), school(S), series(s), title(T), type(t), url(u), volume(v), year(y), unused(fgl)
Currently will not provide the crossref field since crossrefs must be prepended. (Just warn?)
Provides two classes, BibFile and BibEntry for accessing the parts of a bibtex database. BibFile inherits from simpleparse.dispatchprocessor. To fill a BibFile instance, bfi, call bibgrammar.Parse(src, bfi).
copyright: | Dylan Schwilk (esp. BibFile) and Alan G Isaac (esp. BibEntry), see AUTHORS |
---|---|
license: | MIT (see LICENSE) |
requires: | Python 2.4+ |
TODO: | make this framework more general, perhaps along the lines of the btparse library in btOOL |
Bases: dict
Stores a single bibliographic entry. Provides a dictionary interface to the fields: field keys are case-insensitive and fields are stored in the order added.
Note: | 2006-08-10 use ‘citekey’ instead of ‘key’ since BibTeX allows a ‘key’ field |
---|---|
Note: | 2008-03-29 ‘entry_type’ instead of ‘type’ since BibTeX allows a ‘type’ field |
property: ‘citekey’
property: ‘entry_type’
property: ‘fields’
return formatted BibName-object if possible else raw name
Note: | called by CitationManager in format_citation |
---|---|
Note: | 2006-08-08 no longer sets a _names attribute |
TODO: | add default name_template useful for .bib files? |
return (BibName-object if possible else string)
Note: | 2006-08-09 matching change to make_names, no longer sets self._names |
---|
Create and return a new citekey based on the entry’s data. This is for creating predictable and useful citekey (labels) for BibEntry objects. This is not integrated with the citation styles in bibstuff.bibstyles; but it serves a very different purpose. This is to create consistent citation keys that are easy to type and guess and that are valid BibTeX citation keys.
Parameters: |
|
---|---|
Returns: | string the citation key (label) |
The label style is a dict with the following fields:
citekey_label_style1 = dict(
name_template = 'v{_}_|l{}', # see NameFormatter class
max_names = 2,
name_name_sep = "+",
etal = 'etal',
anonymous = 'anon',
lower_name = False,
article = "%(names)s-%(year)s",
book = "%(names)s-%(year)s",
misc = "%(names)s-%(year)s",
default_type = "%(names)s-%(year)s")
TODO: | Strip LaTeX accent characters from names when making label |
---|
return (BibName-object if possible else string) (from “raw” names).
Change: | 2006-08-02 altered to return BibName instance and not set _names |
---|---|
Note: | self returns None if field missing (-> no KeyError) |
Note: | this method introduces the only dependence on simpleparse (via bibname) |
TODO: | return BibName instance for each available name field?? |
Parameters: |
|
Find regular expression in entry.
Return MatchObject if string_or_compiled found in entry else None. If field is omitted, search is through all fields.
Note: | used by BibFile’s find_re method, which is used in turn by bibsearch.py |
---|---|
Parameters: |
|
Bases: simpleparse.dispatchprocessor.DispatchProcessor
Stores parsed bibtex file. Access entries by key.
Note: | a BibFile object should simply store .bib file parts (a list of entries and a macro map) and provide access to these parts |
---|
Process the given production and it’s children
Process a bibentry field and return tuple of name, value.
Return list, the BibEntry instances that were found (and None for entries not found, unless discarded).
Process a macro entry and add macros to macro map
Process the given production and it’s children
Return list of matching entries. Search for regular expression in the fields of each entry. If field is omitted, search is through all fields.
Note: | used by bibsearch.py |
---|---|
Parameters: |
|
Provides an EBNF description of the bibtex bibliography format. The grammar draws largely from the grammar description in Nelson Beebe’s Lex/Yacc parser and also from Greg Ward’s btOOL documentation.
copyright: | Dylan Schwilk and Alan G. Isaac, see AUTHORS |
---|---|
license: | MIT (see LICENSE) |
Parses bibtex-formatted author/editor raw names and provides formatting functions (e.g., via bibstyles/shared.NamesFormatter).
copyright: | 2009-2014 Dylan Schwilk and Alan G Isaac, see AUTHORS |
---|---|
license: | MIT (see LICENSE) |
note: | Major change as of 2008-07-02. Now the ebnf grammar and processor handles parsing of a list of names (a bibtex names field such as editor or author) and parses the single author name into its fvlj parts. This eliminates the need for the original hand-coded parse_raw_names_parts function. Moved to using names_dicts rather than names_parts. The grammar handles latex accents and ligatures as well as braces strings so that a name such as {Barnes and Noble, Inc} is parsed as a single name and not split on the ” and ”. |
todo: | The dispatch processor does not currently strip the leading and trailing braces from latex/bibtex strings. Not hard to add (see bibfile.py). This should be done eventually. |
todo: | The grammar does not support quoted strings, only braces strings. Could be added fairly simply |
Bases: simpleparse.dispatchprocessor.DispatchProcessor
Processes a bibtex names entry (author, editor, etc) and stores the resulting raw_names_parts.
Note: | a BibName object should be bibstyle independent. |
---|
Processes first name part in a single name of a bibtex names field
format a BibName object into a string useful for citations
Note: | called by the BibEntry class in bibfile.py when entry formatting is requested |
---|
Return list of strings, where each string is a last name.
TODO: | graceful handling of missing names parts |
---|
Return a list of name dicts, one dict per name, having the fields: first , von, last, jr
Processes jr name part in a single name of a bibtex names field
Processes last name part in a single name of a bibtex names field
Prduction function to process a single name in a nameslist
Contains some simpleparse style ebnf declarations for use in parsing with simpleparse.
copyright: | 2006 by Alan G Isaac, see AUTHORS |
---|---|
license: | MIT (see LICENSE) |
requires: | pyaws v.0.3+ (installation is easy; see below) |
---|---|
requires: | free Amazon web services key http://www.amazon.com/gp/browse.html?node=3435361 |
license: | MIT, see LICENSE |
You can get a tarball from:http://svn2.assembla.com If you use SVN, I’ll assume you want the latest version. (Otherwise, get the tagged version rather than the trunk.)
it is free from Amazon web services http://www.amazon.com/gp/browse.html?node=3435361
right now I only look for it in bibstuff.cfg, which must be in the directory from which you call your script, and which must contain the lines:
[isbn2bib]
aws_key : your_AWS_key_here
Includes:
For more detail, see README
Bibstuff is free software distributed under the MIT license (see LICENSE)
Bibstuff is pure Python and in that sense will run on any platform.