File Out html with Syntax Highlighting

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

File Out html with Syntax Highlighting

Nathan Tuttle
I find it very useful when learning a language to see the code accurately syntax highlighted on a web page when a snippet is shown. I want to design a fileout method that will allow developers to file out code with html to put into a web page.

I know I need to use RBFormatter; any ideas on where to go from here? Where do I get a codestream for example?

thanks
<input onclick="jsCall();" id="jsProxy" type="hidden">

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: File Out html with Syntax Highlighting

Eliot Miranda-2


2010/2/10 Nathan Tuttle <[hidden email]>
I find it very useful when learning a language to see the code accurately syntax highlighted on a web page when a snippet is shown. I want to design a fileout method that will allow developers to file out code with html to put into a web page.

I know I need to use RBFormatter; any ideas on where to go from here? Where do I get a codestream for example?

You can also use the Shout formatter and the Tweak-Text-HTML text to html support.  I used this to highlight the code on my blog.  I have some tweaks to this code if you go this route.


thanks

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: File Out html with Syntax Highlighting

Levente Uzonyi-2
In reply to this post by Nathan Tuttle
On Wed, 10 Feb 2010, Nathan Tuttle wrote:

> I find it very useful when learning a language to see the code accurately
> syntax highlighted on a web page when a snippet is shown. I want to design a
> fileout method that will allow developers to file out code with html to put
> into a web page.
>
> I know I need to use RBFormatter; any ideas on where to go from here? Where
> do I get a codestream for example?

In Squeak there's a "copy html" menu item in the context menu of
StringHolder (available in Browser, Workspace, etc.) which copies the
contents as html to the clipboard. If you just want a few code snippets
with syntax highlight you can use this (the syntax highlight is provided
by Shout).

If you need something more complex, you can still use Shout to higlight
your code (which will give you Text objects) and Text >> #printHtmlOn: to
convert it to html.

Note that both the "copy html" menu item and the Text to html conversion
was removed from Pharo so you have to roll your own if you need it. Syntax
highlighting can still be done with Shout.


Levente

>
> thanks
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: File Out html with Syntax Highlighting

Schwab,Wilhelm K
A syntax-highlighted HTML export would be greatly appreciated.  IMHO, it should be available in the MC browser, giving one file per package.  My primary interest is pre-release checking of code, in particular for anything I should not have said in comments.




-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Levente Uzonyi
Sent: Wednesday, February 10, 2010 9:12 PM
To: [hidden email]
Subject: Re: [Pharo-project] File Out html with Syntax Highlighting

On Wed, 10 Feb 2010, Nathan Tuttle wrote:

> I find it very useful when learning a language to see the code
> accurately syntax highlighted on a web page when a snippet is shown. I
> want to design a fileout method that will allow developers to file out
> code with html to put into a web page.
>
> I know I need to use RBFormatter; any ideas on where to go from here?
> Where do I get a codestream for example?

In Squeak there's a "copy html" menu item in the context menu of StringHolder (available in Browser, Workspace, etc.) which copies the contents as html to the clipboard. If you just want a few code snippets with syntax highlight you can use this (the syntax highlight is provided by Shout).

If you need something more complex, you can still use Shout to higlight your code (which will give you Text objects) and Text >> #printHtmlOn: to convert it to html.

Note that both the "copy html" menu item and the Text to html conversion was removed from Pharo so you have to roll your own if you need it. Syntax highlighting can still be done with Shout.


Levente

>
> thanks
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: File Out html with Syntax Highlighting

Stéphane Ducasse
In reply to this post by Levente Uzonyi-2
Background note:
        we removed this functionality because it was badly implemented hardcoding
        <h1> everywhere.
A fileouter should act as a visitor on the class not hack inside the fileout.

People could extend the latex exporter damien cassou did. And damien did not
added '\section{' everytwhere with conditional inside the fileout behavior....
like this is done in Squeak.

Stef



On Feb 11, 2010, at 3:11 AM, Levente Uzonyi wrote:

> On Wed, 10 Feb 2010, Nathan Tuttle wrote:
>
>> I find it very useful when learning a language to see the code accurately
>> syntax highlighted on a web page when a snippet is shown. I want to design a
>> fileout method that will allow developers to file out code with html to put
>> into a web page.
>>
>> I know I need to use RBFormatter; any ideas on where to go from here? Where
>> do I get a codestream for example?
>
> In Squeak there's a "copy html" menu item in the context menu of
> StringHolder (available in Browser, Workspace, etc.) which copies the
> contents as html to the clipboard. If you just want a few code snippets
> with syntax highlight you can use this (the syntax highlight is provided
> by Shout).
>
> If you need something more complex, you can still use Shout to higlight
> your code (which will give you Text objects) and Text >> #printHtmlOn: to
> convert it to html.
>
> Note that both the "copy html" menu item and the Text to html conversion
> was removed from Pharo so you have to roll your own if you need it. Syntax
> highlighting can still be done with Shout.
>
>
> Levente
>
>>
>> thanks
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: File Out html with Syntax Highlighting

