Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ezpaarse-project/ezpaarse-platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
felixleo22 committed Sep 20, 2024
2 parents 1827963 + 852eaed commit b551cf3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cairn/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"www.cairn.info",
"shs.cairn.info",
"stm.cairn.info",
"droit.cairn.info"
"droit.cairn.info"
],
"bacon": {
"provider": "CAIRN"
Expand Down
24 changes: 21 additions & 3 deletions cairn/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ module.exports = new Parser(function analyseEC(parsedUrl) {
split[2] + '_' +
split[3];
}
} else if ((match = /^\/(((?:revue-|magazine-)[a-z0-9@-]+)-([0-9]{4})-([0-9]+)-(page|p)-([0-9]+))\.html?$/i.exec(path)) !== null) {
} else if ((match = /^\/(((?:revue-|magazine-)[a-z0-9@-]+)-([0-9]{4})-([0-9]+)-(page|p)-([0-9]+))(\.html?)?$/i.exec(path)) !== null) {
// journal example: http://www.cairn.info/revue-actes-de-la-recherche-en-sciences-sociales-2012-5-page-4.htm
// /revue-administration-et-education-2024-1-page-33?lang=fr
// /revue-histoire-et-societes-rurales-2008-2-page-67?lang=fr&tab=resume
result.rtype = match[5] === 'page' ? 'ARTICLE' : 'PREVIEW';
result.mime = 'HTML';
result.unitid = match[1];
Expand All @@ -85,8 +87,13 @@ module.exports = new Parser(function analyseEC(parsedUrl) {
result.issue = match[4];
result.first_page = match[6];

} else if ((match = /^\/(((?:revue-|magazine-)[a-z0-9@-]+?)(?:-([0-9]{4})-([0-9]+))?)\.html?$/i.exec(path)) !== null) {
if (param.tab === 'resume') {
result.rtype = 'ABS';
}

} else if ((match = /^\/(((?:revue-|magazine-)[a-z0-9@-]+?)(?:-([0-9]{4})-([0-9]+))?)(\.html?)?$/i.exec(path)) !== null) {
// journal example: http://www.cairn.info/revue-a-contrario.htm
// /revue-administration-et-education-2024-1?lang=fr
result.unitid = match[1];
result.title_id = match[2];
result.rtype = 'TOC';
Expand All @@ -97,11 +104,12 @@ module.exports = new Parser(function analyseEC(parsedUrl) {
result.issue = match[4];
}

} else if ((match = /^\/(([a-z0-9 @-]+)--([0-9]{0,13})(?:-(page|p)-([0-9]+))?)\.html?$/i.exec(path)) !== null) {
} else if ((match = /^\/(([a-z0-9 @-]+)--([0-9]{0,13})(?:-(page|p)-([0-9]+))?)(\.html?)?$/i.exec(path)) !== null) {
// /a-l-ecole-du-sujet--9782749202358-page-9.htm
// /a-l-ecole-du-sujet--9782749202358-p-9.htm
// /a-l-ecole-du-sujet--9782749202358.htm
// /couple-conjugal-couple-parental-vers-de-nouveaux--978274920806-p-217.htm
// /les-101-mots-de-la-democratie-francaise--9782738111562-page-89?lang=fr
result.mime = 'HTML';
result.unitid = match[1];
result.title_id = match[2];
Expand All @@ -116,6 +124,16 @@ module.exports = new Parser(function analyseEC(parsedUrl) {
result.rtype = 'PREVIEW';
result.first_page = match[5];
}
} else if ((match = /^\/numero\/([a-z0-9_]+)$/i.exec(path)) !== null) {
// /numero/OJ_HADAS_2002_01?lang=fr
result.rtype = 'TOC';
result.mime = 'HTML';
result.unitid = match[1];
} else if ((match = /^\/article\/([a-z0-9_]+)\/pdf$/i.exec(path)) !== null) {
// /article/ADMED_181_0033/pdf?lang=fr
result.rtype = 'ARTICLE';
result.mime = 'PDF';
result.unitid = match[1];
}

return result;
Expand Down
7 changes: 7 additions & 0 deletions cairn/test/cairn.2024-09-10.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
out-print_identifier;out-publication_date;out-issue;out-first_page;out-title_id;out-unitid;out-rtype;out-mime;in-url
;2008;2;67;revue-histoire-et-societes-rurales;revue-histoire-et-societes-rurales-2008-2-page-67;ABS;HTML;https://shs-cairn-info.inshs.bib.cnrs.fr/revue-histoire-et-societes-rurales-2008-2-page-67?lang=fr&tab=resume
9782738111562;;;89;les-101-mots-de-la-democratie-francaise;les-101-mots-de-la-democratie-francaise--9782738111562-page-89;BOOK_SECTION;HTML;https://shs-cairn-info.inshs.bib.cnrs.fr/les-101-mots-de-la-democratie-francaise--9782738111562-page-89?lang=fr
;;;;;OJ_HADAS_2002_01;TOC;HTML;https://shs-cairn-info.inshs.bib.cnrs.fr/numero/OJ_HADAS_2002_01?lang=fr
;;;;;ADMED_181_0033;ARTICLE;PDF;https://shs-cairn-info.inshs.bib.cnrs.fr/article/ADMED_181_0033/pdf?lang=fr
;2024;1;33;revue-administration-et-education;revue-administration-et-education-2024-1-page-33;ARTICLE;HTML;https://shs-cairn-info.inshs.bib.cnrs.fr/revue-administration-et-education-2024-1-page-33?lang=fr
;2024;1;;revue-administration-et-education;revue-administration-et-education-2024-1;TOC;HTML;https://shs-cairn-info.inshs.bib.cnrs.fr/revue-administration-et-education-2024-1?lang=fr

0 comments on commit b551cf3

Please sign in to comment.