Saturday, April 26, 2014
An unexpected feature
As I was writing the link to RFC-2045 in the previous post, an idea suddenly struck me—why
should I have to type out the entire URL? I already have a shortcut to link to Amazon (all I have to do is write a link
like <a href="asin:B00BWQW73E"> and
mod_blog converts it to <a class="book"
href="http://www.amazon.com/exec/obidos/ASIN/B00BWQW73E/conmanlaborat-20">)
so it shouldn't be that hard to add.
I was fully expecting it to take maybe fifteen minutes or so to add the code, but to my surprise, no code change was required! The configuration file has this bit:
affiliate =
{
{
proto = "asin",
link = "http://www.amazon.com/exec/obidos/ASIN/%s/conmanlaborat-20"
}
}
It was originally intended for affiliate links, but it'll work for this as well. A slight modification:
affiliate =
{
{
proto = "asin",
link = "http://www.amazon.com/exec/obidos/ASIN/%s/conmanlaborat-20"
},
{
proto = "rfc",
link = "http://www.ietf.org/rfc/rfc%s.txt"
},
}
Now all I have to do is write <a
href="rfc:2045"> and mod_blog will convert
it to <a
href="http://www.ietf.org/rfc/rfc2045.txt">. I love it
when stuff like this happens.
![Glasses. Titanium, not steel. [Self-portrait with my new glasses]](https://www.conman.org/people/spc/about/2025/0925.t.jpg)