Wednesday, September 5, 2007

Housecleaning

First: If you have not noticed, I've started restructuring the blog to reduce its ugliness quotient. First and foremost was the addition of dp.SyntaxHighlighter - truly mana from heaven. However - it requires code to exist in textareas, not pre, so RSS feeds will look kind of ugly until I figure out a fix (blame blogger - they like to injects <br/> after lines). I also added some better RSS (Feedburner) and rocked out the linkwhoring at the bottom of each article.

Second: I finally got added to the Terracotta committers page! Now whose leg do I have to hump to get my name added onto Maven?

Third: Apparently my post about overriding nil in Ruby ruffled a few feathers amongst the Java crowed. Who'd have known null was a sacred cow? If that is the case, I'm curious as to the backlash concerning my next post "5 Reasons Static Typing Sucks".

Fourth: A belated congratulations to Jimbojw for his (fairly) recent promotion as a MediaWiki committer!

3 comments:

jimbojw said...

Thanks for the shoutout buddy! I haven't yet committed anything with my newfound powers, but I suspect I'll have to sooner or later.

Regarding your concern over <textarea> tags and RSS:

> However - it requires code to exist in textareas, not pre, so RSS feeds will look kind of ugly until I figure out a fix...

Here's my proposal:

1. Go ahead and put your code fragments in <pre> tags. Semantically this is the right thing to do anyway. (I am soooo POSH)

2. Give each pre an id attribute - doesn't have to be anything special, just as long as it's unique.

3. Immediately following each pre tag, add a small <script> block which uses "document.createElement()" to make a new <textarea>, then set that textarea's innerHTML to match the pre.

4. Still within the script block, do a "pre.parentNode.replaceChild(textarea, pre)"

5. Finally, do whatever else is necessary to make the textarea count as highlighted text.

In addition to solving the RSS display problem, this should also aid users who have JavaScript disabled (for whatever reason). They'll see a semantically correct pre tag instead of a textarea. Enjoy!

(Note: If you were feeling especially ambitious, you could forgo putting id's on the pre tags and instead have the id's on the <script> elements, then use "document.getElementById('scriptId').parentNode.getElementsByTagName('pre')[0]" to find the pre tag.)

Orion Letizi said...

Eric, sorry it took us so long to put you on the committers page. We really have to start sucking less about stuff like that. Anyway, you rule.

Cheers,
Orion

Eric said...

No Orion, you rule for creating my quickly-becoming favorite framework!

I tell ya - TC will be my secret weapon to win this ;)