Skip to content

Commit

Permalink
Fix filename version regex
Browse files Browse the repository at this point in the history
  • Loading branch information
j3soon committed Apr 22, 2023
1 parent 9a74d8f commit d26f4a8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 7 additions & 3 deletions chrome/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ async function getArticleInfoAsync(id, pageType) {
const authors = [...entry.getElementsByTagName("name")].map((el) => el.textContent).join(", ");
const publishedYear = entry.getElementsByTagName("published")[0].textContent.split('-')[0];
const updatedYear = entry.getElementsByTagName("updated")[0].textContent.split('-')[0];
const versionRegexp = /^.*v([0-9]*)$/;
const version = entry.getElementsByTagName("link")[0].getAttribute("href").match(versionRegexp)[1];
return {
const versionRegexp = /^.*:\/\/(?:export\.)?arxiv\.org\/abs\/.*v([0-9]*)$/;
var version = '';
for (const el of entry.getElementsByTagName("link")) {
const match = el.getAttribute("href").match(versionRegexp);
if (match && match[1])
version = match[1];
} return {
escapedTitle,
newTitle,
firstAuthor,
Expand Down
9 changes: 7 additions & 2 deletions firefox/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ async function getArticleInfoAsync(id, pageType) {
const authors = [...entry.getElementsByTagName("name")].map((el) => el.textContent).join(", ");
const publishedYear = entry.getElementsByTagName("published")[0].textContent.split('-')[0];
const updatedYear = entry.getElementsByTagName("updated")[0].textContent.split('-')[0];
const versionRegexp = /^.*v([0-9]*)$/;
const version = entry.getElementsByTagName("link")[0].getAttribute("href").match(versionRegexp)[1];
const versionRegexp = /^.*:\/\/(?:export\.)?arxiv\.org\/abs\/.*v([0-9]*)$/;
var version = '';
for (const el of entry.getElementsByTagName("link")) {
const match = el.getAttribute("href").match(versionRegexp);
if (match && match[1])
version = match[1];
}
return {
escapedTitle,
newTitle,
Expand Down

0 comments on commit d26f4a8

Please sign in to comment.