> I'd like to render some tags in user input. So, if the user entered
> 'some text with some <b>bold text</b>', I'd like to render this
> appropriately when it is redisplayed.
>
> I only want to allow a subset of tags. In fact I'd really like to play
> with the syntax, perhaps use email conventions like asterisks for bold,
> underscores for underline.
>
> Has anyone done this or something like this? If so would be interested
> to hear your experiences.
Pier (
http://www.lukas-renggli.ch/smalltalk/pier) can do that kind of
transformations.
document := PRDocumentParser parse: '""hi all""'.
The parser returns a document, this is the root of an AST representing
your input. It is independent from the actual output, but it can be
easily transformed into about any other format.
For example plain text:
PRTextWriter write: document --> 'hi all'
Back to wiki syntax:
PRWikiWriter write: document --> '""hi all""'
Squeak formatted text (requires the Pier-OmniBrowser plugin):
PRTextDocumentWriter write: document --> a Text for '""hi all""'
Latex (you need a special plugin here):
PRLatexWriter write: document --> '\textbf{hi all}'
And, of course, also to HTML (you need Seaside and Pier-Seaside here):
PRViewRenderer new
start: document
in: aComponent
on: html --> '<strong>hi all</strong>'
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside