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
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
Blather Software and Programming

I want out

This is a stupid personal post, and as such, I’m writing it mostly to mirror it to LiveJournal (), which is the proper place for it.

Yesterday, got pissed at my boss (for a trivial reason, but this has a long build up) and decided I really want to find another job. Ideally one where I feel secure (i.e, not a start-up desperately scrambling to raise more money; have a nice person as a direct manager), where I make a decent salary and where I do things that are not pointless (i.e, what I do should be of real benefit to the company, not dead-end maintenance of about-to-be-abandoned crap. Also, it’s neat if it is demonstrably cool).

What do I want to work at? Most probably programming, because it’s rather fun and pays better than the other stuff I can do. I can also write (creative or technical, English or Hebrew), and probably teach (web stuff, programming, maybe biology, probably not school classes).

So, if you read this, and you know someone who might need someone, let me know.

Or, for extra bonus points, go look at my C.V. and then mock it in the comments, preferably in detail, so I can fix it.

Oh, also, I want to move apartment. And ditch one or all three of my cats. Like I said, out.

Categories
Software and Programming

Geekage

Flushing open windows into blogmemory:

Categories
Software and Programming

Thinking in Hebrew

Joel Spolsky:

No matter how debunked Whorf is, I’m still convinced that Israelis are more likely to do things דווקא, simply because they have a word for it. And I have been forced to write entire essays simply because I cannot find any other way to convey to English speakers the difference between ראש גדול and ראש קטן.

Yes, stupid linkage. I found this amusing, although irritating, because saying “be ראש גדול” is a bit like saying “be good at what you do” or more correctly “care about what you do” – just because we have a word for it doesn’t mean we have any idea how to achieve it.