Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support old arxiv papers #139

Merged
merged 4 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const fetchPWCData = async (arxivId, title) => {
const findCodesForPaper = async (request) => {
let arxivId, title, code;
if (request.paper.source === "arxiv") {
arxivId = request.paper.id.split("-").last();
arxivId = request.paper.id.split("-").last().replace("_", "/");
} else {
title = request.paper.title;
}
Expand Down
2 changes: 1 addition & 1 deletion src/popup/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const popupMain = async (url, is, manualTrigger = false) => {
// ----- SVG clicks -----
// ------------------------
addListener(`popup-memory-item-scirate--${id}`, "click", () => {
const arxivId = paper.id.split("-").last();
const arxivId = paper.id.split("-").last().replace("_", "/");
const scirateURL = `https://scirate.com/arxiv/${arxivId}`;
chrome.tabs.update({ url: scirateURL });
window.close();
Expand Down
2 changes: 1 addition & 1 deletion src/popup/min/popup.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/shared/js/utils/paper.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ const parseIdFromUrl = async (url) => {
.replace("/abs/", "/pdf/")
.split("/pdf/")[1]
.replace(".pdf", "")
.split("v")[0];
.split("v")[0]
.replace("/", "_");
idForUrl = `Arxiv-${arxivId}`;

const existingIds = Object.values(global.state.titleHashToIds).find((ids) =>
Expand Down
6 changes: 3 additions & 3 deletions src/shared/js/utils/parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const flipAndAuthors = (authors) =>
// -------------------

const fetchArxivXML = async (paperId) => {
const arxivId = paperId.replace("Arxiv-", "");
const arxivId = paperId.replace("Arxiv-", "").replace("_", "/");
return fetch(
"https://export.arxiv.org/api/query?" +
new URLSearchParams({ id_list: arxivId })
Expand Down Expand Up @@ -304,14 +304,14 @@ const makeArxivPaper = async (url) => {
year +
firstNonStopLowercase(title);

const id = `Arxiv-${arxivId}`;
const id = `Arxiv-${arxivId.replace("/", "_")}`;

let bibtex = "";
bibtex += `@article{${key},\n`;
bibtex += ` title={${title} },\n`;
bibtex += ` author={${author} },\n`;
bibtex += ` year={${year}},\n`;
bibtex += ` journal={arXiv preprint arXiv: ${id}}\n`;
bibtex += ` journal={arXiv preprint arXiv: ${arxivId}}\n`;
bibtex += `}`;

const venue = "";
Expand Down
10 changes: 5 additions & 5 deletions src/shared/min/utils.min.js

Large diffs are not rendered by default.