Colourizing parts of a preformatted text

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Colourizing parts of a preformatted text

Damien Cassou-3
Hi,

for my Pier website, I have implemented a pier plugin to pretty-print
code depending on a particular syntax:

https://diaspec.bordeaux.inria.fr/pier/Samples/Air+conditioning

This is interesting but requires some work. What's the easiest
solution to colourize a preformatted text? Is it possible to make a
particular (instance of a) word appear in a different color?

Bye

--
Damien Cassou
http://damiencassou.seasidehosting.st

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Colourizing parts of a preformatted text

Lukas Renggli
> This is interesting but requires some work. What's the easiest
> solution to colourize a preformatted text? Is it possible to make a
> particular (instance of a) word appear in a different color?

I am sure you know ShoutPier from seaside.st and my blog, they both
use Shout to highlight Smalltalk code. It would be easy to add
pretty-printing too, if that would be a requirement.

There are several JavaScript libraries available that do
syntax-highlighting  on the client-side. I've never tried to integrate
one of these libraries, but that should be easily possible.

  http://shjs.sourceforge.net/
  http://softwaremaniacs.org/soft/highlight/en/
  http://mihai.bazon.net/projects/javascript-syntax-highlighting-engine

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Colourizing parts of a preformatted text

Lautaro Fernández
In reply to this post by Damien Cassou-3
Some days ago, I've finished to bind a package that adds 2 brushes into the html (WARenderCanvas).

To use it you have to add a SHLibrary into your web site, and then doing something like:
renderContentOn: html
    html smalltalkCode:
    '
    message = ''
        ifTrue: [html div with: message]
        ifFalse: [html smalltalkCode: message]'

Other brushes(for instance, SQL, Java, CSS, C, etc etc...) can be added quite easily (really, it's easy) but I didn't need it, so I didn't added.

I've also implemented another package that binds Pier with this package. And allows you to do in an editor page the following:
[|] message = ''
[|]        ifTrue: [html div with: message]
[|]       ifFalse: [html smalltalkCode: message]
and the output will be the same as the #renderContentOn:

If you want the code, I can give it to you(or anyone).
I've tested both only on VisualWorks, but I think it will run on other dialects too.

the JS is from: http://alexgorbatchev.com/wiki/SyntaxHighlighter
if you download that JS it won't have the Smalltalk parser, because I did it and it will be published in the following version (that was what Alex told me).

Hope this helps.
Lautaro Fernández


2009/3/5 Damien Cassou <[hidden email]>
Hi,

for my Pier website, I have implemented a pier plugin to pretty-print
code depending on a particular syntax:

https://diaspec.bordeaux.inria.fr/pier/Samples/Air+conditioning

This is interesting but requires some work. What's the easiest
solution to colourize a preformatted text? Is it possible to make a
particular (instance of a) word appear in a different color?

Bye

--
Damien Cassou
http://damiencassou.seasidehosting.st

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki



--
Luke LAut SkyFernadezWalker


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Colourizing parts of a preformatted text

Damien Cassou-3
Hi Lautaro,

could you please send me what you have?

Thank you


On Thu, Mar 5, 2009 at 3:52 PM, Lautaro Fernández <[hidden email]> wrote:

> Some days ago, I've finished to bind a package that adds 2 brushes into the
> html (WARenderCanvas).
>
> To use it you have to add a SHLibrary into your web site, and then doing
> something like:
> renderContentOn: html
>     html smalltalkCode:
>     '
>     message = ''
>         ifTrue: [html div with: message]
>         ifFalse: [html smalltalkCode: message]'
>
> Other brushes(for instance, SQL, Java, CSS, C, etc etc...) can be added
> quite easily (really, it's easy) but I didn't need it, so I didn't added.
>
> I've also implemented another package that binds Pier with this package. And
> allows you to do in an editor page the following:
> [|] message = ''
> [|]        ifTrue: [html div with: message]
> [|]       ifFalse: [html smalltalkCode: message]
> and the output will be the same as the #renderContentOn:
>
> If you want the code, I can give it to you(or anyone).
> I've tested both only on VisualWorks, but I think it will run on other
> dialects too.
>
> the JS is from: http://alexgorbatchev.com/wiki/SyntaxHighlighter
> if you download that JS it won't have the Smalltalk parser, because I did it
> and it will be published in the following version (that was what Alex told
> me).
>
> Hope this helps.
> Lautaro Fernández
>
>
> 2009/3/5 Damien Cassou <[hidden email]>
>>
>> Hi,
>>
>> for my Pier website, I have implemented a pier plugin to pretty-print
>> code depending on a particular syntax:
>>
>> https://diaspec.bordeaux.inria.fr/pier/Samples/Air+conditioning
>>
>> This is interesting but requires some work. What's the easiest
>> solution to colourize a preformatted text? Is it possible to make a
>> particular (instance of a) word appear in a different color?
>>
>> Bye
>>
>> --
>> Damien Cassou
>> http://damiencassou.seasidehosting.st
>>
>> _______________________________________________
>> SmallWiki, Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>
>
>
> --
> Luke LAut SkyFernadezWalker
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Damien Cassou
http://damiencassou.seasidehosting.st


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Colourizing parts of a preformatted text

Lautaro Fernández
Of course, here it goes:
First attach: the highlighter for seaside and only for Smalltalk code.
Second attach: the bind with Pier and the above.

If you don't get the code (I've never attached into this list) send me another mail and I'll send it to you private email.

Both are released under MIT.
Let me know if it were useful ;)

