mtibben/html2text — pull request #20 by acorncom (2014-10-01 18:11:56+00:00)
Title: Moved our protocol regex up into a protected variable

@mtibben Appreciate your work on this library. Not sure if you will want to pull this tweak in, but I'm finding it useful.

I'm using it so that I can override the regex used to determine whether to add a base url or not. When we're generating plain text bodies for emails, we sometimes use a Mailgun variable symbol (`%`) to indicate an absolute url that gets swapped in with a Mailgun variable at a later point.

With your current system, I was ending up with the following type of link:

http://www.hostname.com/http://www.hostname.com/link-from-variable

where the first `www.hostname.com` was generated by Html2Text.

Having the ability to control the regex allows me to prevent that from happening.

At the moment, I'm overriding that protected variable in a subclass, but if you want to add this patch, I can send over a tweak to the pull request to add a setter for it as well.