Skip to content

This is a project aiming to provide an extensible java library for parsing bibtex or bibtex-similar files.

License

Notifications You must be signed in to change notification settings

aleqsio/JBibtexParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JBibtexParser

This is a project aiming to provide an extensible java library for parsing bibtex or bibtex-similar files.

The goal was to make it very easy to use, but almost all parts of the project can be replaced with your own implementations simply by passing a custom class to the parser constructor.

Getting Started

Add the provided JBibtexParser.jar to your project, and include it in your dependencies. Afterwards just instantiate the parser and call Parser.parse(). It will return a BibliograpyManager which you can use to filter entries by types, fields or simply keywords

Example use

A simple constructor for creating parser with default componenents and a file reader:

    Parser parser = new Parser("samplefile.txt");

Parse the file:

    IBibliographyManager bibliographyManager;
    try {
        bibliographyManager = parser.parse();
    } catch (ParseErrorException e) {
        System.out.print(e.getMessage());
        return;
    }

Print out all entries:

    System.out.print(bibliographyManager.getBibliography().toString());

Print out all entries containing which contain both of the words 'mathematics' and 'theories'. You can chain filters:

    System.out.print(bibliographyManager.findEntriesContainingWords("mathematics").findEntriesContainingWords("theories")
    .getBibliography().toString());

print out all entries where author matches a regex .*shelah.*:

      System.out.println(bibliographyManager.findFieldsOfValue(parser.getEntryTypesManager().getField("author"),".*shelah.*").getBibliography().toString());

Running the tests

There are some (26) Junit5 tests written for the most bug-prone components, but full test coverage is definitly on the TODO list. You can find them in the tests package and run them as normal.

Authors

License

This project is licensed under the MIT License - see the license.md file for details

About

This is a project aiming to provide an extensible java library for parsing bibtex or bibtex-similar files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published