Search

http://www.dustindiaz.com/basement/ify.html

Just saw this piece of JS from Dustin Diaz and realized it’s exactly what’s missing from my Symphony-powered Twitter cache. Basically, it takes a plain-text status string, and adds HTML links for any at-replies (@ded), hash tags (#symphony-cms), and plain-old links (http://…).

Would anyone be interested in porting this to XSLT, or pointing me to resources that would help me do it myself? Or, would it be better to do this in PHP when I’m importing my Twitter feed, and store them as HTML fragments?

Thanks,

Brian

Great idea!

On first glance I would use the EXSLT tokenize() function to split the string up into individual words that can be iterated over and processed. Unfortunately XSLT 1.0 and the EXSLT library under LibXSLT does not support regular expressions, which would have made a direct port very simple.

I might have a stab at this on my commute home :-)

Would be great!

Try this for size. I’ve only tested it with the example on Dustin’s demo page and it seems to work well. If you can confirm, I’ll put it up as an XSLT Utility.

I just wish we could use regular expressions! It’d save an awful lot of string manipulation and recursion.

[code removed]

Thank you Nick, it works perfectly!

Great :-) I’ve added it as a Utility:

Twita@talinkahashifyer

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details