Comments (5)
You write:
If you have a fix for escaping the hyphens, I'd rather not escape them in JS since they don't need to be escaped there.
OK.
So I think you'd be better off with:
sub(/a-zA-Z0-9-/, "a-zA-Z0-9\\\\-") # substitute the string 'a-zA-Z0-9-' with the string 'a-zA-Z0-9\\-'
OK... thanks.
Nice job removing 1x1 images. I would also remove 0x0 images as those happen sometimes too.
Thanks for the tip...an easy fix -- change '==' to '<=' in a couple of places...
from simplify-trackers.
I'll test and let you know.
from simplify-trackers.
It seems to be fine. It isn't technically valid as hyphens do not need to be escaped. So I think I could add it.
Another option, first do a replace for a-zA-Z0-9-
→ a-zA-Z0-9\\-
as this will catch all the instances of a hyphen that you would need to escape for the conversion.
from simplify-trackers.
The particular statements are:
sub(/-_.]/, "\\\\-_.]") # substitute the string '-_.]' with the string '\\-_.]'
sub(/-.]/, "\\\\-.]") # substitute the string '-.]' with the string '\\-.]'
If you could change your regexes, that would be great...I could get rid of this bit of ugliness.
I've also written a ruby program that uses the hash created by the awk script...like what I asked for here. It's a simple filter but demonstrates the technique. It only uses a few common gems. It should be understandable by anyone using the mail
gem for handling mail in ruby.
It detects/removes the tracker <img>
tags and adds an X-Trackers-Blocked
header to the message. The content of the X-Trackers-Blocked
is a JSON-formatted array of the names of the blocked trackers. It also blocks <img>
tags with height="1" width="1"
and calls those unknown
. I'll add all of this as a demonstration after I do some cleanup and add some comments. As always, use at your own risk and no support expressed or implied.
It's based on something I already had (which is much more sophisticated) so I didn't have to re-invent the wheel...
from simplify-trackers.
If you have a fix for escaping the hyphens, I'd rather not escape them in JS since they don't need to be escaped there.
Your sub misses a case though:
"Mailcastr.com": "mailcastr.com\\/image\\/[a-zA-Z0-9-_]{64}",
So I think you'd be better off with:
sub(/a-zA-Z0-9-/, "a-zA-Z0-9\\\\-") # substitute the string 'a-zA-Z0-9-' with the string 'a-zA-Z0-9\\-'
I will try to keep the hyphen always after the 0-9 in these patterns.
Nice job removing 1x1 images. I would also remove 0x0 images as those happen sometimes too.
from simplify-trackers.
Related Issues (2)
- Publish on npm HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simplify-trackers.