Skip to content

Commit

Permalink
Merge pull request #54 from cite-architecture/dev
Browse files Browse the repository at this point in the history
Fix bug in reading ctsdata
  • Loading branch information
neelsmith authored Jan 4, 2022
2 parents dcddb94 + 23f4029 commit a9c7a17
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CiteEXchange"
uuid = "e2e9ead3-1b6c-4e96-b95f-43e6ab899178"
authors = ["Neel Smith <dnsmith.neel@gmail.com>"]
version = "0.8.0"
version = "0.8.1"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
5 changes: 4 additions & 1 deletion src/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ $(SIGNATURES)
function data(blockgroup::Vector{Block}, blocktype::AbstractString; delimiter = "|", complement = false)
blks = blocks(blockgroup, blocktype)

@warn("Get data for $(blocktype)")
#@warn("Get data for $(blocktype)")
# relationsets have a special multiline header:
if blocktype == "citerelationset"
relationsdata(blks)
elseif blocktype == "ctsdata"
datalines = map(blk -> blk.lines, blks)
Iterators.flatten(datalines) |> collect
else
# Other types all have a one-line header
datalines = map(blk -> blk.lines[2:end], blks)
Expand Down
9 changes: 9 additions & 0 deletions test/test_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ end
@test read1 == read2
@test read1 == read3
@test read1 == read4
@test length(read1) == 2

corp1 = data(f, CiteEXchange.FileReader, "ctsdata")
corp2 = data(url, CiteEXchange.UrlReader, "ctsdata")
corp3 = data(str, CiteEXchange.StringReader, "ctsdata")
corp4 = data(str, "ctsdata")

@test length(corp1) == 3
@test corp1 == corp2 == corp3 == corp4
end


0 comments on commit a9c7a17

Please sign in to comment.