Skip to content

Commit 0a72423

Browse files
committed
feat: add support for multiple input BibTeX files
1 parent c65c086 commit 0a72423

6 files changed

Lines changed: 58 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v1.1
2+
## Breaking changes
3+
4+
## Feature additions
5+
* Add support for multiple BibTeX inputs
6+
17
# v1.0
28
## Breaking changes
39
* LaTeX source files are now provided using the `-f/--files` option rather than

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
- [ ] Remove dependency on `ext.sh`
2-
- [ ] Support multiple reference BibTeX files
2+
- [x] Support multiple reference BibTeX files
33
- [ ] Support a directory of reference BibTeX files
44
- [x] Option to perform a dry-run (no file output, only print info to stdout)

bibx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def get_parser():
6969
"-b",
7070
"--bib",
7171
help="BibTeX file(s) to look for entries in",
72-
# action="extend",
73-
# nargs="+",
72+
action="extend",
73+
nargs="+",
7474
)
7575
return parser
7676

@@ -110,14 +110,16 @@ def main():
110110
while entry := en.readline():
111111
e_set = e_set.union(entry)
112112

113-
parser = BibTexParser()
114-
parser.ignore_nonstandard_types = False
115-
with open(args.bib) as bibtex_file:
116-
bib_database = bibtexparser.load(bibtex_file, parser)
113+
e_dict = {}
114+
for file in args.bib:
115+
with open(file) as bibtex_file:
116+
parser = BibTexParser()
117+
parser.ignore_nonstandard_types = False
118+
bib_database = bibtexparser.load(bibtex_file, parser)
119+
curr_dict = bib_database.entries_dict
120+
e_dict.update(curr_dict)
117121

118-
e_dict = bib_database.entries_dict
119122
out_db = BibDatabase()
120-
121123
found = 0
122124
for entry in e_set:
123125
if entry in e_dict.keys():

debug.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
python -m pdb ./bibx -b test/p*.bib -f test/*.tex -d

test/p1.bib

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@inproceedings{avi_dist_dwt_fpga_2015,
2+
author = {Avinash, C.S. and Alex, John Sahaya Rani},
3+
booktitle = {2015 International Conference on Smart Technologies and Management for Computing, Communication, Controls, Energy and Materials (ICSTM)},
4+
doi = {10.1109/ICSTM.2015.7225436},
5+
number = {},
6+
pages = {326-330},
7+
title = {FPGA implementation of Discrete Wavelet Transform using Distributed Arithmetic Architecture},
8+
volume = {},
9+
year = {2015},
10+
}
11+
12+
@inproceedings{mahajan2010efficient,
13+
author = {Mahajan, Anurag and Mohanty, Basant K},
14+
booktitle = {2010 IEEE Asia Pacific Conference on Circuits and Systems},
15+
organization = {IEEE},
16+
pages = {1195--1198},
17+
title = {Efficient VLSI architecture for implementation of 1-D discrete wavelet transform based on distributed arithmetic},
18+
year = {2010},
19+
}
20+

test/p2.bib

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@inproceedings{zhou_da_fir_fpga,
2+
author = {Yajun Zhou and Pingzheng Shi},
3+
booktitle = {2011 International Conference on Multimedia Technology},
4+
doi = {10.1109/ICMT.2011.6003032},
5+
pages = {294-297},
6+
title = {Distributed Arithmetic for FIR Filter implementation on FPGA},
7+
year = {2011},
8+
}
9+
10+
@article{shan1948,
11+
author="Shannon, C.E.",
12+
journal="The Bell Systems Technical Journal",
13+
title="A Mathematical Theory of Communication",
14+
year="1948",
15+
volume="27",
16+
pages="379-423, 623-656"
17+
}
18+

0 commit comments

Comments
 (0)