Skip to content
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

update parser az #817

Merged
merged 2 commits into from
Apr 24, 2024
Merged

Conversation

chaoyinYang
Copy link
Contributor

No description provided.

az/parser.js Outdated
@@ -52,6 +52,30 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {
// http://aranzadi.aranzadidigital.es/maf/app/search/run/multi
result.rtype = 'SEARCH';
result.mime = 'HTML';
} else if (/^\/maf\/app\/document$/i.test(path) && (marginal = param.marginal) != undefined && (marginal.split('\\')[0] === 'RJ' || marginal.split('\\')[0] === 'RCL')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can group several parsers into a single one by using lot of if or a switch.

} else if (/^\/maf\/app\/document$/i.test(path)) {
    // /maf/app/document?startChunk=1&mdfilter=mdlegisfilter&endChunk=2&stid=marginal_chunk&ds=ARZ_LEGIS_CS&infotype=arz_legis&subResult=i0ad6adc60000018ed0247a839bee5891&docguid=I6b664a40e83811db8079010000000000&marginal=RCL\1999\710&spos=1&epos=1&version=19990406&displayName=&lang=spa
    // /maf/app/document?srguid=i0ad6adc50000018ed0247dc8eb6fe26f&marginal=RJ\2017\1890&docguid=I03fcd8903aa011e79de2010000000000&ds=ARZ_LEGIS_CS&infotype=arz_doc-admin;&spos=1&epos=1&td=0&predefinedRelationshipsType=documentRetrieval&global-result-list=global&fromTemplate=&suggestScreen=&&selectedNodeName=&selec_mod=false&displayName=
    marginal = param.marginal
    
    if (marginal.split('\\')[0] === 'RJ' || marginal.split('\\')[0] === 'RCL') {
      // /maf/app/document?startChunk=1&mdfilter=mdlegisfilter&endChunk=2&stid=marginal_chunk&ds=ARZ_LEGIS_CS&infotype=arz_legis&subResult=i0ad6adc60000018ed0247a839bee5891&docguid=I6b664a40e83811db8079010000000000&marginal=RCL\1999\710&spos=1&epos=1&version=19990406&displayName=&lang=spa
      // /maf/app/document?srguid=i0ad6adc50000018ed0247dc8eb6fe26f&marginal=RJ\2017\1890&docguid=I03fcd8903aa011e79de2010000000000&ds=ARZ_LEGIS_CS&infotype=arz_doc-admin;&spos=1&epos=1&td=0&predefinedRelationshipsType=documentRetrieval&global-result-list=global&fromTemplate=&suggestScreen=&&selectedNodeName=&selec_mod=false&displayName=
      result.rtype    = 'ARTICLE';
      result.mime     = 'HTML';
      result.unitid   = marginal;
    }

    if (marginal.split('\\')[0] === 'BIB') {
      // /maf/app/document?srguid=i0ad6adc50000018ed0247a19ba6a7861&marginal=BIB\2021\1098&docguid=I2e8fecd0a23611ebaf9ae70e1612b1e3&ds=ARZ_LEGIS_CS&infotype=arz_biblos;&spos=1&epos=1&td=0&predefinedRelationshipsType=documentRetrieval&fromTemplate=&suggestScreen=&&selectedNodeName=&selec_mod=false&displayName=
      // /maf/app/document?srguid=i0ad6adc50000018ed0247a19ba6a7861&marginal=BIB\2015\322&docguid=Idbdd5360a82c11e4b065010000000000&ds=ARZ_LEGIS_CS&infotype=arz_biblos;&spos=5&epos=5&td=0&predefinedRelationshipsType=documentRetrieval&fromTemplate=&suggestScreen=&&selectedNodeName=&selec_mod=false&displayName=
      result.rtype    = 'BOOK';
      result.mime     = 'HTML';
      result.unitid   = marginal;
    }

    if (marginal.split('\\')[0] === 'FOR') {
      // /maf/app/document?srguid=i0ad6adc50000018ed0247c23d3a4bb99&marginal=FOR\2012\839&docguid=I0eb20050b1e111e1847d010000000000&ds=ARZ_LEGIS_CS&infotype=arz_formularios;&spos=1&epos=1&td=0&predefinedRelationshipsType=documentRetrieval&fromTemplate=&suggestScreen=&&selectedNodeName=&selec_mod=false&displayName=
      // /maf/app/document?srguid=i0ad6adc50000018ed0247c23d3a4bb99&marginal=FOR\2011\924&docguid=I55351570de7f11e0a788010000000000&ds=ARZ_LEGIS_CS&infotype=arz_formularios;&spos=8&epos=8&td=0&predefinedRelationshipsType=documentRetrieval&fromTemplate=&suggestScreen=&&selectedNodeName=&selec_mod=false&displayName=
      result.rtype    = 'FORMULES';
      result.mime     = 'HTML';
      result.unitid   = marginal;
    }

    if (marginal.split('\\')[0] === 'MIX') {
      // /maf/app/document?srguid=i0ad6adc50000018ed0247b3d15b13605&marginal=MIX\2023\211717&docguid=Id421ff501ef611eeba5fb46f48ac422d&ds=ARZ_LEGIS_CS&infotype=arz_cuadros;&spos=1&epos=1&td=0&predefinedRelationshipsType=documentRetrieval&fromTemplate=&suggestScreen=&&selectedNodeName=&selec_mod=false&displayName=
      // /maf/app/document?srguid=i0ad6adc50000018ed0247b3d15b13605&marginal=MIX\2004\583&docguid=I4aa5994075a211dba338010000000000&ds=ARZ_LEGIS_CS&infotype=arz_cuadros;&spos=2&epos=2&td=0&predefinedRelationshipsType=documentRetrieval&fromTemplate=&suggestScreen=&&selectedNodeName=&selec_mod=false&displayName=#
      result.rtype    = 'IMAGE';
      result.mime     = 'PDF';
      result.unitid   = marginal;
    }
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
I have modified the code. Please check.
Thanks!

@felixleo22 felixleo22 merged commit ebfc050 into ezpaarse-project:master Apr 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants