parser icon indicating copy to clipboard operation
parser copied to clipboard

[help] Your gitter is dead so I'm forced to post here

Open working-name opened this issue 4 years ago • 0 comments

I don't get what I don't understand here: https://github.com/postlight/mercury-parser/blob/master/src/extractors/custom/README.md#using-transforms

Mercury proceeds to return everything as if there's no transforms. My code:

      accreditations: {
        selectors: ['#accreditations'],
        allowMultiple: true,
        clean: [
          'div.description.photos', 
          'div.review-stars', 
          'img.edit', 
          'span.facility-reviews', 
          'reviews-container-mobile',
          'reviews-container',
          '.map-placeholder'
        ],

        transforms: {
            /**
             * This doesn't work. It's essentially the same as https://github.com/postlight/mercury-parser/blob/master/src/extractors/custom/README.md#using-transforms but mercury blows right through. Guess I have to cleanup after it - renders this tool fairly useless.
             */
          p: node => {
            const children = node.children(0);
            lilkid = children._root.get(0).children[0].data;
            // console.log(lilkid);

            if( lilkid.match(/verified in|Member:|Accreditation:/) ) {
                return lilkid;
            }

            return null;
          },
        },
      },

working-name avatar Jun 06 '21 22:06 working-name