> What about other markup generated by SS, e.g. Form.ss,
> all formfields etc. - we traditionally adhered to XHTML here.
Unfortunately, it isn't feasible to come up with a markup that
consistently validates as both XHTML and HTML. "<br />" tags don't
validate in HTML. However, it would be feasible to write mark-up that
could be easily converted from one to the other.
Our standard form templates are going to need to be able to be
delivered as either XHTML or HTML, depending on where they are used.
There are a few ways of doing this:
1) Have separate XHTML and HTML templates.
2) Run rewriting rules on Form::forTemplate()
3) Have a conditional block in the template along the lines of <% if
IsXHTML %><br /><% else %><br><% end_if %>, or possibly specific
variables such as <br$SelfClose>. $SelfClose would evaluate to " /"
in XHTML mode, and "" in HTML mode.
Option (1) has a certain conceptual elegance - it is the option where
the content of your HTML output is closest to the template, there's no
behind the scenes processing to complicate the situation. However,
all the extra templates are a maintenance burden and for that reason
Ingo and I think it's unacceptable.
Option (2) would be straightforward in some ways - an XHTML to HTML
converter is pretty easy to make - however, it adds a piece of "behind
the scenes magic" that I would like to avoid. In particular
Option (3) has a lot of merit: you have a lower maintenance burden,
but there's also no behind the scenes magic that isn't clearly spelled
out in the template. The "<br$SelfClose>" is my favourite, because
it's concise. It would only need to be written by template developers
that are wanting to build dual-format templates, which I would expect
is a group of people that are getting deep into SS, so the fact that
it's an odd syntax that people would need to learn is acceptable IMO.
In order to do any of these, we would probably need a way of detecting
whether an XHTML page or an HTML page was being rendered. One way of
doing this would be to add a hook into SSViewer that would look at the
doctype of the main template (i.e., the one with an "<html>" tag), and
expose that information via a SSViewer::html_doctype_used() method.
We could also encourage people to use $Form.XHTML or $Form.HTML to
include forms in their templates; that way detection isn't necessary.
But it seems a little clumsy.