Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
felixleo22 committed Feb 26, 2024
1 parent 078a188 commit bf8ccf1
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions pmr/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 @@ -22,46 +22,53 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {
let match;

if ((match = /^\/content\/(([a-z]+)\/([0-9]+)\/([0-9]+)\/([0-9]+))\.full\.pdf$/i.exec(path)) !== null) {
// https://www.pm-research.com/content/iijpormgmt/39/4/4.full.pdf
// ;https://www.pm-research.com/content/iijpormgmt/50/1/82.full.pdf
result.rtype = 'ARTICLE';
result.mime = 'PDF';
// /content/iijpormgmt/39/4/4.full.pdf
// /content/iijpormgmt/50/1/82.full.pdf

result.rtype = 'ARTICLE';
result.mime = 'PDF';
result.db_id = match[2];
result.unitid = match[1];
result.vol = match[3];
result.issue = match[4];
result.first_page = match[5];

} else if ((match = /^\/content\/(([a-z]+)\/([0-9]+)\/([0-9]+))\/local\/complete-issue\.pdf$/i.exec(path)) !== null) {
// https://www.pm-research.com/content/iijpormgmt/50/1/local/complete-issue.pdf
//https://www.pm-research.com/content/iijpormgmt/45/6/local/complete-issue.pdf
result.rtype = 'ARTICLES_BUNDLE';
result.mime = 'PDF';
// /content/iijpormgmt/50/1/local/complete-issue.pdf
// /content/iijpormgmt/45/6/local/complete-issue.pdf

result.rtype = 'ARTICLES_BUNDLE';
result.mime = 'PDF';
result.db_id = match[2];
result.unitid = match[1];
result.vol = match[3];
result.issue = match[4];

} else if ((match = /^\/content\/([a-z]+)\/?$/i.exec(path)) !== null) {
// https://www.pm-research.com/content/iijpormgmt/
// https://www.pm-research.com/content/iijtrade
result.rtype = 'TOC';
result.mime = 'HTML';
result.unitid = match[1];
// /content/iijpormgmt/
// /content/iijtrade
result.rtype = 'TOC';
result.mime = 'HTML';
result.unitid = match[1];

} else if ((match = /^\/content\/(([a-z]+)\/([0-9]+)\/([0-9]+)\/([0-9]+))$/i.exec(path)) !== null) {
// https://www.pm-research.com/content/iijpormgmt/50/1/82
// https://www.pm-research.com/content/iijtrade/13/4/119
result.rtype = 'ABS';
result.mime = 'HTML';
// /content/iijpormgmt/50/1/82
// /content/iijtrade/13/4/119

result.rtype = 'ABS';
result.mime = 'HTML';
result.db_id = match[2];
result.unitid = match[1];
result.vol = match[3];
result.issue = match[4];
result.first_page = match[5];

} else if (/^\/search$/i.test(path)) {
// https://www.pm-research.com/search?sort_by=search_api_relevance_1&sort_order=DESC&items_per_page=10&f%5B0%5D=topics%3A91&query=Taxation&implicit-login=true
// https://www.pm-research.com/search?sort_by=search_api_relevance_1&sort_order=DESC&items_per_page=10&f%5B0%5D=0&query=Risk%20Management&implicit-login=true
result.rtype = 'SEARCH';
result.mime = 'HTML';
// /search?sort_by=search_api_relevance_1&sort_order=DESC&items_per_page=10&f%5B0%5D=topics%3A91&query=Taxation&implicit-login=true
// /search?sort_by=search_api_relevance_1&sort_order=DESC&items_per_page=10&f%5B0%5D=0&query=Risk%20Management&implicit-login=true

result.rtype = 'SEARCH';
result.mime = 'HTML';
}

return result;
Expand Down

0 comments on commit bf8ccf1

Please sign in to comment.