Schwab,Wilhelm K
Stef,

Understood about the poor implementation.  LaTeX would be fine for me, provided it produces a syntax colored output.  The whole point (in my view) is to get the comments to stand out so I can give them a careful check for things I do not want to air in public.

Bill


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Stéphane Ducasse
Sent: Thursday, February 11, 2010 7:17 AM
To: [hidden email]
Subject: Re: [Pharo-project] File Out html with Syntax Highlighting

Background note:
        we removed this functionality because it was badly implemented hardcoding
        <h1> everywhere.
A fileouter should act as a visitor on the class not hack inside the fileout.

People could extend the latex exporter damien cassou did. And damien did not added '\section{' everytwhere with conditional inside the fileout behavior....
like this is done in Squeak.

Stef



On Feb 11, 2010, at 3:11 AM, Levente Uzonyi wrote:

> On Wed, 10 Feb 2010, Nathan Tuttle wrote:
>
>> I find it very useful when learning a language to see the code
>> accurately syntax highlighted on a web page when a snippet is shown.
>> I want to design a fileout method that will allow developers to file
>> out code with html to put into a web page.
>>
>> I know I need to use RBFormatter; any ideas on where to go from here?
>> Where do I get a codestream for example?
>
> In Squeak there's a "copy html" menu item in the context menu of
> StringHolder (available in Browser, Workspace, etc.) which copies the
> contents as html to the clipboard. If you just want a few code
> snippets with syntax highlight you can use this (the syntax highlight
> is provided by Shout).
>
> If you need something more complex, you can still use Shout to
> higlight your code (which will give you Text objects) and Text >>
> #printHtmlOn: to convert it to html.
>
> Note that both the "copy html" menu item and the Text to html
> conversion was removed from Pharo so you have to roll your own if you
> need it. Syntax highlighting can still be done with Shout.
>
>
> Levente
>
>>
>> thanks
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: File Out html with Syntax Highlighting

Lukas Renggli
Pier-Shout does Smalltalk syntax highlighting to HTML. It is used for
example in book.seaside.st and on various Pier blogs. It could be
adapted to be used for LaTeX too.

Lukas

On 11 February 2010 13:31, Schwab,Wilhelm K <[hidden email]> wrote:

> Stef,
>
> Understood about the poor implementation.  LaTeX would be fine for me, provided it produces a syntax colored output.  The whole point (in my view) is to get the comments to stand out so I can give them a careful check for things I do not want to air in public.
>
> Bill
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Stéphane Ducasse
> Sent: Thursday, February 11, 2010 7:17 AM
> To: [hidden email]
> Subject: Re: [Pharo-project] File Out html with Syntax Highlighting
>
> Background note:
>        we removed this functionality because it was badly implemented hardcoding
>        <h1> everywhere.
> A fileouter should act as a visitor on the class not hack inside the fileout.
>
> People could extend the latex exporter damien cassou did. And damien did not added '\section{' everytwhere with conditional inside the fileout behavior....
> like this is done in Squeak.
>
> Stef
>
>
>
> On Feb 11, 2010, at 3:11 AM, Levente Uzonyi wrote:
>
>> On Wed, 10 Feb 2010, Nathan Tuttle wrote:
>>
>>> I find it very useful when learning a language to see the code
>>> accurately syntax highlighted on a web page when a snippet is shown.
>>> I want to design a fileout method that will allow developers to file
>>> out code with html to put into a web page.
>>>
>>> I know I need to use RBFormatter; any ideas on where to go from here?
>>> Where do I get a codestream for example?
>>
>> In Squeak there's a "copy html" menu item in the context menu of
>> StringHolder (available in Browser, Workspace, etc.) which copies the
>> contents as html to the clipboard. If you just want a few code
>> snippets with syntax highlight you can use this (the syntax highlight
>> is provided by Shout).
>>
>> If you need something more complex, you can still use Shout to
>> higlight your code (which will give you Text objects) and Text >>
>> #printHtmlOn: to convert it to html.
>>
>> Note that both the "copy html" menu item and the Text to html
>> conversion was removed from Pharo so you have to roll your own if you
>> need it. Syntax highlighting can still be done with Shout.
>>
>>
>> Levente
>>
>>>
>>> thanks
>>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



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

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project