Wednesday, April 19, 2000
Substance, Structure and Style
More work on mod_blog
today. Had a discussion with
Mark about
separating the style from the module. As it stands, I'm not sure what to do
about outputing the pages. Ideally I would have templates that would
describe the look and feel of the pages, but I have no idea where to do.
My webserver does have PHP installed, but I don't know enough about the internals to hook into it. I'm relunctant to do this in PHP entirely, as parts of what I'm doing are messy enough in C (and no, I don't think Perl's regexs can cut it).
But it does look like I'll have to include some form of scripting language to handle what I want cleanly.
But HTML
isn't exactly designed as a scripting language, nor
embedding one within HTML
the best idea. That's another reason why
I want to stay away from PHP or MetaHTML, because of the mixing of
scripting with output—any formatting in the code is lost (more or less)
when you embed HTML (or any large form of output) in the middle of it. I
find it difficult to follow such code.
But Mark came up with an idea I'm pursuing. Turn the problem inside out
more or less, or rather, separate the large chunks of output from the
scripting. So, for instance, the HTML
:
<chunk name="foobar"> <img src="## graphic name ##" alt="## graphic alt ##" width="## graphic width ##" height="## graphic height ##" > Today's Date: ## today-date ## </chunk>
And the scripting (in a hypthetical language which doesn't bear any relationship to what I may end up looking like):
object graphic { string name; string alt; int width; int height; proc name { print name }; proc alt { print alt }; proc width { print width }; proc height { print height }; }; proc today-date { print gettime(); }; graphic name ="foobar.gif"; graphic alt ="[nothing here to see]"; graphic width =imagewidth('foobar.gif'); graphic height =imageheight('foobar.gif'); display_chunk('foobar');
Namely, in the HTML
, anything between the double hash marks is a
call to a scripting object (or procedure). The scripts themselves can
output chunks of HTML
, which may include scripting callbacks, as
seen here.
Again, that's probably not how the scripting language will look
ultimately, and for now I think I'm just going to embed the HTML within
mod_blog
just to get it out there and running. That's not to say I
couldn't get this out with an embedded scripting language, but some of the
tools I want to use I still have to clear before I can use them and
rewriting the tools is going to take time.
The reason for rewriting the tools taking quite a bit of time has to deal with error detection and recovery, which is another aspect of conversation Mark and I are hashing out.
“And some call me … Harry!”
I borrowed J. K. Rowling's Harry Potter and the Sorcerer's Stone from my friend Jeff. Cute book and I can see why it would appeal to kids, in that “These are not my parents there must be some mistake I'm probably a prince or princess who has been kidnapped or something” way.
But I do have several questions about the underlying themes of the story so if you don't want possible spoilers about this story, skip this entry.
The first has to do with Hogwarts itself. It consists of four houses, one of which, Slytherin, is known to produce evil (or not entirely nice) wizards (the most notorius being Voldemort, the wizard responsible for killing Harry's parents.
I would think that after the whole Voldemort affair (which took place 11 years prior to the main story) that the Headmaster of Hogwarts would disband Slytherin, especially since in the main story, most of the kids in that house are of the most disagreeable sort.
The second has to do with the whole concept of Hogwarts. The wizards and witches who attend seem for the most part to exist apart from the rest of society, much like the obscenely rich seem to exist apart from the rest of society and don't participate much in the affairs of mortal men (or something to that effect). And the term the magically gifted use to describe those lacking in the magic arts—Muggles—seems a bit, dare I say, racist? Perhaps it's just me.
But on the whole, an enjoyable and fast read.