* * * * *

                        Substance, Structure and Style

More work on mod_blog today. Had a discussion with Mark [1] 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 [2] 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
[3] 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 [4], 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:

-----[ HTML ]-----
<chunk name="foobar">
       <img
               src="## graphic name ##"
               alt="## graphic alt ##"
               width="## graphic width ##"
               height="## graphic height ##"
       >
       Today's Date: ## today-date ##
</chunk>
-----[ END OF LINE ]-----

And the scripting (in a hypthetical language which doesn't bear any
relationship to what I may end up looking like):

-----[ psedocode ]-----
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');
-----[ END OF LINE ]-----

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.

[1] http://www.conman.org/people/myg/
[2] http://www.php.org/
[3] http://www.perl.org/
[4] http://www.metahtml.com/

Email author at [email protected]