Skip to content

Commit

Permalink
Merge pull request #139 from vict0rsch/old-arxiv
Browse files Browse the repository at this point in the history
  • Loading branch information
vict0rsch authored Feb 2, 2023
2 parents 0b7d6cc + 2d4750a commit e5dd10d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
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.

0 comments on commit e5dd10d

Please sign in to comment.