I just did a massive check-in on mod_atom, and it’s now not just an Atom Store, it’s also a basic blog publisher. This fragment is about how it works, and includes a confession; I did one fairly awful thing along the way.
Still CoC · There’s still almost no configuration; just one directive, like so:
AtomPub /base/publication/URI /base/pub/dir "Pub Title" "Pub Author"
I keep thinking of places where configuration options would be useful, but then there’d need to be a configuration syntax and a place to put them, and it’s so easy to make a mistake there that you’ll have to live with for a long, long time. So I’m going to hold the line on more config stuff, for the moment.
Making HTML: What? ·
As of now, if you POST (or PUT) an Atom Entry to a mod_atom collection that
accepts them, it’ll generate an HTML version if the entry’s
content element has a
type value of
Whenever one of the HTML pages gets created or updated, mod_atom updates the publication’s “Front page” and a public-facing Atom feed for the publication.
Making HTML: How? · How, you might ask, does that HTML get created? Well, here’s the confession: I ended up inventing another HTML templating language. Because the Web doesn’t have enough. Here’s the current default template for the per-entry pages.
<html xmlns:m='http://www.mod-atom.net/ns'> <head> <title><m:title /></title> <m:entry-stylesheet /> <m:entry-script /> <m:generator /> </head> <body class='atom-body'> <m:logo /> <h2><m:title /></h2> <div class='atom-authors'> <m:entry-author /> <m:contributors /> </div> <div class='atom-content'> <m:content /> </div> <div class='atom-cats'> <m:cats /> </div> <div class='atom-rights'> <m:rights /> </div> <div class='atom-dates'> <m:published /> <m:updated /> </div> </body> </html>
This template never gets applied at run-time, only at POST or PUT time.
There’s really quite a lot of scope for customization. Also, those
entry-script template fields
generate something that look like:
That, together with all those class attributes, ought to give you enough hooks to build as widget-packed and AJAXerrific a twenty-first century HTML page as anyone could want.
Sanitation · Earlier on, I had a bunch of HTML sanitation code that was applied to incoming POSTs and PUTs. I ripped it out again, so the Atom-store part of mod_atom screws with the incoming data as little as possible. But all that sanitation code does get applied to anything that comes out of the HTMLification process.
Does It Work? · Well, it passes the Ape test suite running on OS X and Debian. The HTML Entry and Front pages look OK, and while the public-facing feed has some problems (and is a first-rate conversation piece), it’s a start.
There are issues, of course, and if anyone starts using this, there’ll be lots more.
To Do ·
There are two big missing functional pieces. First off, it needs
to be easy to turn off all this HTML stuff so mod_atom is a pure Atom Store.
Second, it doesn’t support
app:draft, and if it got much out into
the wild in that state, Joe Cheng would send a poison dwarf from Redmond to
strangle my cats. And it’s easy enough to add, so I will.