-
Notifications
You must be signed in to change notification settings - Fork 774
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
DOI: Pull DOIs from URL #2967
DOI: Pull DOIs from URL #2967
Conversation
If only the URL contains a DOI (or the URL contains a DOI and the body contains only that same DOI), we now detect a single `journalArticle` item and don't show the Select Items dialog. Also optimized the page-scraping code a little bit by replacing Array#includes() calls (O(n^2) overall) with Set#has() (O(n) overall).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good otherwise!
We can add a test for single-item detection (DOI in URL and no other DOIs on the page) if we can find an example, but I really could not. Pages with a DOI in the URL almost always contain another DOI somewhere. |
I can find you an example that has the same DOI on the page but no others, would that do? |
Yeah, that would. |
Thanks! With the other fix included in that last commit, we now have two tests for single items. |
If only the URL contains a DOI (or the URL contains a DOI and the body contains only that same DOI), we now detect a single
journalArticle
item and don't show the Select Items dialog.Also optimized the page-scraping code a little bit by replacing
Array#includes()
calls (O(n^2) overall) withSet#has()
(O(n) overall).Fixes #2964