File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ UIKit.use(Icons);
12
12
13
13
const TEST_URL = 'https://arxiv.org/abs/2308.04079' ;
14
14
const ARXIV_API = 'http://export.arxiv.org/api/query/search_query' ;
15
-
16
15
class UI {
17
16
constructor ( ) {
18
17
this . setupProgressBar ( ) ;
@@ -101,10 +100,9 @@ class UI {
101
100
if ( this . isArxivUrl ( url ) ) return this . getArXivInfo ( url ) ;
102
101
if ( this . isOpenReviewUrl ( url ) ) return this . getOpenReviewInfo ( url ) ;
103
102
}
104
- parseArXivId ( str ) {
105
- const paperId = str . match ( / \d + .\d + / ) ;
106
- return paperId ;
107
- }
103
+ // ref: https://info.arxiv.org/help/arxiv_identifier.html
104
+ // e.g. (new id format: 2404.16782) | (old id format: hep-th/0702063)
105
+ parseArXivId = ( str ) => str . match ( / ( \d + \. \d + $ ) | ( ( \w | - ) + \/ \d + $ ) / ) ?. [ 0 ] ;
108
106
109
107
setFormContents ( paperTitle , abst , comment , authors ) {
110
108
document . getElementById ( 'js-title' ) . value = paperTitle ;
@@ -135,7 +133,7 @@ class UI {
135
133
console . log ( xmlData ) ;
136
134
137
135
const entry = xmlData . querySelector ( 'entry' ) ;
138
- const id = entry . querySelector ( 'id' ) ?. textContent . match ( / \d + \. \d + / ) ?. [ 0 ] ;
136
+ const id = this . parseArXivId ( entry . querySelector ( 'id' ) ?. textContent ) ;
139
137
const paperTitle = entry . querySelector ( 'title' ) . textContent ;
140
138
const abst = entry . querySelector ( 'summary' ) . textContent ;
141
139
const authors = Array . from ( entry . querySelectorAll ( 'author' ) ) . map (
You can’t perform that action at this time.
0 commit comments