Skip to content

Commit

Permalink
Fix Dagstuhl Research Online Publication Server translator
Browse files Browse the repository at this point in the history
This commit fixes the Dagstuhl Research Online Publication Server translator by updating the outdated URL structure and correcting XPATH queries.
  • Loading branch information
bardiharborow committed Nov 30, 2024
1 parent 9f1d764 commit 60bee0a
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions Dagstuhl Research Online Publication Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"translatorID": "0526c18d-8dc8-40c9-8314-399e0b743a4d",
"label": "Dagstuhl Research Online Publication Server",
"creator": "Philipp Zumstein",
"target": "^https?://(www\\.)?drops\\.dagstuhl\\.de/opus/",
"target": "^https?://(www\\.)?drops\\.dagstuhl\\.de/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2016-08-23 06:54:08"
"lastUpdated": "2024-11-30 08:09:40"
}

/*
Expand All @@ -36,8 +36,8 @@
*/

function detectWeb(doc, url) {

Check failure on line 38 in Dagstuhl Research Online Publication Server.js

View workflow job for this annotation

GitHub Actions / Lint, Check, Test

Expected to return a value at the end of function 'detectWeb'
if (url.indexOf('source_opus')>-1 || url.indexOf('volltexte')>-1) {
var bibtexEntry = ZU.xpathText(doc, '//pre/tt');
if (url.indexOf('/entities/document/') > -1) {

Check warning on line 39 in Dagstuhl Research Online Publication Server.js

View workflow job for this annotation

GitHub Actions / Lint, Check, Test

Unnecessary '.indexOf()', use '.includes()' instead
var bibtexEntry = ZU.xpathText(doc, "//pre[contains(@class, 'bibtex')]");
if (bibtexEntry.indexOf("@InCollection")>-1) {

Check warning on line 41 in Dagstuhl Research Online Publication Server.js

View workflow job for this annotation

GitHub Actions / Lint, Check, Test

Unnecessary '.indexOf()', use '.includes()' instead

Check warning on line 41 in Dagstuhl Research Online Publication Server.js

View workflow job for this annotation

GitHub Actions / Lint, Check, Test

Operator '>' must be spaced
return "bookSection";
}
Expand All @@ -53,7 +53,7 @@ function detectWeb(doc, url) {
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = ZU.xpath(doc, '//b/a[contains(@href, "source_opus")]|//td/a[contains(@href, "source_opus")]');//
var rows = ZU.xpath(doc, "//a[contains(@href, '/entities/document/')]");//
for (var i=0; i<rows.length; i++) {

Check warning on line 57 in Dagstuhl Research Online Publication Server.js

View workflow job for this annotation

GitHub Actions / Lint, Check, Test

Operator '=' must be spaced

Check warning on line 57 in Dagstuhl Research Online Publication Server.js

View workflow job for this annotation

GitHub Actions / Lint, Check, Test

Operator '<' must be spaced
var href = rows[i].href;
var title = ZU.trimInternal(rows[i].textContent);
Expand Down Expand Up @@ -84,9 +84,9 @@ function doWeb(doc, url) {
}

function scrape(doc, url) {

Check failure on line 86 in Dagstuhl Research Online Publication Server.js

View workflow job for this annotation

GitHub Actions / Lint, Check, Test

'url' is defined but never used. Allowed unused args must match /^_/u
var bibtexEntry = ZU.xpathText(doc, '//pre/tt');
var bibtexEntry = ZU.xpathText(doc, "//pre[contains(@class, 'bibtex')]");
//Z.debug(bibtexEntry);
var pdfurl = ZU.xpathText(doc, '//td//a[contains(@href, "pdf")]/@href');
var pdfurl = ZU.xpathText(doc, '//a[contains(@href, "pdf")]/@href');

var translator = Zotero.loadTranslator("import");
translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4");
Expand Down Expand Up @@ -124,15 +124,17 @@ function scrape(doc, url) {
});
translator.translate();

Check failure on line 125 in Dagstuhl Research Online Publication Server.js

View workflow job for this annotation

GitHub Actions / Lint, Check, Test

Block must not be padded by blank lines

}/** BEGIN TEST CASES **/
}

/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://drops.dagstuhl.de/opus/frontdoor.php?source_opus=4958",
"url": "https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.STACS.2015.1",
"items": [
{
"itemType": "conferencePaper",
"title": "Overcoming Intractability in Unsupervised Learning (Invited Talk)",
"title": "Overcoming Intractability in Unsupervised Learning",
"creators": [
{
"firstName": "Sanjeev",
Expand All @@ -153,18 +155,19 @@ var testCases = [
"date": "2015",
"DOI": "10.4230/LIPIcs.STACS.2015.1",
"ISBN": "9783939897781",
"itemID": "arora:LIPIcs:2015:4958",
"itemID": "arora:LIPIcs.STACS.2015.1",
"libraryCatalog": "Dagstuhl Research Online Publication Server",
"pages": "1–1",
"place": "Dagstuhl, Germany",
"proceedingsTitle": "32nd International Symposium on Theoretical Aspects of Computer Science (STACS 2015)",
"publisher": "Schloss DagstuhlLeibniz-Zentrum fuer Informatik",
"publisher": "Schloss DagstuhlLeibniz-Zentrum für Informatik",
"series": "Leibniz International Proceedings in Informatics (LIPIcs)",
"url": "http://drops.dagstuhl.de/opus/volltexte/2015/4958",
"url": "https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.STACS.2015.1",
"volume": "30",
"attachments": [
{
"title": "Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
},
{
"title": "Full Text PDF",
Expand All @@ -184,17 +187,17 @@ var testCases = [
},
{
"type": "web",
"url": "http://drops.dagstuhl.de/opus/portals/lipics/index.php?semnr=15001",
"url": "https://drops.dagstuhl.de/entities/volume/LIPIcs-volume-30",
"items": "multiple"
},
{
"type": "web",
"url": "http://drops.dagstuhl.de/opus/ergebnis.php?wer=opus&suchart=teil&Lines_Displayed=10&sort=o.date_year+DESC%2C+o.title&suchfeld1=freitext&suchwert1=&opt1=AND&opt2=AND&suchfeld3=date_year&suchwert3=&startindex=0&page=0&dir=2&suche=&suchfeld2=oa.person&suchwert2=Hauzar%2C%20David",
"url": "https://drops.dagstuhl.de/search?term=Hauzar%2C%20David",
"items": "multiple"
},
{
"type": "web",
"url": "http://drops.dagstuhl.de/opus/volltexte/2016/5933/",
"url": "https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.SoCG.2016.41",
"items": [
{
"itemType": "conferencePaper",
Expand Down Expand Up @@ -239,18 +242,19 @@ var testCases = [
"date": "2016",
"DOI": "10.4230/LIPIcs.SoCG.2016.41",
"ISBN": "9783959770095",
"itemID": "geyer_et_al:LIPIcs:2016:5933",
"itemID": "geyer_et_al:LIPIcs.SoCG.2016.41",
"libraryCatalog": "Dagstuhl Research Online Publication Server",
"pages": "41:1–41:15",
"place": "Dagstuhl, Germany",
"proceedingsTitle": "32nd International Symposium on Computational Geometry (SoCG 2016)",
"publisher": "Schloss DagstuhlLeibniz-Zentrum fuer Informatik",
"publisher": "Schloss DagstuhlLeibniz-Zentrum für Informatik",
"series": "Leibniz International Proceedings in Informatics (LIPIcs)",
"url": "http://drops.dagstuhl.de/opus/volltexte/2016/5933",
"url": "https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.SoCG.2016.41",
"volume": "51",
"attachments": [
{
"title": "Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
},
{
"title": "Full Text PDF",
Expand All @@ -269,4 +273,4 @@ var testCases = [
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

0 comments on commit 60bee0a

Please sign in to comment.