Bye,
Lautaro Fernández

2009/3/8 Damien Cassou <[hidden email]>
Hi Lautaro,

could you please send me what you have?

Thank you


On Thu, Mar 5, 2009 at 3:52 PM, Lautaro Fernández <[hidden email]> wrote:
> Some days ago, I've finished to bind a package that adds 2 brushes into the
> html (WARenderCanvas).
>
> To use it you have to add a SHLibrary into your web site, and then doing
> something like:
> renderContentOn: html
>     html smalltalkCode:
>     '
>     message = ''
>         ifTrue: [html div with: message]
>         ifFalse: [html smalltalkCode: message]'
>
> Other brushes(for instance, SQL, Java, CSS, C, etc etc...) can be added
> quite easily (really, it's easy) but I didn't need it, so I didn't added.
>
> I've also implemented another package that binds Pier with this package. And
> allows you to do in an editor page the following:
> [|] message = ''
> [|]        ifTrue: [html div with: message]
> [|]       ifFalse: [html smalltalkCode: message]
> and the output will be the same as the #renderContentOn:
>
> If you want the code, I can give it to you(or anyone).
> I've tested both only on VisualWorks, but I think it will run on other
> dialects too.
>
> the JS is from: http://alexgorbatchev.com/wiki/SyntaxHighlighter
> if you download that JS it won't have the Smalltalk parser, because I did it
> and it will be published in the following version (that was what Alex told
> me).
>
> Hope this helps.
> Lautaro Fernández
>
>
> 2009/3/5 Damien Cassou <[hidden email]>
>>
>> Hi,
>>
>> for my Pier website, I have implemented a pier plugin to pretty-print
>> code depending on a particular syntax:
>>
>> https://diaspec.bordeaux.inria.fr/pier/Samples/Air+conditioning
>>
>> This is interesting but requires some work. What's the easiest
>> solution to colourize a preformatted text? Is it possible to make a
>> particular (instance of a) word appear in a different color?
>>
>> Bye
>>
>> --
>> Damien Cassou
>> http://damiencassou.seasidehosting.st
>>
>> _______________________________________________
>> SmallWiki, Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>
>
>
> --
> Luke LAut SkyFernadezWalker
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Damien Cassou
http://damiencassou.seasidehosting.st


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki



--
Luke LAut SkyFernadezWalker


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki

Seaside-JSSyntaxHighlighter.st (76K) Download Attachment
Pier-SmalltalkHighlighting.st (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Colourizing parts of a preformatted text

Damien Cassou-3
Hi Lautaro,

On Mon, Mar 9, 2009 at 12:54 PM, Lautaro Fernández <[hidden email]> wrote:
> Of course, here it goes:
> First attach: the highlighter for seaside and only for Smalltalk code.
> Second attach: the bind with Pier and the above.
>
> If you don't get the code (I've never attached into this list) send me
> another mail and I'll send it to you private email.
>
> Both are released under MIT.
> Let me know if it were useful ;)

thanks for the files. In the meantime, I've implemented
SyntaxHighlighter. See the announcement in this mailing list and
http://www.piercms.com/doc/add-ons#28425338.

--
Damien Cassou
http://damiencassou.seasidehosting.st


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki