Words by c.z.robertson

Playing with Necho

2003-07-13 15:08:35 UTC

I've created a feed for this blog based on the Necho 0.1 snapshot (or Echo or Pie or whatever it's being called this week). It's valid according to Tim Bray's RelaxNG schema. I'm quite pleased that Catkin was able to handle it without any great difficulty. The template system in Catkin 0.3 is pretty cool.

Here's the template:

content-type: text/html
filename: necho.xml

[%- USE date(format = "%Y-%m-%dT%H:%M:%SZ"); -%]
[%- reversed_entries = blog.entries.reverse -%]
<?xml version="1.0"?>
<feed xmlns="http://www.intertwingly.net/wiki/pie/" version="0.1">

  <title>[% blog.config('blog_title') FILTER html %]</title>
  <link>[% blog.config('blog_url') FILTER html %]</link>

  [% FOREACH i = [0..4] %]
    [% entry = reversed_entries.$i %]
    [% IF entry %]
      [% url = blog.config('blog_url') _ entry.id _ '.shtml' %]
      [% id  = blog.config('blog_url') _ entry.id            %]
      <entry>
        <title>[% entry.title FILTER html %]</title>
        <link>[% url FILTER html %]</link>
        <id>[% id FILTER html %]</id>
        <author>
          <name>[% blog.config('blog_author') FILTER html %]</name>
          <weblog>[% blog.config('blog_url') FILTER html %]</weblog>
        </author>
        
        <issued>[% date.format(entry.date) %]</issued>
        <modified>[% date.format(entry.date) %]</modified>
        <content type="application/xhtml+xml">
          <div xmlns="http://www.w3.org/1999/xhtml">
          [% entry.text %]
          <p>
            Comments: [% entry.count %]
          </p>
          </div>
        </content>
      </entry>
    [% END %]
  [% END %]

</feed>

I've made a decision not to get involved with Necho development. It would require time and energy that I just don't want to give. But here are some comments which Necho developers can listen to or ignore as they choose:

  • According to the schema, issued and modified are required elements on each entry. This doesn't make a whole lot of sense to me. I can see why one date might be required, but I'm not sure it makes sense to require either an issued date or a modified date. Catkin, for example, doesn't currently keep track of the modified date. I can imagine systems which wouldn't keep track of the issued date. Different authors might have different ideas about which is more significant. There's some discussion about this issue at TimestampVsCreationDateTime.
  • Also on this subject, I think the timezone stuff is a bit wrong. According to the wiki, the modified date "is an objective date of the most recent time this resource was modified, without a timezone ('Z')". But a date with a timezone is no less objective. 2003-07-13T14:00+01:00 is exactly equal to 2003-07-13T13:00Z. Surely an aggregator should be able to handle this stuff. Why make the rules different for issued and modified?
  • The author stuff is a bit silly. Firstly the author/contributor distinction is too inflexible. I'd suggest just having zero or more author elements with an optional role attribute. The contents of role should be free text.
  • The homepage/weblog distinction is silly as well. I suggest zero or more url elements, again with a free text role attribute.