> The problem is that SSPs are great for simple things. The old PWS Swiki
> used a similar system. With the new one, I knew things were going to have
> to become more complicated. So, having actions and templates in the same
> file is too limiting and much more complicated looking. Eventually, we
> will get a tool that allows for easier Swiki editing, but Swiki is still
> changing too much for that to be possible right now.

Here's a specific example.  The three methods below implement a simple
template scenario (monadic blocks understand #sspStreamOn:).  As you can see
it can make things complicated.

Our motivation for SSP was that we were moving a lot of the standard Swiki
actions and templates back into the image and we found ourselves
implementing a lot of methods that simply returned a literal string of
templated HTML, which we would then run through formatters (sometimes four
or five templates would need formatting to build a single page).  The string
literal methods were just not pretty and we wanted a better way of keeping
HTML code organized in the image.  We also wanted to squeeze out some extra
performance.

Another neat thing to add would be language formatting for SSP methods
directly in the browser.  The pragma could be modified like:

<ssp on: strm language: 'html'>

Support for any number of languages could be added...the same mechanism
could also support formatting/editing for those languages natively supported
in Squeak (i.e. the Prolog implementation).

One side benefit is that by building pages in this way, we have the ability
to start serving pages before they are completely rendered.  Unfortunately,
HTTP doesn't give us a way of aborting mid stream in the event of an error
(followed by an error response)...at least not that I'm aware.  But, perhaps
other protocols may allow this.

---snip---
fullHtmlOn: strm

        self
                htmlTemplateOn: strm
                body: [ :strm2 | self htmlBodyOn: strm2 ]
---snip---
htmlTemplateOn: strm body: body
<ssp on: strm>

<html>
        <body>
                <%= body %>
        </body>
</html>
---snip---
htmlBodyOn: strm
<ssp on: strm>

This is the html body text.
---snip---

- Stephen

Reply via email to