Hmm! The second time in a short bit this question arises.

The key is the stuff you put into a swiki edit page text edit is *not*
HTML. It is SwikiStructured text and is interprested as such. One aspect
of SwikiStructured text (which I don't like) is that you can mix in
arbitrary HTML *tags*. More properly, HTML tags aren't *escaped* by the
default Swiki Processor, thus they get interpreted by the browser as
straight HTML. This leads to the occasional surprise, such as the one you
encountered. In SwikiStructured text, line breaks are "preserved" by being
mapped to <br>s. When you added the <pre> tag around your text, you didn't
escape from the SwikiStructuring, you just added two bits of text that get
passed through as is which happen to have meaning to the browser.

The "escape" from Swiki processing is the <html></html> tag. Text inside
the tag will be passed as is, thus any HMTL you include will come through
intact.

It's really easy to add other escape codes that would do special
formatting (for example, colorizing/pretty-printing code). Look at
LineFormatter class>>showFormatter. A key line:

        instance addExceptionFrom: '<html>' 
                 to: '</html>' 
                 using: [:text :request :page :book | text].

In the block, you can process the text any which way you like. Here it
just returns it unchanged. 

Hope this helps,
Bijan.

Reply via email to