[squeak-dev] swiki source suited to recent Squeaks
Chris Cunnington
brasspen at gmail.com
Sat Aug 10 22:08:55 UTC 2019
> On Aug 10, 2019, at 6:04 PM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>
> On Tue, 6 Aug 2019, tim Rowledge wrote:
>
>>
>>
>>> On 2019-08-05, at 10:50 PM, Chris Cunnington <brasspen at gmail.com> wrote:
>>> Copy this code into a Workspace and DoIt.
>>> Installer ss
>>> project: 'MetacelloRepository';
>>> install: 'ConfigurationOfXMLParser'.
>>> (Smalltalk at: #ConfigurationOfXMLParser) project bleedingEdge load
>>
>>
>> OK, so yet another "I couldn't spot this with google" moment. What fun.
>>
>> It does at least load. And then of course I had to load the XTreams stuff because I foolishly thought trying a cleaner image might be smart after all the 'fun' of previous attempts.
>
> Right. I also failed to notice it was for XMLParser instead of Xtreams.
> The following should load Xtreams and its dependencies, including monty's XMLParser into a fresh image:
>
> Installer ensureRecentMetacello.
> Installer ss
> project: 'MetacelloRepository';
> install: 'ConfigurationOfXtreams'.
> (Smalltalk at: #ConfigurationOfXtreams) project bleedingEdge load
+1
>
>>
>>>
>>> wikiGrammar := PEGParser grammarWiki reading.
>>> wikiParser := PEGParser parserPEG parse: 'Grammar' stream: wikiGrammar actor: PEGParserParser new.
>>> input := 'Single paragraph with *bold* and _italic_ text and a [link]' reading.
>>> wikiParser parse: 'Page' stream: input actor: PEGWikiGenerator new
>>> And you’ll get this. <div><p>Single paragraph with <span style="font-weight: bold">bold</span> and <span style="font-style: italic">italic</span> text and a <a href="link.html">an OrderedCollection($l $i $n $k)</a></p></div>
>>
>> Just for fun I did try that in the earlier-dirty image and it failed because somewher it decided that 'link' was an orderedcollection of symbols instead of a string. Made for an amusing crash within XMLWriter>>#write:escapedWith:
>>
>> In a start-from-clean image it did actually do what your show. Thank you for that. I really think a simpler solution would be nice here. Adding 4Mb to an image for a simple swiki markup parser seems a bit much.
>
> I wrote and attached a different actor, which builds a simple dom tree, which can be turned into a string:
>
> GoogleWikiCompiler example asString
>
> should give
>
> '<div><p>Single paragraph with <strong>bold</strong> and <em>italic</em> text and a <a href="link.html">link</a></p></div>'
>
> It has no external dependencies but Xtreams-Parsing, so it doesn't need monty's XMLParser to be loaded.
>
+1
Chris
> Levente
>
>>
>> tim
>> --
>> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
>> Strange OpCodes: RDL: Rotate Disk Left
> <GoogleWikiCompiler.st>
More information about the Squeak-dev
mailing list
|