Forum Moderators: coopster
Of course, this means going through previously submitted articles and changing the formatting to the new style. Most of the stuff will be simple search and replace, but URLs are going to be a whole different ball o' wax. With hundreds of articles, an automated approach would leave some of my hair intact.
E.g. an URL in Textile formatting is represented as "linktext":url
This is where we get into my weak area...regex.
My initial thought would be to explode the story with </a>. That way, each story segment in the array would end with the linktext being any text after the >
Where I'm stuck is working out how to get the URL out of the href part and then tossing it back into the string as textile format.
After exploding with </a>, a string segment would look like this:
Millions of filmgoers went to see the new movie about
<a href="http://www.example.com">Example
Which needs to be replaced with:
Millions of filmgoers went to see the new movie about
"Example":http://www.example.com
Any ideas?
As far as i know textilephp will leave your old links alone and they will work fine without you having to change them into Textile Markup.
/Hafnius
[edited by: ergophobe at 1:24 am (utc) on Sep. 19, 2004]
[edit reason] URL deleted as per TOS [/edit]
with the disclaimer: it often occurs that I have to check out regex resouces when I debug my regexes, and I haven't checked this one, so see if it works, and if no one posts corrections to this formula, [be2.php.net...] is the resource I use most as a regex cribsheet, lots of nice info all on one page.
Note: this won't catch any links with a "target" or set as an id or class - but that wasn't requested, and I don't know how Textile handles such things.