2
2
Fork
You've already forked csv2bibtex
0
A small utility to parse CSV files to Bib(La)TeX files.
  • Rust 84.9%
  • TeX 15.1%
2023年10月23日 23:30:33 +02:00
.github/workflows update github CI 2022年04月03日 13:00:40 +02:00
benches fix clippy lint 2022年05月23日 20:32:20 +02:00
src chore: Update biblatex crate 2023年10月23日 23:30:33 +02:00
tests chore: Update biblatex crate 2023年10月23日 23:30:33 +02:00
.gitignore initial commit 2021年01月30日 21:22:31 +01:00
Cargo.lock chore: Update biblatex crate 2023年10月23日 23:30:33 +02:00
Cargo.toml chore: Update biblatex crate 2023年10月23日 23:30:33 +02:00
LICENSE add LICENSE file 2021年02月18日 08:43:10 +01:00
README.md Fix readme url display 2022年05月16日 16:57:22 +02:00

csv2bibtex

A small command line utility to parse CSV files to Bib(La)TeX files.

Usage

csv2bibtex 0.2.0
mutluyuz
USAGE:
 csv2bibtex [OPTIONS] <INPUT> <OUTPUT>
ARGS:
 <INPUT> Input file to use
 <OUTPUT> Output file to use
OPTIONS:
 --biblatex Print output in BibLaTeX mode (default)
 --bibtex Print output in BibTeX mode
 -d, --delimiter <DELIMITER> Delimiter between cells in CSV file
 -f, --field-mapping <FIELD> Assignment of csv fields to bibtex fields
 -h, --help Print help information
 -l, --lazy Try to recover from as much errors as possible.
 --no-defaults Don't add default field mappings and verbatim fields.
 -v, --verbosity <LEVEL> Verbosity level, either DEBUG, INFO, WARN, or ERROR
 -V, --version Print version information
 --verbatim-field <FIELD> Bib(La)TeX verbatim fields, like url, file or doi

Usage is really intuitive: csv2bibtex INPUTFILE OUTPUTFILE. CSV fields can be mapped to BibTeX fields with the --field-mapping argument. In the following example, the CSV field AUTH is mapped to the BibTeX field author:

csv2bibtex \
 --field-mapping "author=[[AUTH]]" \
 input.csv \
 output.bib

The CSV field has to be enclosed betwee [[ and ]]. This offers the possibility to add regular characters like in the following example:

csv2bibtex \
 --field-mapping "pages=[[StartPage]]--[[EndPage]]" \
 --field-mapping "journal=My Great Journal" \
 input.csv \
 output.bib

There are two special fields: entrytype and bibtexkey. The former specifies the type of the BibTeX entry, the latter the BibTeX key. They can be used like any other field (see above). In addition, there are some default field mappings set (like title=[[titles]], use --no-defaults to prevent this). The field mapping argument can be given multiple times to map multiple fields.

The --verbatim-field argument can be used to not escape a certain field (e.g., file, doi, or url). This means that for example an url like "https://www.example.com/?1234%56" stays this way and is not changed to "https://www.example.com/?1234\%56".

Installation

This is a small rust utility. You have to install rust and execute the following commands:

git clone https://codeberg.org/mutluyuz/csv2bibtex
cd csv2bibtex
cargo install --path .

Bugs and Contributing

Of course there are not any bugs in this software. However, you may encounter unexpected behavior. Please report them at https://codeberg.org/mutluyuz/csv2bibtex/issues. Please use also the Codeberg page for pull requests.

Speed

Some very rough benchmarking on my (rather old) laptop yielded about 500.000 processed lines per second. However, this depends on the number of fields and thus, runtime might be a bit slower or faster. You can run your own benchmarks with cargo bench.