Simple template-based editing

A discussion here on the read-only/read-write pseudo-classes and another 
with some colleagues prompted me to think about a way to define very 
simple templates with CSS...

The use case is an online page you want to edit and save back to the 
server (with HTTP PUT, Webdav, or even with FTP) and that has to 
conform to a certain format. Imagine, e.g., that the page is from a 
wiki, blog, or slide presentation.

Presumably, the server will check what you send back, but assuming that 
you are trying to do the right thing, it would be good if the server 
could tell your browser/editor in a machine-readable way what changes 
are allowed.

In general, a template consists of parts that you cannot edit and other 
that you can, plus information about the grammar of those parts. For 
example, some part may have only plain text of more than 10 but less 
than 100 characters, another accepts all inline HTML elements, yet 
another accepts most HTML body elements, except H1 and form elements, 
etc.

But that general case is difficult. We don't have a ready made language 
to express those grammars, although DTDs and the various XML schema 
languages go a long way. But as I'm looking for something as simple as 
CSS, I think that general case is out of scope.

Daniel Glazman's NVu, for example, has a simple template system that 
just allows you to distinguish elements that cannot be edited and those 
that can, and the latter come in four types (I'm sure Daniel will 
correct me if I miscounted them...):

1) Exactly one element: you can edit an element's content according to 
the DTD

2) Zero or one: you can edit the content or delete the element.

3) Zero or more: you can delete the element, edit its content and also 
make copies of the element (and edit their contents).

4) One or more: you can edit the content and make copies but at least 
one element must remain.

(The way NVu currently does this is specific to HTML 4.01 Transitional 
and the template files themselves aren't valid SGML or XML, so they 
cannot be used for the online use case I outlined above.)

So how about a property in CSS3

    Name: editable
    Value: auto | one | zero-or-one | zero-or-more | one-or-more
    Initial: auto
    Inherited: no

to indicate that an element is a template or not? ('Auto' means it 
depends on whether the server supports PUT or an equivalent method. 
Better keywords welcome...)

It's obviously very limited (no way to restrict the contents beyond the 
DTD), but it might still be useful and at least it is simple.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Thursday, 29 September 2005 13:19:56 UTC