Skip to content

Commit

Permalink
feat: add support for multiple input BibTeX files
Browse files Browse the repository at this point in the history
  • Loading branch information
CodePurble committed Oct 26, 2022
1 parent c65c086 commit 0a72423
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.1
## Breaking changes

## Feature additions
* Add support for multiple BibTeX inputs

# v1.0
## Breaking changes
* LaTeX source files are now provided using the `-f/--files` option rather than
Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- [ ] Remove dependency on `ext.sh`
- [ ] Support multiple reference BibTeX files
- [x] Support multiple reference BibTeX files
- [ ] Support a directory of reference BibTeX files
- [x] Option to perform a dry-run (no file output, only print info to stdout)
18 changes: 10 additions & 8 deletions bibx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def get_parser():
"-b",
"--bib",
help="BibTeX file(s) to look for entries in",
# action="extend",
# nargs="+",
action="extend",
nargs="+",
)
return parser

Expand Down Expand Up @@ -110,14 +110,16 @@ def main():
while entry := en.readline():
e_set = e_set.union(entry)

parser = BibTexParser()
parser.ignore_nonstandard_types = False
with open(args.bib) as bibtex_file:
bib_database = bibtexparser.load(bibtex_file, parser)
e_dict = {}
for file in args.bib:
with open(file) as bibtex_file:
parser = BibTexParser()
parser.ignore_nonstandard_types = False
bib_database = bibtexparser.load(bibtex_file, parser)
curr_dict = bib_database.entries_dict
e_dict.update(curr_dict)

e_dict = bib_database.entries_dict
out_db = BibDatabase()

found = 0
for entry in e_set:
if entry in e_dict.keys():
Expand Down
3 changes: 3 additions & 0 deletions debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

python -m pdb ./bibx -b test/p*.bib -f test/*.tex -d
20 changes: 20 additions & 0 deletions test/p1.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@inproceedings{avi_dist_dwt_fpga_2015,
author = {Avinash, C.S. and Alex, John Sahaya Rani},
booktitle = {2015 International Conference on Smart Technologies and Management for Computing, Communication, Controls, Energy and Materials (ICSTM)},
doi = {10.1109/ICSTM.2015.7225436},
number = {},
pages = {326-330},
title = {FPGA implementation of Discrete Wavelet Transform using Distributed Arithmetic Architecture},
volume = {},
year = {2015},
}

@inproceedings{mahajan2010efficient,
author = {Mahajan, Anurag and Mohanty, Basant K},
booktitle = {2010 IEEE Asia Pacific Conference on Circuits and Systems},
organization = {IEEE},
pages = {1195--1198},
title = {Efficient VLSI architecture for implementation of 1-D discrete wavelet transform based on distributed arithmetic},
year = {2010},
}

18 changes: 18 additions & 0 deletions test/p2.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@inproceedings{zhou_da_fir_fpga,
author = {Yajun Zhou and Pingzheng Shi},
booktitle = {2011 International Conference on Multimedia Technology},
doi = {10.1109/ICMT.2011.6003032},
pages = {294-297},
title = {Distributed Arithmetic for FIR Filter implementation on FPGA},
year = {2011},
}

@article{shan1948,
author="Shannon, C.E.",
journal="The Bell Systems Technical Journal",
title="A Mathematical Theory of Communication",
year="1948",
volume="27",
pages="379-423, 623-656"
}

0 comments on commit 0a72423

Please sign in to comment.