diff --git a/content/dataset.html b/content/dataset.html index b13ae47a..08b978cf 100644 --- a/content/dataset.html +++ b/content/dataset.html @@ -16,7 +16,7 @@ draft: false - + @@ -97,7 +97,7 @@ draft: false delete (cbextl) delete (extl) delete (vertkindtl) - window.doiCache = new DOICache() + window.publiCache = new Map() await loadFiles() } async function loadFiles() { @@ -460,7 +460,7 @@ draft: false allowUnknow:$("#cb_nHUnknow").is(':checked') } } - window.doiCache.clear() + window.publiCache.clear() processingIndicator.isActive = true window.filtData = window.dats //Filter with select @@ -494,7 +494,10 @@ draft: false var exSets = new uniq(window.filtData.map((d) => d.set)) var mols = new Set(window.filtData.map((d) => d.molecule)) for (const exSet of exSets) { - await doiCache.tryAdd(await exSet.getDOIAsync()) + const DOI= await exSet.getDOIAsync() + if (DOI!=null) { + publiCache.set(DOI,await PubliData.loadAsync(DOI)) + } const setName = exSet.name window.T1ref.set(setName, new Map()) for (const mol of mols) { @@ -570,9 +573,9 @@ draft: false $("
").text(CurrentsetName).appendTo(div) } var doi= await exSet.getDOIAsync() - if (doiCache.has(doi)) { - const doiDat = doiCache.get(doi).format('data', { format: 'object' })[0] - $("").append($("",{href:doiDat.URL,target:"_blank"}).text(doiDat.title)).appendTo(div) + if (publiCache.has(doi)) { + const publiDat = publiCache.get(doi) + $("").append($("",{href:publiDat.URL,target:"_blank"}).text(publiDat.title)).appendTo(div) } var table = $("").html(htmltxt) abtxt.appendTo(ab) art.append(ab) diff --git a/static/js/indexDB.js b/static/js/indexDB.js index a8417441..1a72477e 100644 --- a/static/js/indexDB.js +++ b/static/js/indexDB.js @@ -4,7 +4,7 @@ class indexDB { const text = await getTextFromFileUrlAsync("/data/index.yaml") const myYaml = jsyaml.load(text); db.sets = ((myYaml.sets === null) ? new Map() : new Map(Object.entries(myYaml.sets))); - db.others = ((myYaml.others === null) ? new Map() : new Map(Object.entries(myYaml.others))); + db.others = ((myYaml.others === null) ? [] : Array.from(myYaml.others)); return db } } \ No newline at end of file diff --git a/tools/pubimport.py b/tools/pubImport.py old mode 100644 new mode 100755 similarity index 63% rename from tools/pubimport.py rename to tools/pubImport.py index 39e63e10..7a8229cd --- a/tools/pubimport.py +++ b/tools/pubImport.py @@ -8,9 +8,9 @@ from pathlib import Path from shutil import copyfile import crossref_commons.retrieval parser = argparse.ArgumentParser() -parser.add_argument("--DOI",type=str) -parser.add_argument('--abstract', type=Path,help="The html abstract text") -parser.add_argument('--picture', type=Path,help="The picture for the graphical abstact") +parser.add_argument("--DOI",type=str,required=True) +parser.add_argument('--abstract', type=Path,help="The html abstract text file",required=False) +parser.add_argument('--picture', type=Path,help="The jpeg picture for the graphical abstact",required=False) args=parser.parse_args() scriptpath=Path(sys.argv[0]).resolve() publipath=scriptpath.parents[1]/"static"/"data"/"publis" @@ -22,6 +22,10 @@ picture=mydir/"picture.jpeg" if not mydir.exists(): os.makedirs(str(mydir)) with open(str(metadata),"w") as f: - json.dump(result,f) -copyfile(args.abstract,abstract) -copyfile(args.picture,picture") \ No newline at end of file + json.dump(result,f, indent=2) +if args.abstract!=None: + abstract=mydir/"abstract.html" + copyfile(args.abstract,abstract) +if args.picture!=None: + picture=mydir/"picture.html" + copyfile(args.picture,picture) \ No newline at end of file