Categories
Software and Programming

Javascript Textile follow-up

I got a comment from the developer of the GreaseMonkey Textile Javascript script I mentioned, which encouraged me to (a) actually try to convert a few entries and (b) once I discovered it was making a bit of a mess of it, look at the code and fix the bug that was giving me the problem.

Apparently, my use of parentheses was confusing a regular expression used to convert textile-style “links” into HTML links.

The change I made is in these lines (in bold):


// links
re = new RegExp('"\b([^"]+?)\(\b(.+?)\b\)":([^\s]+)','g');
r = r.replace(re,'<a href="$3" title="$2">$1</a>');
re = new RegExp('"\b([^"]+?)\b":([^\s]+)','g');
r = r.replace(re,'<a href="$2">$1</a>');

I replaced a match for “a run of characters between parentheses” with a match for “a run of character that aren’t parentheses between parentheses”.

Interestingly through the comments on the Textile Javascript page I found the blog of someone using Movable Type who rejected the Javascript version in favour of the server-side MT-Textile. This way makes sense – you can keep editing the textile-formatted entry, which the Javascript version simply replaces (and destroys), because it stays saved in the database, and gets converted to HTML only when you publish. Funnily enough, I find the Javascript version more useful, because I’ve moved my entries to a different content management system, and lost the meta-data about how to format them.
The point being that the best way to store blog entries is in HTML format, which is portable across CMS systems. (I know WordPress has a textile plug-in or rather two, but who knows if my next CMS will have one?)

Categories
Comics

The Spider, The Steel Claw and Albion

I should work on my titles.

Newsarama published a press release recently about Titan’s collections for The Spider and The Steel Claw, classic British “weird heroes” of the 60’s-70’s (I’ve mentioned the Spider before). This is supposed to come out in June, and seems tied-in somehow to Alan Moore and Co.’s revival of these characters in the upcoming DC series, Albion, also out in June.

Speaking of Alan Moore, I didn’t link to that massive Alan Moore interview yet, did I? So I do so now.

Categories
Comics

Filfh

Robert Crumb Dirty Fantasies for Guardian Readers
The Guardian has a special report on Robert Crumb, which I think is a fine excuse to post dirty pictures here.

Saved it here for reference purposes, and was a bit horrified when it just slipped out onto LJ and wriggled around in assorted friends pages. But now, in the proper context…

Did I say reference?

Categories
Software and Programming

GreaseMonkey, Textile, cool Javascript

This is a geekburst of an entry, but this stuff builds up, and can hurt one’s bookmarks unless blogged regularly.

Yesterday I had a look at GreaseMonkey, a nifty FireFox extension which lets you set up javascript scripts that run automatically whenever pages from a certain site or sites are loaded. If that made your eyes glaze over, feel free to skip this entry. However, if you are still here, you probably want to look at this repository of GreaseMonkey scripts. Some of these are just little things to fix annoyances like a site with articles that are too narrow, or (to give an example of one of the two default scripts that come with the extension) transform plain text URLs into working links. The one I got excited about, geekishly enough, is the Javascript Textile one.

What this does is add a button next to any text area that will convert any Textile markup to HTML, using only Javascript. The reason I’m interested in this is that, back when I was using Movable Type, I had a bunch of entries that used their Textile formatting plug-in, and ever since moving to WordPress, that text has been messed up. The messed-up entries start in February 2003, with (fittingly enough) an entry titled Installed MT-Textile. My point is that now I can go back and fix them with a click.
Or so goes the plan.

Sort-of unrelated, I ran across JavaScript O Lait, an interesting Javascript library with a strong focus on AJAX (communcation with the server through Javascript, without requiring a page reload). It has modules for XML-RPC as well as JSON-RPC, which messages are expressed in JSON (the syntax used for Javascript data structures) instead of the much heavier (and parse-intensive) XML.

Geekish, I said.

Categories
Resources

EvilLyrics

This is pretty cool: EvilLyrics, a lyrics search tool; it picks up the name of whatever song is currently playing on your computer (it’s suppossedly for WinAmp, works with other media players – for instance, it works fine with foobar2000, the media player I’m using here), and searches for the Lyrics and shows them. It also checks if there’s a Karaoke version of the song, if you fancy singing them yourself…

[ link from Captain Internet. ]