Skip to content

Commit

Permalink
lint and fix online_identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
felixleo22 committed Apr 25, 2024
1 parent c741330 commit fff3bf5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions ob/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Parser = require('../.lib/parser.js');
*/
module.exports = new Parser(function analyseEC(parsedUrl, ec) {
let result = {};
let path = parsedUrl.pathname;
let path = parsedUrl.pathname;
// uncomment this line if you need parameters
let param = parsedUrl.query || {};

Expand All @@ -24,15 +24,15 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {
if ((match = /^\/search$/i.exec(path)) !== null) {
// https://www.oxfordbibliographies.com/search?sticky=true&type=document&q=terrorism&searchBtn=Search&module_0=obo-9780199846733&module_1=obo-9780199827251&module_2=obo-9780199730414&module_3=obo-9780195393361&module_4=obo-9780199846719&module_5=obo-9780195393521&module_6=obo-9780199920082&module_7=obo-9780199791286&module_8=obo-9780195389661&module_9=obo-9780195399318&module_10=obo-9780199796953&module_11=obo-9780195390155&module_12=obo-9780199840731&module_13=obo-9780199913701&module_14=obo-9780190221911&module_15=obo-9780195396584&module_16=obo-9780199791279&module_17=obo-9780199757824&module_18=obo-9780195396577&module_19=obo-9780195399301&module_20=obo-9780199799558
// https://www.oxfordbibliographies.com/search?sticky=true&type=document&q=economy&searchBtn=Search&module_0=obo-9780199846733&module_1=obo-9780199827251&module_2=obo-9780199730414&module_3=obo-9780195393361&module_4=obo-9780199846719&module_5=obo-9780195393521&module_6=obo-9780199920082&module_7=obo-9780199791286&module_8=obo-9780195389661&module_9=obo-9780195399318&module_10=obo-9780199796953&module_11=obo-9780195390155&module_12=obo-9780199840731&module_13=obo-9780199913701&module_14=obo-9780190221911&module_15=obo-9780195396584&module_16=obo-9780199791279&module_17=obo-9780199757824&module_18=obo-9780195396577&module_19=obo-9780195399301&module_20=obo-9780199799558
result.rtype = 'SEARCH';
result.mime = 'HTML';
result.rtype = 'SEARCH';
result.mime = 'HTML';
} else if ((match = /^\/display\/document\/([a-zA-Z0-9-]+)\/([a-zA-Z0-9-]+).xml$/i.exec(path)) !== null) {
// https://www.oxfordbibliographies.com/display/document/obo-9780199941728/obo-9780199941728-0110.xml?rskey=9t8ng0&result=1#obo-9780199941728-0110-div1-0004
// https://www.oxfordbibliographies.com/display/document/obo-9780199941728/obo-9780199941728-0024.xml?rskey=9t8ng0&result=7#null
result.rtype = 'ARTICLE';
result.mime = 'HTML';
result.online_identifier = match[2];
result.unitid = `${match[1]}/${match[2]}.xml?rskey=${param.rskey}&result=${param.result}${parsedUrl.hash}`;
result.rtype = 'ARTICLE';
result.mime = 'HTML';
result.online_identifier = match[1].split('-')[1];
result.unitid = `${match[1]}/${match[2]}.xml?rskey=${param.rskey}&result=${param.result}${parsedUrl.hash}`;
}

return result;
Expand Down
4 changes: 2 additions & 2 deletions ob/test/OB.2024-04-25.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
out-online_identifier;out-unitid;out-rtype;out-mime;in-url
obo-9780199941728-0024;obo-9780199941728/obo-9780199941728-0024.xml?rskey=9t8ng0&result=7#null;ARTICLE;HTML;https://www.oxfordbibliographies.com/display/document/obo-9780199941728/obo-9780199941728-0024.xml?rskey=9t8ng0&result=7#null
obo-9780199941728-0110;obo-9780199941728/obo-9780199941728-0110.xml?rskey=9t8ng0&result=1#obo-9780199941728-0110-div1-0004;ARTICLE;HTML;https://www.oxfordbibliographies.com/display/document/obo-9780199941728/obo-9780199941728-0110.xml?rskey=9t8ng0&result=1#obo-9780199941728-0110-div1-0004
9780199941728;obo-9780199941728/obo-9780199941728-0024.xml?rskey=9t8ng0&result=7#null;ARTICLE;HTML;https://www.oxfordbibliographies.com/display/document/obo-9780199941728/obo-9780199941728-0024.xml?rskey=9t8ng0&result=7#null
9780199941728;obo-9780199941728/obo-9780199941728-0110.xml?rskey=9t8ng0&result=1#obo-9780199941728-0110-div1-0004;ARTICLE;HTML;https://www.oxfordbibliographies.com/display/document/obo-9780199941728/obo-9780199941728-0110.xml?rskey=9t8ng0&result=1#obo-9780199941728-0110-div1-0004
;;SEARCH;HTML;https://www.oxfordbibliographies.com/search?sticky=true&type=document&q=economy&searchBtn=Search&module_0=obo-9780199846733&module_1=obo-9780199827251&module_2=obo-9780199730414&module_3=obo-9780195393361&module_4=obo-9780199846719&module_5=obo-9780195393521&module_6=obo-9780199920082&module_7=obo-9780199791286&module_8=obo-9780195389661&module_9=obo-9780195399318&module_10=obo-9780199796953&module_11=obo-9780195390155&module_12=obo-9780199840731&module_13=obo-9780199913701&module_14=obo-9780190221911&module_15=obo-9780195396584&module_16=obo-9780199791279&module_17=obo-9780199757824&module_18=obo-9780195396577&module_19=obo-9780195399301&module_20=obo-9780199799558
;;SEARCH;HTML;https://www.oxfordbibliographies.com/search?sticky=true&type=document&q=terrorism&searchBtn=Search&module_0=obo-9780199846733&module_1=obo-9780199827251&module_2=obo-9780199730414&module_3=obo-9780195393361&module_4=obo-9780199846719&module_5=obo-9780195393521&module_6=obo-9780199920082&module_7=obo-9780199791286&module_8=obo-9780195389661&module_9=obo-9780195399318&module_10=obo-9780199796953&module_11=obo-9780195390155&module_12=obo-9780199840731&module_13=obo-9780199913701&module_14=obo-9780190221911&module_15=obo-9780195396584&module_16=obo-9780199791279&module_17=obo-9780199757824&module_18=obo-9780195396577&module_19=obo-9780195399301&module_20=obo-9780199799558

0 comments on commit fff3bf5

Please sign in to comment.