> Hi all,
>
> In practice quite often I feel a need for document fragments, the
> inside of an element, of type GenChildList m.
>
> Currently I see only one way of doing this:
>
> asChild [ <% "literal text" %>, <% foo %>, <% bar + 5 %>]
Yeah, that is one way. I often end up adding dummy div or span tags:
<div>
literal text
<% foo %>
<% bar + 5 %>
</div>
But I never feel great about it :) (The type is not quite the same,
that produces an element instead of a list of children, but both of
those things can be embedded in a parent element, so it usually is
sufficient). Adding the div tags can be problematic if the divs have
non-zero margin/padding, since it affects layout.
> I imagine there should be something like this possible:
>
> <%>
> literal text
> <% foo %>
> <% bar + 5 %>
> </%>
Yes, that certainly seems nicer. I have copied my reply to the haskell-
server-pages group. That is probably a better place to ask about this.
http://groups.google.com/group/haskell-server-pages
Niklas should be able to give an idea of how feasible that is. The
good part is that the change would not require any modifications to
the XMLGen class or the XML type. It just requires the trhsx
preprocessor to learn a new special token and way to expand things. I
don't know how hard/easy that is.
- jeremy
It's definitely feasible, though apart from changing trhsx it also
requires some 'major' changes in HSE. That said - I really like this
proposal. It's both simple and elegant, and doesn't interfere with
anything else. I will try to find the time to implement it Some Time
Soon (tm). :-)
Cheers,
/Niklas
I've now implemented this feature in haskell-src-exts 1.10.0 and hsx
0.8.0. Neither has been released on hackage yet, since a) I would
appreciate some testing by you guys before I do so, to see I haven't
broken anything, and b) I have a few other fixes/changes saved up for
the major version bump of HSE that I want to have a look at before
releasing it. But the changes are pushed to the respective darcs
repos, so please test away! :-)
Cheers,
/Niklas
Does other fixes/changes include a patch for this:
http://groups.google.com/group/haskell-server-pages/browse_thread/thread/250f9fd18858a219
I have a fair bit of HSP code that will not compile with out that
patch. And there is no work around except to edit Trhsx.hs and add
ExplicitForall (or fix Trhsx the 'right' way).
I am about to start documenting HSP in the happstack crash course. It
would be nice to get that resolved.
- jeremy
Cheers,
/Niklas
> --
> You received this message because you are subscribed to the Google Groups "Haskell Server Pages" group.
> To post to this group, send email to haskell-se...@googlegroups.com.
> To unsubscribe from this group, send email to haskell-server-p...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/haskell-server-pages?hl=en.
>
>