From 4355c5785871075f7fc8fba1bb4dd46852c07b99 Mon Sep 17 00:00:00 2001 From: geoffreychen777 Date: Wed, 4 Jan 2023 12:30:02 +0000 Subject: [PATCH 1/8] fix some workshop pub metadata of dblp --- .../downloader/semanticscholar.ts | 4 +- .../scraper-repository/scraper-repository.ts | 1 + .../scraper-repository/scrapers/adsabs.ts | 4 +- .../scraper-repository/scrapers/chemrxiv.ts | 4 +- .../scrapers/citation-count.ts | 4 +- .../scraper-repository/scrapers/crossref.ts | 4 +- .../scraper-repository/scrapers/dblp.ts | 78 ++++++++++++++----- .../scrapers/google-scholar.ts | 4 +- .../scraper-repository/scrapers/ieee.ts | 4 +- .../scraper-repository/scrapers/openreview.ts | 22 ++++-- .../scraper-repository/scrapers/paperlib.ts | 2 +- .../scrapers/paperwithcode.ts | 6 +- .../scraper-repository/scrapers/scopus.ts | 4 +- .../scrapers/semanticscholar.ts | 4 +- .../scraper-repository/scrapers/spie.ts | 4 +- .../scraper-repository/scrapers/springer.ts | 4 +- app/utils/string.ts | 7 +- 17 files changed, 105 insertions(+), 55 deletions(-) diff --git a/app/repositories/downloader-repository/downloader/semanticscholar.ts b/app/repositories/downloader-repository/downloader/semanticscholar.ts index 66bf2af4..683ac10f 100644 --- a/app/repositories/downloader-repository/downloader/semanticscholar.ts +++ b/app/repositories/downloader-repository/downloader/semanticscholar.ts @@ -82,14 +82,14 @@ export class SemanticScholarDownloader extends Downloader { for (const item of itemList) { const plainHitTitle = formatString({ str: item.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft!.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scraper-repository.ts b/app/repositories/scraper-repository/scraper-repository.ts index bac65c6d..9818a0d2 100644 --- a/app/repositories/scraper-repository/scraper-repository.ts +++ b/app/repositories/scraper-repository/scraper-repository.ts @@ -105,6 +105,7 @@ export class ScraperRepository { }); this.scraperList.push({ name: "dblp-venue", + // @ts-ignore scraper: dblpVenueScraper, }); } else if (scraperPref.name === 'biomedrxiv') { diff --git a/app/repositories/scraper-repository/scrapers/adsabs.ts b/app/repositories/scraper-repository/scrapers/adsabs.ts index b7fe9d22..436df533 100644 --- a/app/repositories/scraper-repository/scrapers/adsabs.ts +++ b/app/repositories/scraper-repository/scrapers/adsabs.ts @@ -64,14 +64,14 @@ export class AdsabsScraper extends Scraper { for (const item of parsedResponse.response.docs) { const plainHitTitle = formatString({ str: item.title.join(" - "), - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scrapers/chemrxiv.ts b/app/repositories/scraper-repository/scrapers/chemrxiv.ts index 53661f7a..0bc66fbd 100644 --- a/app/repositories/scraper-repository/scrapers/chemrxiv.ts +++ b/app/repositories/scraper-repository/scrapers/chemrxiv.ts @@ -56,14 +56,14 @@ export class ChemRxivScraper extends Scraper { for (const response of chemRxivResponses) { const plainHitTitle = formatString({ str: response.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scrapers/citation-count.ts b/app/repositories/scraper-repository/scrapers/citation-count.ts index 1692d1ef..7df985e0 100644 --- a/app/repositories/scraper-repository/scrapers/citation-count.ts +++ b/app/repositories/scraper-repository/scrapers/citation-count.ts @@ -66,14 +66,14 @@ export class CitationCountScraper extends Scraper { for (const item of itemList) { const plainHitTitle = formatString({ str: item.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scrapers/crossref.ts b/app/repositories/scraper-repository/scrapers/crossref.ts index 7a3a334a..925dad2d 100644 --- a/app/repositories/scraper-repository/scrapers/crossref.ts +++ b/app/repositories/scraper-repository/scrapers/crossref.ts @@ -73,14 +73,14 @@ export class CrossRefScraper extends Scraper { for (const item of hitItems.items) { const plainHitTitle = formatString({ str: item.title[0], - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scrapers/dblp.ts b/app/repositories/scraper-repository/scrapers/dblp.ts index f8545442..310bff06 100644 --- a/app/repositories/scraper-repository/scrapers/dblp.ts +++ b/app/repositories/scraper-repository/scrapers/dblp.ts @@ -7,6 +7,7 @@ import { formatString } from "@/utils/string"; import { Scraper, ScraperRequestType, ScraperType } from "./scraper"; import { DOIInnerScraper } from "./doi-inner"; +import { bibtex2json } from "@/utils/bibtex"; function parsingProcess( this: ScraperType, @@ -48,7 +49,7 @@ function parsingProcess( const plainHitTitle = formatString({ str: article.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, removeNewline: true, removeWhite: true, @@ -57,7 +58,7 @@ function parsingProcess( const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, removeNewline: true, removeWhite: true, @@ -91,6 +92,7 @@ function parsingProcess( } else { pubType = 2; } + const paperKey = article.key; const pubKey = article.key.split("/").slice(0, 2).join("/"); const venueKey = article.venue; @@ -103,9 +105,7 @@ function parsingProcess( paperEntityDraft.setValue("pubTime", `${pubTime}`); paperEntityDraft.setValue("pubType", pubType); if (pubKey == "journals/corr") { - paperEntityDraft.setValue("publication", "dblp://" + venueKey); - } else { - paperEntityDraft.setValue("publication", "dblp://" + pubKey); + paperEntityDraft.setValue("publication", "dblp://" + JSON.stringify({ 'venueID': pubKey == "journals/corr" ? venueKey : pubKey, 'paperKey': paperKey })); } if (article.volume) { @@ -133,7 +133,7 @@ export class DBLPScraper extends Scraper { preProcess(paperEntityDraft: PaperEntity): ScraperRequestType { let dblpQuery = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", }); dblpQuery = formatString({ str: dblpQuery, @@ -176,7 +176,7 @@ export class DBLPbyTimeScraper extends Scraper { let dblpQuery = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", }); dblpQuery = formatString({ str: dblpQuery, @@ -246,21 +246,24 @@ export class DBLPVenueScraper extends Scraper { } preProcess(paperEntityDraft: PaperEntity): ScraperRequestType { - const enable = paperEntityDraft.publication.startsWith("dblp://"); + const enable = this.getEnable("dblp") && paperEntityDraft.publication !== ""; const scrapeURL = "https://dblp.org/search/venue/api?q=" + - paperEntityDraft.publication.replace("dblp://", "") + + paperEntityDraft.publication + "&format=json"; const headers = {}; return { scrapeURL, headers, enable }; } + // @ts-ignore parsingProcess( - rawResponse: Response, + rawResponse: Record>, paperEntityDraft: PaperEntity ): PaperEntity { - const response = JSON.parse(rawResponse.body) as { + const { apiResponse, bibResponse } = rawResponse; + + const response = JSON.parse(apiResponse.body) as { result: { hits: { "@sent": number; @@ -274,7 +277,7 @@ export class DBLPVenueScraper extends Scraper { }; }; - const venueID = paperEntityDraft.publication.replace("dblp://", "") + "/"; + const venueID = paperEntityDraft.publication; if (response.result.hits["@sent"] > 0) { const hits = response.result.hits.hit; for (const hit of hits) { @@ -288,6 +291,17 @@ export class DBLPVenueScraper extends Scraper { paperEntityDraft.setValue("publication", "", true); } } + + // handle workshop + try { + const bibtex = bibtex2json(bibResponse.body); + if (bibtex[0]["container-title"].toLowerCase().includes('workshop')) { + paperEntityDraft.setValue("publication", paperEntityDraft.publication + " Workshop"); + } + } catch (e) { + } + + } else { paperEntityDraft.setValue("publication", "", true); } @@ -307,12 +321,21 @@ async function venueScrapeImpl( const useDOIforVenue = (this.preference.get("scrapers") as Record)[ "dblp" - ]?.args + ]?.args !== 'use-dblp' - if (paperEntityDraft.doi && useDOIforVenue !== 'use-dblp') { + const dblpVenueIdPaperKey = paperEntityDraft.publication + + if (paperEntityDraft.doi && useDOIforVenue) { + paperEntityDraft.publication = "" paperEntityDraft = await this.doiScraper.scrape(paperEntityDraft, force); - return paperEntityDraft; - } else { + } + + if (dblpVenueIdPaperKey.startsWith("dblp://") && (paperEntityDraft.publication === "" || paperEntityDraft.publication === dblpVenueIdPaperKey)) { + console.log(dblpVenueIdPaperKey) + const { venueID, paperKey } = JSON.parse(dblpVenueIdPaperKey.replace("dblp://", "")) as { venueID: string, paperKey: string } + console.log(venueID, paperKey) + + paperEntityDraft.publication = venueID const { scrapeURL, headers, enable } = this.preProcess( paperEntityDraft ) as ScraperRequestType; @@ -338,9 +361,26 @@ async function venueScrapeImpl( )) as Response; } - return this.parsingProcess(response, paperEntityDraft) as PaperEntity; - } else { - return paperEntityDraft; + // Try to fetch bib to handel workshop papers + const bibURL = `https://${response ? 'dblp.org' : 'dblp.uni-trier.de'}/rec/${paperKey}.bib?param=1` + const bibResponse = (await window.networkTool.get( + bibURL, + headers + )) as Response; + + paperEntityDraft = this.parsingProcess( + { + 'apiResponse': response, + 'bibResponse': bibResponse + }, + paperEntityDraft) as PaperEntity; + } + + if (paperEntityDraft.publication === venueID) { + paperEntityDraft.publication = "" } + } + + return paperEntityDraft; } \ No newline at end of file diff --git a/app/repositories/scraper-repository/scrapers/google-scholar.ts b/app/repositories/scraper-repository/scrapers/google-scholar.ts index 973659fa..995cb4fe 100644 --- a/app/repositories/scraper-repository/scrapers/google-scholar.ts +++ b/app/repositories/scraper-repository/scrapers/google-scholar.ts @@ -36,14 +36,14 @@ async function scrapeImpl( if (titleStr) { const plainHitTitle = formatString({ str: titleStr, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scrapers/ieee.ts b/app/repositories/scraper-repository/scrapers/ieee.ts index e15ba875..c9b61fc5 100644 --- a/app/repositories/scraper-repository/scrapers/ieee.ts +++ b/app/repositories/scraper-repository/scrapers/ieee.ts @@ -66,14 +66,14 @@ export class IEEEScraper extends Scraper { for (const article of response.articles) { const plainHitTitle = formatString({ str: article.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scrapers/openreview.ts b/app/repositories/scraper-repository/scrapers/openreview.ts index 68dc4769..31ccedfb 100644 --- a/app/repositories/scraper-repository/scrapers/openreview.ts +++ b/app/repositories/scraper-repository/scrapers/openreview.ts @@ -57,14 +57,16 @@ export class OpenreviewScraper extends Scraper { for (const note of notes) { const plainHitTitle = formatString({ str: note.content.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); + console.log(note) + const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); @@ -87,9 +89,15 @@ export class OpenreviewScraper extends Scraper { const type = note.content.venueid.includes("conf") ? "conf" : "journals"; - publication = `dblp://${type}/${note.content.venueid - .split("/")[2] - .toLowerCase()}`; + + const venueID = type + '/' + note.content.venueid.split("/")[2].toLowerCase(); + if (!venueID.includes("journals/corr")) { + publication = `dblp://${JSON.stringify({ 'venueID': venueID, 'paperKey': '' })}`; + } else { + publication = ""; + } + + } else { publication = note.content.venue; } @@ -97,7 +105,7 @@ export class OpenreviewScraper extends Scraper { const pubTimeReg = note.content.venueid.match(/\d{4}/g); const pubTime = pubTimeReg ? pubTimeReg[0] : ""; - paperEntityDraft.setValue("pubTime", `${pubTime}`); + paperEntityDraft.setValue("pubTime", `${pubTime} `); paperEntityDraft.setValue("publication", publication); } } else { @@ -107,7 +115,7 @@ export class OpenreviewScraper extends Scraper { ) { const pubTimeReg = note.content._bibtex.match(/year={(\d{4})/); const pubTime = pubTimeReg ? pubTimeReg[1] : ""; - paperEntityDraft.setValue("pubTime", `${pubTime}`); + paperEntityDraft.setValue("pubTime", `${pubTime} `); } paperEntityDraft.setValue("publication", "openreview.net"); } diff --git a/app/repositories/scraper-repository/scrapers/paperlib.ts b/app/repositories/scraper-repository/scrapers/paperlib.ts index 0f34d88f..976e736c 100644 --- a/app/repositories/scraper-repository/scrapers/paperlib.ts +++ b/app/repositories/scraper-repository/scrapers/paperlib.ts @@ -15,7 +15,7 @@ export class PaperlibScraper extends Scraper { const shortTitle = formatString({ str: paperEntityDraft.title, removeWhite: true, - removeStr: "&", + removeStr: "&", }); let scrapeURL = `https://api.paperlib.app/pubs/query?`; const queryParams = [] diff --git a/app/repositories/scraper-repository/scrapers/paperwithcode.ts b/app/repositories/scraper-repository/scrapers/paperwithcode.ts index bc70e99b..6b9eb0ef 100644 --- a/app/repositories/scraper-repository/scrapers/paperwithcode.ts +++ b/app/repositories/scraper-repository/scrapers/paperwithcode.ts @@ -11,7 +11,7 @@ export class PwCScraper extends Scraper { const connectedTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", lowercased: true, trimWhite: true, }) @@ -105,7 +105,7 @@ async function scrapeImpl( }; const targetTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); @@ -115,7 +115,7 @@ async function scrapeImpl( for (const result of searchResponse.results) { const hitTitle = formatString({ str: result.paper.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scrapers/scopus.ts b/app/repositories/scraper-repository/scrapers/scopus.ts index 3392bea0..668a391b 100644 --- a/app/repositories/scraper-repository/scrapers/scopus.ts +++ b/app/repositories/scraper-repository/scrapers/scopus.ts @@ -66,14 +66,14 @@ export class ScopusScraper extends Scraper { for (const item of parsedResponse["search-results"].entry) { const plainHitTitle = formatString({ str: item["dc:title"], - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scrapers/semanticscholar.ts b/app/repositories/scraper-repository/scrapers/semanticscholar.ts index 8feb3fa9..afbc5921 100644 --- a/app/repositories/scraper-repository/scrapers/semanticscholar.ts +++ b/app/repositories/scraper-repository/scrapers/semanticscholar.ts @@ -65,14 +65,14 @@ export class SemanticScholarScraper extends Scraper { for (const item of parsedResponse.data) { const plainHitTitle = formatString({ str: item.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scrapers/spie.ts b/app/repositories/scraper-repository/scrapers/spie.ts index ef5cc4d0..48ab02cb 100644 --- a/app/repositories/scraper-repository/scrapers/spie.ts +++ b/app/repositories/scraper-repository/scrapers/spie.ts @@ -55,14 +55,14 @@ export class SPIEScraper extends Scraper { for (const item of results.Items) { const plainHitTitle = formatString({ str: item.Title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/repositories/scraper-repository/scrapers/springer.ts b/app/repositories/scraper-repository/scrapers/springer.ts index 3cf2834f..993d660a 100644 --- a/app/repositories/scraper-repository/scrapers/springer.ts +++ b/app/repositories/scraper-repository/scrapers/springer.ts @@ -66,14 +66,14 @@ export class SpringerScraper extends Scraper { for (const item of parsedResponse.records) { const plainHitTitle = formatString({ str: item.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); const existTitle = formatString({ str: paperEntityDraft.title, - removeStr: "&", + removeStr: "&", removeSymbol: true, lowercased: true, }); diff --git a/app/utils/string.ts b/app/utils/string.ts index b695bf57..542a85dd 100644 --- a/app/utils/string.ts +++ b/app/utils/string.ts @@ -26,6 +26,9 @@ export const formatString = ({ } let formatted = str; if (formatted) { + if (removeStr) { + formatted = formatted.replaceAll(removeStr, ""); + } if (removeNewline) { formatted = formatted.replace(/(\r\n|\n|\r)/gm, ""); } @@ -38,9 +41,7 @@ export const formatString = ({ if (removeSymbol) { formatted = formatted.replace(/[^\p{L}|\s]/gu, ""); } - if (removeStr) { - formatted = formatted.replace(new RegExp(removeStr, "g"), ""); - } + if (lowercased) { formatted = formatted.toLowerCase(); } From c6e555fbb87b6d68989f10af3a88a6fd874372a4 Mon Sep 17 00:00:00 2001 From: geoffreychen777 Date: Wed, 4 Jan 2023 12:55:38 +0000 Subject: [PATCH 2/8] fix bug --- app/repositories/scraper-repository/scrapers/dblp.ts | 6 +----- app/repositories/scraper-repository/scrapers/openreview.ts | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/repositories/scraper-repository/scrapers/dblp.ts b/app/repositories/scraper-repository/scrapers/dblp.ts index 310bff06..d67a806b 100644 --- a/app/repositories/scraper-repository/scrapers/dblp.ts +++ b/app/repositories/scraper-repository/scrapers/dblp.ts @@ -104,9 +104,7 @@ function parsingProcess( paperEntityDraft.setValue("authors", authors); paperEntityDraft.setValue("pubTime", `${pubTime}`); paperEntityDraft.setValue("pubType", pubType); - if (pubKey == "journals/corr") { - paperEntityDraft.setValue("publication", "dblp://" + JSON.stringify({ 'venueID': pubKey == "journals/corr" ? venueKey : pubKey, 'paperKey': paperKey })); - } + paperEntityDraft.setValue("publication", "dblp://" + JSON.stringify({ 'venueID': pubKey == "journals/corr" ? venueKey : pubKey, 'paperKey': paperKey })); if (article.volume) { paperEntityDraft.setValue("volume", article.volume); @@ -331,9 +329,7 @@ async function venueScrapeImpl( } if (dblpVenueIdPaperKey.startsWith("dblp://") && (paperEntityDraft.publication === "" || paperEntityDraft.publication === dblpVenueIdPaperKey)) { - console.log(dblpVenueIdPaperKey) const { venueID, paperKey } = JSON.parse(dblpVenueIdPaperKey.replace("dblp://", "")) as { venueID: string, paperKey: string } - console.log(venueID, paperKey) paperEntityDraft.publication = venueID const { scrapeURL, headers, enable } = this.preProcess( diff --git a/app/repositories/scraper-repository/scrapers/openreview.ts b/app/repositories/scraper-repository/scrapers/openreview.ts index 31ccedfb..62fbbe2d 100644 --- a/app/repositories/scraper-repository/scrapers/openreview.ts +++ b/app/repositories/scraper-repository/scrapers/openreview.ts @@ -62,8 +62,6 @@ export class OpenreviewScraper extends Scraper { lowercased: true, }); - console.log(note) - const existTitle = formatString({ str: paperEntityDraft.title, removeStr: "&", From 77e38450fd6cf17c7d3fb6477030bd6db5961c81 Mon Sep 17 00:00:00 2001 From: geoffreychen777 Date: Wed, 4 Jan 2023 13:25:10 +0000 Subject: [PATCH 3/8] fix special char in bib output. --- .../reference-repository/reference-repository.ts | 9 +++++++-- app/repositories/scraper-repository/scrapers/doi.ts | 2 +- .../scraper-repository/scrapers/openreview.ts | 2 +- app/repositories/scraper-repository/scrapers/spie.ts | 2 +- app/repositories/scraper-repository/scrapers/springer.ts | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/repositories/reference-repository/reference-repository.ts b/app/repositories/reference-repository/reference-repository.ts index 4c5d607a..c735828a 100644 --- a/app/repositories/reference-repository/reference-repository.ts +++ b/app/repositories/reference-repository/reference-repository.ts @@ -9,6 +9,11 @@ import { Preference } from "@/preference/preference"; import { MainRendererStateStore } from "@/state/renderer/appstate"; import { formatString } from "@/utils/string"; +function escapeLaTexString(str: string) { + const out = str.replaceAll("&", "\\&").replaceAll("%", "\\%").replaceAll("$", "\\$").replaceAll("#", "\\#"); + return out +} + export class ReferenceRepository { stateStore: MainRendererStateStore; preference: Preference; @@ -49,7 +54,7 @@ export class ReferenceRepository { for (const word of titleArray) { if ( word.toLocaleLowerCase() !== "the" || - word.toLocaleLowerCase() !== "a" + word.toLocaleLowerCase() !== "a" || word.toLocaleLowerCase() !== "an" || word.length <= 3 ) { citeKey += formatString({ str: word.toLowerCase(), @@ -159,7 +164,7 @@ export class ReferenceRepository { } exportBibTexBody(cite: Cite): string { - return cite.format("bibtex"); + return escapeLaTexString(cite.format("bibtex")); } async exportPlainText(cite: Cite): Promise { diff --git a/app/repositories/scraper-repository/scrapers/doi.ts b/app/repositories/scraper-repository/scrapers/doi.ts index a84809f7..3caabedd 100644 --- a/app/repositories/scraper-repository/scrapers/doi.ts +++ b/app/repositories/scraper-repository/scrapers/doi.ts @@ -49,7 +49,7 @@ export class DOIScraper extends Scraper { issue: string; subtitle: string[]; }; - const title = [response.title, response.subtitle.join(' ')].filter(t => t !== '').join(" - "); + const title = [response.title, response.subtitle.join(' ')].filter(t => t !== '').join(" - ").replaceAll('&', '&'); const authors = response.author .map((author) => { if (author.name) { diff --git a/app/repositories/scraper-repository/scrapers/openreview.ts b/app/repositories/scraper-repository/scrapers/openreview.ts index 62fbbe2d..65c2349d 100644 --- a/app/repositories/scraper-repository/scrapers/openreview.ts +++ b/app/repositories/scraper-repository/scrapers/openreview.ts @@ -71,7 +71,7 @@ export class OpenreviewScraper extends Scraper { const sim = stringSimilarity.compareTwoStrings(plainHitTitle, existTitle); if (sim > 0.95) { - const title = note.content.title; + const title = note.content.title.replaceAll('&', '&'); const authors = note.content.authors.join(", "); paperEntityDraft.setValue("title", title); diff --git a/app/repositories/scraper-repository/scrapers/spie.ts b/app/repositories/scraper-repository/scrapers/spie.ts index 48ab02cb..8115f8fb 100644 --- a/app/repositories/scraper-repository/scrapers/spie.ts +++ b/app/repositories/scraper-repository/scrapers/spie.ts @@ -69,7 +69,7 @@ export class SPIEScraper extends Scraper { const sim = stringSimilarity.compareTwoStrings(plainHitTitle, existTitle); if (sim > 0.95) { - paperEntityDraft.setValue("title", item.Title, false); + paperEntityDraft.setValue("title", item.Title.replaceAll('&', '&'), false); paperEntityDraft.setValue("doi", item.DOI, false); if (item.PublicationType.toLowerCase().includes("journal")) { diff --git a/app/repositories/scraper-repository/scrapers/springer.ts b/app/repositories/scraper-repository/scrapers/springer.ts index 993d660a..990f1b32 100644 --- a/app/repositories/scraper-repository/scrapers/springer.ts +++ b/app/repositories/scraper-repository/scrapers/springer.ts @@ -80,7 +80,7 @@ export class SpringerScraper extends Scraper { const sim = stringSimilarity.compareTwoStrings(plainHitTitle, existTitle); if (sim > 0.95) { - paperEntityDraft.setValue("title", item.title, false); + paperEntityDraft.setValue("title", item.title.replaceAll('&', '&'), false); paperEntityDraft.setValue("doi", item.doi, false); if (item.contentType.toLowerCase().includes("journal")) { From d55a17e26b4a99b471b5ddbca18c1b87f9caa4f8 Mon Sep 17 00:00:00 2001 From: geoffreychen777 Date: Wed, 4 Jan 2023 13:26:08 +0000 Subject: [PATCH 4/8] fix bug --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1758fa0f..1efdcace 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "paperlib", - "version": "2.1.4", + "version": "2.1.5-rc.1", "main": "dist/app/main/index.js", "description": "A simple academic paper management tool.", "author": "Geoffrey Chen ", From b2d1ffdfa2e1b894e088a70f718bd618a58e7e0b Mon Sep 17 00:00:00 2001 From: geoffreychen777 Date: Wed, 4 Jan 2023 13:54:10 +0000 Subject: [PATCH 5/8] fix bug --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1efdcace..83cc43c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "paperlib", - "version": "2.1.5-rc.1", + "version": "2.1.5-dev.rc1", "main": "dist/app/main/index.js", "description": "A simple academic paper management tool.", "author": "Geoffrey Chen ", From 9042f1692da08b25e50ebe2c06fa53ebbed215cb Mon Sep 17 00:00:00 2001 From: geoffreychen777 Date: Sat, 7 Jan 2023 10:44:25 +0000 Subject: [PATCH 6/8] Fix space pressing bug in the plugin window. --- app/renderer/ui/app-view.vue | 2 ++ app/renderer/ui/main-view/main-view.vue | 5 +++++ app/state/renderer/appstate.ts | 1 + app/state/states.ts | 1 + 4 files changed, 9 insertions(+) diff --git a/app/renderer/ui/app-view.vue b/app/renderer/ui/app-view.vue index 3151a325..40585053 100644 --- a/app/renderer/ui/app-view.vue +++ b/app/renderer/ui/app-view.vue @@ -211,10 +211,12 @@ watch( ); window.appInteractor.registerMainSignal("window-lost-focus", (_: any) => { + viewState.mainViewFocused = false; void window.appInteractor.pauseSync(); }); window.appInteractor.registerMainSignal("window-gained-focus", (_) => { + viewState.mainViewFocused = true; void window.appInteractor.resumeSync(); }); diff --git a/app/renderer/ui/main-view/main-view.vue b/app/renderer/ui/main-view/main-view.vue index 688169a9..3d7062fe 100644 --- a/app/renderer/ui/main-view/main-view.vue +++ b/app/renderer/ui/main-view/main-view.vue @@ -356,6 +356,7 @@ window.appInteractor.registerMainSignal("shortcut-Preference", () => { window.appInteractor.registerMainSignal("shortcut-Enter", () => { if ( + viewState.mainViewFocused && !viewState.inputFieldFocused && (selectedPaperEntities.value.length >= 1 || selectedFeedEntities.value.length >= 1) && @@ -369,6 +370,7 @@ window.appInteractor.registerMainSignal("shortcut-Enter", () => { window.appInteractor.registerMainSignal("shortcut-Space", () => { if ( + viewState.mainViewFocused && !viewState.inputFieldFocused && selectedPaperEntities.value.length >= 1 && !viewState.isDeleteConfirmShown && @@ -380,6 +382,9 @@ window.appInteractor.registerMainSignal("shortcut-Space", () => { }); function preventSpaceArrowScrollEvent(event: KeyboardEvent) { + if (!viewState.mainViewFocused) { + return true; + } if ( event.code === "Space" || event.code === "ArrowDown" || diff --git a/app/state/renderer/appstate.ts b/app/state/renderer/appstate.ts index a3aff67e..0aec7192 100644 --- a/app/state/renderer/appstate.ts +++ b/app/state/renderer/appstate.ts @@ -88,6 +88,7 @@ export class MainRendererStateStore extends RendererStateStore { // inputFieldFocused: false, + mainViewFocused: true, // Update Signal realmReiniting: 0, diff --git a/app/state/states.ts b/app/state/states.ts index a6eb7b7b..3e34656c 100644 --- a/app/state/states.ts +++ b/app/state/states.ts @@ -32,6 +32,7 @@ export interface ViewState { feedEntityAddingStatus: number; detailsOnDragging: boolean; + mainViewFocused: boolean; inputFieldFocused: boolean; realmReiniting: number; From 15611fc564431f2beb72946c92d49cba274bfb6d Mon Sep 17 00:00:00 2001 From: geoffreychen777 Date: Sat, 7 Jan 2023 11:03:14 +0000 Subject: [PATCH 7/8] Disable sorting by tags and folders --- app/renderer/ui/main-view/data-view/paper-data-view.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/renderer/ui/main-view/data-view/paper-data-view.vue b/app/renderer/ui/main-view/data-view/paper-data-view.vue index 82abbce9..c67add27 100644 --- a/app/renderer/ui/main-view/data-view/paper-data-view.vue +++ b/app/renderer/ui/main-view/data-view/paper-data-view.vue @@ -176,6 +176,9 @@ const resetTableTitleColumns = (reset = false) => { }; const onTableTitleClicked = (key: string) => { + if (key === "tags" || key === "folders") { + return; + } prefState.mainviewSortBy = key; prefState.mainviewSortOrder = prefState.mainviewSortOrder === "asce" ? "desc" : "asce"; From 1c6e14b75245a742d0c4b6277a478020f1ab2683 Mon Sep 17 00:00:00 2001 From: geoffreychen777 Date: Sat, 7 Jan 2023 11:11:22 +0000 Subject: [PATCH 8/8] v2.1.5 rc2 --- CHANGELOG_CN.md | 6 ++++++ CHANGELOG_EN.md | 6 ++++++ app/renderer/ui/whats-new-view/whats-new-view-cn.vue | 6 +++--- app/renderer/ui/whats-new-view/whats-new-view-en.vue | 8 ++++---- package.json | 2 +- release-notes.md | 5 +++-- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/CHANGELOG_CN.md b/CHANGELOG_CN.md index 942290cc..e941c557 100644 --- a/CHANGELOG_CN.md +++ b/CHANGELOG_CN.md @@ -1,3 +1,9 @@ +## v2.1.5 07/01 2023 + +1. 优化 DBLP scaper 对部分 workshop 论文的检索结果。 +2. 修复 BibTex 输出中一些特殊字符的问题。 +3. 修复一些 Bug。 + ## v2.1.4 31/12 2022 1. 修复 Bug。 diff --git a/CHANGELOG_EN.md b/CHANGELOG_EN.md index 90fc8890..3d04fcee 100644 --- a/CHANGELOG_EN.md +++ b/CHANGELOG_EN.md @@ -1,3 +1,9 @@ +## v2.1.5 Jan 07 2023 + +1. Enhance the DBLP scaper for some workshop papers. +2. Fixed the bibtex output for special char. +3. Fixed some bugs + ## v2.1.4 Dec 31 2022 1. Enhance the DBLP scaper for ICLR 2016. diff --git a/app/renderer/ui/whats-new-view/whats-new-view-cn.vue b/app/renderer/ui/whats-new-view/whats-new-view-cn.vue index 10c052ef..7271a22f 100644 --- a/app/renderer/ui/whats-new-view/whats-new-view-cn.vue +++ b/app/renderer/ui/whats-new-view/whats-new-view-cn.vue @@ -86,13 +86,13 @@ onMounted(() => { v-else />

- Paperlib 2.1.4 更新内容 + Paperlib 2.1.5 更新内容

    -
  • 优化 DBLP scaper 对 ICLR 2016 的检索结果。
  • +
  • 优化 DBLP scaper 对部分 workshop 论文的检索结果。
  • +
  • 修复 BibTex 输出中一些特殊字符的问题。
  • 修复一些 Bug。
  • -
  • 新年快乐!
{ v-else />

- What's New in Paperlib 2.1.4 + What's New in Paperlib 2.1.5

    -
  • Enhance the DBLP scaper for ICLR 2016.
  • -
  • Fixed some bugs.
  • -
  • Happy New Year!
  • +
  • Enhance the DBLP scaper for some workshop papers.
  • +
  • Fixed the bibtex output for special char.
  • +
  • Fixed some bugs
", diff --git a/release-notes.md b/release-notes.md index cb57c34a..6abc3d35 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,2 +1,3 @@ -1. Enhance the DBLP scaper for ICLR 2016. -2. Fixed some bugs. \ No newline at end of file +1. Enhance the DBLP scaper for some workshop papers. +2. Fixed the bibtex output for special char. +3. Fixed some bugs. \ No newline at end of file