Skip to content

Commit 5e59a69

Browse files
authored
Merge pull request #365 from drelatgithub/master
Add .bib files to FileIO interface
2 parents 801fd86 + fd8ea2c commit 5e59a69

File tree

4 files changed

+160
-0
lines changed

4 files changed

+160
-0
lines changed

src/registry.jl

+3
Original file line numberDiff line numberDiff line change
@@ -527,3 +527,6 @@ add_format(format"HTML", (), [".html", ".htm"], [MimeWriter, SAVE])
527527
add_format(format"MIDI", "MThd", [".mid", ".midi", ".MID"], [:MIDI => UUID("f57c4921-e30c-5f49-b073-3f2f2ada663e")])
528528

529529
add_format(format"QOI", "qoif", ".qoi", [:QOI => UUID("4b34888f-f399-49d4-9bb3-47ed5cae4e65")], [idImageIO])
530+
531+
# Bibliography files.
532+
add_format(format"BIB", (), [".bib"], [:Bibliography => UUID("f1be7e48-bf82-45af-a471-ae754a193061")])

test/files/file.bib

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
@misc{CiteEprint,
2+
primaryClass = {cs.AI},
3+
author = {Richoux, Florian and Baffier, Jean-François},
4+
eprint = {2002.09811},
5+
year = {2020},
6+
url = {https://arxiv.org/abs/2002.09811},
7+
archivePrefix = {arXiv},
8+
title = {Automatic Cost Function Learning with Interpretable Compositional Networks}
9+
}
10+
11+
@article{CitekeyArticle,
12+
number = {6},
13+
pages = {1143--1148},
14+
author = {Cohen, P. J.},
15+
year = {1963},
16+
volume = {50},
17+
journal = {Proceedings of the National Academy of Sciences},
18+
title = {The independence of the continuum hypothesis}
19+
}
20+
21+
@book{CitekeyBook,
22+
publisher = {Penguin Random House},
23+
address = {New York, NY},
24+
author = {Susskind, Leonard and Hrabovsky, George},
25+
year = {2014},
26+
title = {Classical mechanics: the theoretical minimum}
27+
}
28+
29+
@booklet{CitekeyBooklet,
30+
howpublished = {Distributed at the Stockholm Tourist Office},
31+
publisher = {Penguin Random House},
32+
address = {New York, NY},
33+
author = {Swetla, Maria},
34+
year = {2015},
35+
month = {{July}},
36+
title = {Canoe tours in {S}weden}
37+
}
38+
39+
@inbook{CitekeyInbook,
40+
howpublished = {Distributed at the Stockholm Tourist Office},
41+
publisher = {Pearson},
42+
pages = {187--221},
43+
address = {New York, NY},
44+
booktitle = {Campbell Biology},
45+
author = {Urry, Lisa A. and Cain, Michael L. and Wasserman, Steven A. and Minorsky, Peter V. and Reece, Jane B.},
46+
year = {2016},
47+
month = {{July}},
48+
title = {Photosynthesis}
49+
}
50+
51+
@incollection{CitekeyIncollection,
52+
publisher = {Springer},
53+
pages = {1--10},
54+
address = {New York, NY},
55+
booktitle = {Flow Cytometry Protocols},
56+
author = {Shapiro, Howard M.},
57+
editor = {Hawley, Teresa S. and Hawley, Robert G.},
58+
year = {2018},
59+
title = {Flow Cytometry: The Glass Is Half Full}
60+
}
61+
62+
@inproceedings{CitekeyInproceedings,
63+
publisher = {ACM},
64+
pages = {207--216},
65+
address = {New York, NY},
66+
booktitle = {Proc. of the 6th Nordic Conf. on Human-Computer Interaction},
67+
author = {Holleis, Paul and Wagner, Matthias and Koolwaaij, Johan},
68+
series = {NordiCHI},
69+
year = {2010},
70+
title = {Studying mobile context-aware social services in the wild}
71+
}
72+
73+
@manual{CitekeyManual,
74+
organization = {R Foundation for Statistical Computing},
75+
address = {Vienna, Austria},
76+
author = {Team, R Core},
77+
year = {2018},
78+
title = {{R}: A Language and Environment for Statistical Computing}
79+
}
80+
81+
@mastersthesis{CitekeyMastersthesis,
82+
organization = {R Foundation for Statistical Computing},
83+
school = {Massachusetts Institute of Technology},
84+
address = {Cambridge, MA},
85+
author = {Tang, Jian},
86+
year = {1996},
87+
month = {Septembre},
88+
title = {Spin structure of the nucleon in the asymptotic limit}
89+
}
90+
91+
@misc{CitekeyMisc,
92+
howpublished = {\url{https://www.nasa.gov/nh/pluto-the-other-red-planet}},
93+
author = {NASA},
94+
note = {Accessed: 2018-12-06},
95+
year = {2015},
96+
title = {Pluto: The 'Other' Red Planet}
97+
}
98+
99+
@phdthesis{CitekeyPhdthesis,
100+
school = {Stanford University},
101+
address = {Stanford, CA},
102+
author = {Rempel, Robert Charles},
103+
year = {1956},
104+
month = {June},
105+
title = {Relaxation Effects for Coupled Nuclear Spins}
106+
}
107+
108+
@proceedings{CitekeyProceedings,
109+
publisher = {Springer},
110+
address = {Cham, Switzerland},
111+
editor = {Stepney, Susan and Verlan, Sergey},
112+
series = {Lecture Notes in Computer Science},
113+
year = {2018},
114+
volume = {10867},
115+
title = {Proceedings of the 17th International Conference on Computation and Natural Computation, Fontainebleau, France}
116+
}
117+
118+
@techreport{CitekeyTechreport,
119+
author = {Bennett, Vicki and Bowman, Kate and Wright, Sarah},
120+
editor = {Stepney, Susan and Verlan, Sergey},
121+
month = {September},
122+
title = {{W}asatch {S}olar {P}roject Final Report},
123+
publisher = {Springer},
124+
number = {DOE-SLC-6903-1},
125+
address = {Salt Lake City, UT},
126+
series = {Lecture Notes in Computer Science},
127+
year = {2018},
128+
volume = {10867},
129+
institution = {Salt Lake City Corporation}
130+
}
131+
132+
@unpublished{CitekeyUnpublished,
133+
author = {Suresh, Mohinder},
134+
note = {Well, a note},
135+
year = {2006},
136+
title = {Evolution: a revised theory}
137+
}
138+
139+
@misc{baffier2017experimental,
140+
primaryClass = {cs.DS},
141+
author = {Baffier, Jean-François and Diez, Yago and Korman, Matias},
142+
note = {Well, a note},
143+
eprint = {1706.04708},
144+
year = {2017},
145+
url = {https://arxiv.org/abs/1706.04708},
146+
archivePrefix = {arXiv},
147+
title = {Experimental Study of Compressed Stack Algorithms in Limited Memory Environments}
148+
}

test/loadsave.jl

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ end
1313
module TestLoadSave2
1414
import FileIO: File, @format_str
1515
fileio_load(file::File{format"HDF5"}) = "HDF5"
16+
fileio_load(file::File{format"BIB"}) = "BIB"
1617
end
1718

1819
@testset "FakeIO" begin
@@ -32,6 +33,7 @@ end
3233
add_loader(format"HDF5", TestLoadSave2)
3334
add_loader(format"JLD", TestLoadSave)
3435
add_loader(format"GZIP", TestLoadSave)
36+
add_loader(format"BIB", TestLoadSave2)
3537

3638
@test load(joinpath(fp,"file1.pbm")) == "PBMText"
3739
@test load(joinpath(fp,"file2.pbm")) == "PBMBinary"
@@ -49,6 +51,8 @@ end
4951
@test load(joinpath(fp,"file.jld")) == "JLD"
5052
# GZIP file saved with .gz extension
5153
@test load(joinpath(fp,"file.csv.gz")) == "GZIP"
54+
# Bibliography file saved with .bib extension
55+
@test load(joinpath(fp,"file.bib")) == "BIB"
5256
@test_throws Exception load("missing.fmt")
5357
end
5458
finally

test/query.jl

+5
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,11 @@ let file_dir = joinpath(@__DIR__, "files"), file_path = Path(file_dir)
508508
q = query(joinpath(file_dir, "file2.h5"))
509509
@test typeof(q) <: File{format"HDF5"}
510510
end
511+
512+
@testset "Bibliography detection" begin
513+
q = query(joinpath(file_dir, "file.bib"))
514+
@test typeof(q) <: File{format"BIB"}
515+
end
511516
end
512517

513518
@testset "Query from IOBuffer" begin

0 commit comments

Comments
 (0)