Browse Source

Lot of improvements

master
nico202 5 years ago
parent
commit
bb4a38f975
  1. 1
      src/Scjrm.jl
  2. 3
      src/bibliography.jl
  3. 1
      src/default.jl
  4. 5
      src/interactions.jl
  5. 2
      src/zotero.jl

1
src/Scjrm.jl

@ -16,5 +16,6 @@ include("globals.jl")
include("configs.jl")
include("zotero.jl")
include("bibliography.jl")
include("interactions.jl")
end # module

3
src/bibliography.jl

@ -10,7 +10,6 @@ Defines `pre_add_to_bib` and `after_add_to_bib`.
"""
function addtobibliography!(bibliography::Bibliography, id::String, entry::Citation)
@hook :pre_add_to_bib
info("Here")
exists = id in keys(bibliography)
info("The id you are adding $(id) does " * (exists ? "" : "not ") * "exists")
if exists
@ -24,7 +23,7 @@ function addtobibliography!(bibliography::Bibliography, id::String, entry::Citat
differencepercent = compare(TokenMax(RatcliffObershelp()), old, new)
if differencepercent > 0.8
@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))")
@show json(oldentry)
@show json(entry)

1
src/default.jl

@ -53,6 +53,7 @@ function rmhook!(s::Symbol)
end
function setlibraries!(l::Dict)
empty!(libraries)
merge!(libraries,l)
end

5
src/interactions.jl

@ -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

2
src/zotero.jl

@ -203,7 +203,7 @@ function saveitems(req::Dict, libraries, currentlibrary)
foreach(i -> addtobibliography!(bibliography, i...),
parseitem.(parsed["items"]))
@hook :after_receive
@hook(:after_receive,parsed)
"ok", Dict{String,String}("status"=> string(201))
end

Loading…
Cancel
Save