Best answer

The transformation code from EverNote to WordPress cannot be rendered fully


I used Zapier to generate new blog in WordPress from very new note in EverNote. The text part are fine, but the image items don’t work, and the images don’t appear in WordPress blog. 

I look at the transformation code of image as an example

<a shape="rect" href="https://d2908q01vomqb2.cloudfront.net/fc074d501302eb2b93e2554793fcaf50b3bf7291/2022/07/13/A-well-architected-pipeline-can-improve-the-modularity-security-and-governance-of-your-deployments.jpg"><en-media alt="AWS X-Ray helps developers analyze distributed applications, such as those built using a microservices architecture" width="1664" height="952" hash="251b20a09bbf5e0a44915d8b9d5d4891" type="image/jpeg"></en-media></a> 

This cannot be rendered by WordPress until I manually make small change with img and src

<img src="https://d2908q01vomqb2.cloudfront.net/fc074d501302eb2b93e2554793fcaf50b3bf7291/2022/07/13/A-well-architected-pipeline-can-improve-the-modularity-security-and-governance-of-your-deployments.jpg"><en-media alt="AWS X-Ray helps developers analyze distributed applications, such as those built using a microservices architecture" width="1664" height="952" hash="251b20a09bbf5e0a44915d8b9d5d4891" type="image/jpeg"></en-media></a> 

How can I automate this change?

Zapier Support advise to use Formatter or Code Step, but not sure how to do that.

In this case, I need to format the code, not the note content. a shape="rect" and href= are only needed to modify for image pieces. The text part where a shape="rect" and href= are also used needs to be intact. 

 

Thanks,

 

Hong 

 

icon

Best answer by AustHong 28 July 2022, 07:53

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +12

@AustHong 

yes, a code step would be best. You can use regex in a javascript code block to find any anchor tag and replace with an img tag. 

let modified = inputData.html.replace(/<a .{1,}href=/g,"<img src=");
modified = modified.replace(/<\/a>/g,"")
return {modified}

 


 

Hi @GetUWired 

I tried your solution,  yes it worked as automation when I provided Input Data both the key and value. 

I want to go further to make this work in batch. What I provided is just a piece of transformation code. In that code, there a few image items, and I need to locate all of them to do this automation. More important, I need to replace the original image pieces with this modified pieces, using them as the input to feed the target application. 

I would like to spend some money to fix the problem in my current zap in the production.

Regards,

Hong 

 

 

Userlevel 7
Badge +12

@AustHong 

The above code will replace all anchor tags in the input to img tags.

@GetUWired 

 

You are right. When I provide the entire transformation code, the related the syntax is modified as required. The WordPress accepts the outcome as expected. 

How can I automate this modified and replace in my Zap. For example, I have a Zap with 3 steps. https://snipboard.io/cgkdph.jpg

How can I have the code run against the outcome of step 1, and then provide the modified/replace to step 3, so i don’t need to manually operate.  

 

If you think I need to go to hire your service, let me know. I am happy to do that as well.

 

Regards,

 

Hong