Run Forrest Run... no, not against the wall

| No Comments | No TrackBacks

Migrating my extremely hacky Smarty-based Avarthrel website to clean, nicely working Forrest site is... progressing... weirdly.

I kind of regret the choice already. However, I'm not backing down, because Forrest appears to have a sane approach: Use whatever XML formats you want and transform them to fully skinned site. Besides, I've determined that the root cause of me not being able to write anything is that something bugs me, and in this case it's the old super-hacky Smarty site. Argh.

I only have major problems on the front end. Specifically, the skins aren't very customisable, and I can't really generate HTML from my custom XML sources - I need to generate this very limited subset of HTML. I can't say "When generating the story web pages, they need to have custom Creative Commons metadata, include comments with SSI, and add a comment form at the bottom. All of them need custom parameters."

So what did I do?

Hpricots from hell!

I call my "fix up the broken Forrest HTML" script "ccinjector", because it's main job is to inject Creative Commons metadata. I almost called it cardiacarrest.rb, as in "what you get if you eat a metric heckton of chocolate", to keep up with the Forrest Gump theme.

And what does the injector do? It requires both hpricot and xml/libxml libraries. Two libraries that basically deal with XML data. Yay. And, of course, it grabs yaml. Nope, this app doesn't store its configuration in an XML file. (I'm a pacifist and "XML is like violence: if it doesn't work, use more" doesn't seem too thrilling.)

Conclusion: Storing stuff in text files is surprisingly difficult.

Now, this file then uses libxml to fix up my Creative Commons metadata. It gets inserted in the HTML. then, the script ponders what sort of fixes I've specified in the configuration. It can insert static HTML templates, with or without variable/magic-word substitution, or mess up HTML along the lines of "replace //div[@class=lastmodified] with the contents of lastmod template". hpricot is really nice for this sort of stuff.

And it runs HTML Tidy. Twice. At the beginning and end.

All in all, this stuff is really painless - but still overly complicated considering what I really need here...

No TrackBacks

TrackBack URL: http://www.beastwithin.org/mt/tb.cgi/54

Leave a comment

About Avarthrel

Avarthrel is a fantasy world, designed by Urpo Lankinen. I hope you enjoy your stay in this strange world!

Support Avarthrel!

Feedback rules! But if you can send a few cents my way, it cheers me up somehow. I promise to spend majority of this stuff on coffee.

About this Entry

This page contains a single entry by Urpo Lankinen published on December 7, 2006 11:27 PM.

Why I Write: Copyright Paranoia was the previous entry in this blog.

What Really Was Wrong is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Quality tools!

Anonymous commenting in this blog has been disabled due to majority of it being spam. However, OpenID is accepted here! Simply log in with your OpenID and comment away! Confused? No worries: Learn more about OpenID. (And no, F*c*b**k C*nn*c* will never, ever be supported here, as long as we have actual open federated web standards.)
OpenID accepted here Learn more about OpenID