Lot of improvements
This commit is contained in:
parent
12866bc20e
commit
bb4a38f975
|
@ -16,5 +16,6 @@ include("globals.jl")
|
||||||
include("configs.jl")
|
include("configs.jl")
|
||||||
include("zotero.jl")
|
include("zotero.jl")
|
||||||
include("bibliography.jl")
|
include("bibliography.jl")
|
||||||
|
include("interactions.jl")
|
||||||
|
|
||||||
end # module
|
end # module
|
||||||
|
|
|
@ -10,7 +10,6 @@ Defines `pre_add_to_bib` and `after_add_to_bib`.
|
||||||
"""
|
"""
|
||||||
function addtobibliography!(bibliography::Bibliography, id::String, entry::Citation)
|
function addtobibliography!(bibliography::Bibliography, id::String, entry::Citation)
|
||||||
@hook :pre_add_to_bib
|
@hook :pre_add_to_bib
|
||||||
info("Here")
|
|
||||||
exists = id in keys(bibliography)
|
exists = id in keys(bibliography)
|
||||||
info("The id you are adding $(id) does " * (exists ? "" : "not ") * "exists")
|
info("The id you are adding $(id) does " * (exists ? "" : "not ") * "exists")
|
||||||
if exists
|
if exists
|
||||||
|
@ -24,7 +23,7 @@ function addtobibliography!(bibliography::Bibliography, id::String, entry::Citat
|
||||||
differencepercent = compare(TokenMax(RatcliffObershelp()), old, new)
|
differencepercent = compare(TokenMax(RatcliffObershelp()), old, new)
|
||||||
if differencepercent > 0.8
|
if differencepercent > 0.8
|
||||||
@hook :duplicated_paper
|
@hook :duplicated_paper
|
||||||
warn("The old and the new seems to be the same paper\n
|
warn("The old and the new seems to be the same paper
|
||||||
(similarity is $(differencepercent))")
|
(similarity is $(differencepercent))")
|
||||||
@show json(oldentry)
|
@show json(oldentry)
|
||||||
@show json(entry)
|
@show json(entry)
|
||||||
|
|
|
@ -53,6 +53,7 @@ function rmhook!(s::Symbol)
|
||||||
end
|
end
|
||||||
|
|
||||||
function setlibraries!(l::Dict)
|
function setlibraries!(l::Dict)
|
||||||
|
empty!(libraries)
|
||||||
merge!(libraries,l)
|
merge!(libraries,l)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
function byyear(year::Int)
|
||||||
|
global bibliography
|
||||||
|
[ bibliography[o] for o in keys(bibliography) if ismatch(Regex(string(1999)),
|
||||||
|
bibliography[o]["year"])]
|
||||||
|
end
|
|
@ -203,7 +203,7 @@ function saveitems(req::Dict, libraries, currentlibrary)
|
||||||
foreach(i -> addtobibliography!(bibliography, i...),
|
foreach(i -> addtobibliography!(bibliography, i...),
|
||||||
parseitem.(parsed["items"]))
|
parseitem.(parsed["items"]))
|
||||||
|
|
||||||
@hook :after_receive
|
@hook(:after_receive,parsed)
|
||||||
|
|
||||||
"ok", Dict{String,String}("status"=> string(201))
|
"ok", Dict{String,String}("status"=> string(201))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue