Classes

Library

class tammy.library(cfile=None)
read(force=False)

Read the yaml files from the references folder

This method is called when the library class is instanciated, and it ensures that all records are loaded. Because it calls the new method of the record class, if for some weird reason a file has no id field (e.g. you added it yourself), the key will be generated at this point.

Args:
force: a boolean to force the method to read all files, or only ...
update()

Update the keys in the library dict

This function will loop through all the references, and if the record id do not match with the key in the records dict, it will fix things up. Additionally, this function will rename the file in the references folder, and make sure that the linked files are renamed too.

Record

class tammy.record(library, content, new=True)
generate_key(keymaker=<function autYr at 0x7f2a01bfe730>)

Generates a citation key from the record information

At the moment, citations keys are created as autyr scheme plus one letter if this is required to make the citation key unique. Note that the citation key is also the filename of the record, so that a record whose key is Doe2004 will be written at Doe2004.yaml.

Args:
keymaker: a function returning a string with the record id, based on the contents of the record.
key()

Outputs the unique citation key for the record

Returns:
a unicode string with the citation key
write()

Writes the content of a record to disk

This will write the content of the record in the records folder of the bib_dir folder. The filename is the unique record key and the .yaml extension.

This method is usually called by library.write(), but it can be used to update the content of any file.