Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/euphrasiologist/bib_to_refer
Turn a BibTex file format into a refer database for use with groff.
https://github.com/euphrasiologist/bib_to_refer
Last synced: 12 days ago
JSON representation
Turn a BibTex file format into a refer database for use with groff.
- Host: GitHub
- URL: https://github.com/euphrasiologist/bib_to_refer
- Owner: Euphrasiologist
- Created: 2020-02-29T20:39:08.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-22T08:15:29.000Z (over 3 years ago)
- Last Synced: 2023-02-28T00:33:09.031Z (almost 2 years ago)
- Language: Python
- Size: 16.6 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Parse a BibTeX file into a refer database
### Example
BibTeX files look something like this:
@Article{RN298,\
author = {Abbott, R. J.},\
title = {LIFE-HISTORY VARIATION ASSOCIATED WITH THE POLYMORPHISM FOR CAPITULUM TYPE AND OUTCROSSING RATE IN SENECIO-VULGARIS L},\
journal = {Heredity},\
volume = {56},\
pages = {381-391},\
ISSN = {0018-067X},\
DOI = {10.1038/hdy.1986.60},\
url = {://WOS:A1986C827000012},\
year = {1986},\
type = {Journal Article}\
}
The output of the script produces:%A Abbott, R. J.\
%D 1986\
%P 381-391\
%V 56\
%J Heredity\
%T Life-History Variation Associated With The Polymorphism For Capitulum Type And Outcrossing Rate In Senecio-Vulgaris L\
%K LifeThis can then be used in the GNU troff (groff) and refer unix toolkits for making pretty typeset formatted output, which looks a bit like LaTeX, but much faster (and easier..?).
### Usage
There is an implementation in python, and one in JavaScript, so it can be easily manipulated in the browser.
A python script is provided which takes a mandatory argument, specifying a path to a .bib file and an optional argument which filters the final refer record based upon a minimum number of entries. Use `-h` flag for more information.
`python bib_to_refer.py [-h] [--number NUMBER] filename`
By default it prints to the console, so it is best to pass it to a simple text file.
`python bib_to_refer.py /path/to/bib.bib > refer_database.txt`
The JavaScript script is an export of the 'Refer' object. I think it will run like Refer.parse(refer_database_file).
### Dependencies
The script depends on `bibtexparser`, a cool module that allows for parsing of BibTeX files, `argparse` which allows for pretty command line interface and `re` for regular expressions.