About SqueakMap for 3.2 and the future!
goran.hultgren at bluefish.se
goran.hultgren at bluefish.se
Mon Oct 28 08:10:08 UTC 2002
Hi Avi and all!
Avi Bryant <avi at beta4.com> wrote:
> On Sun, 27 Oct 2002, [ISO-8859-1] Göran Hultgren wrote:
>
> > I have actually a reimplementation of the Swiki-syntax that is completely
> > "separate" that we can plug into SM!.
>
> I'd be interested in taking a look at this - is there a changeset you can
> post?
Sure, took some time to clean it up just a teeny bit. It is a single
class and it seemed to work in a clean 3.2.
Read class comment, read method comment in #swikifyPiece: and play with
class side tests.
And:
- Yes, the tests should be SUnit tests.
- No, I haven't optimized it yet, but the profiler shows that there are
a few things we could fix.
- No, the code is perhaps not pretty, but it is at least contained and
IMHO much more direct than in ComSwiki.
- No, mixing uls and ols does not currently work.
- Yes, you just implement #urlForLink: in your model and then do as the
tests do. Here is an example of more advanced urlForLink method:
urlForLink: aString
"Resolve aString into a relative url. Case insensitive.
We check for products, employees, special pages,
newslines and documents in that order. If nothing matches
the string is returned as it is."
| hit string |
string _ aString asLowercase.
hit _ company products detect: [:p | p name asLowercase = string]
ifNone: [nil].
hit ifNotNil: [^'produkter/', hit name].
hit _ company employees detect: [:e | e name asLowercase beginsWith:
string] ifNone: [nil].
hit ifNotNil: [^'anstallda/', hit name].
hit _ specialPages detect: [:p | p title asLowercase = string] ifNone:
[nil].
hit ifNotNil: [^'sida?id=', hit id asString].
hit _ newsItems detect: [:i | i title asLowercase = string] ifNone:
[nil].
hit ifNotNil: [^'nyheter/', hit title].
hit _ documents detect: [:d | d alias asLowercase = string or: [d
fileName asLowercase = string]] ifNone: [nil].
hit ifNotNil: [^'dokument/', hit fileName].
"no hit..."
^aString
Enjoy. I am thinking of adding this class into SM but then we need to
make it pretty in SMLoader and Browser too. :-) Or perhaps we could just
reuse parts of Scamper to show the HTML?!
> Avi
regards, Göran
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WBHtmlFormatter.st
Type: application/octet-stream
Size: 14976 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20021028/f914471c/WBHtmlFormatter.obj
More information about the Squeak-dev
mailing list
|