[Pharo-project] File Out html with Syntax Highlighting
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
2010/2/10 Nathan Tuttle <nathan.tuttle@gmail.com>
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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
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
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: pharo-project-bounces@lists.gforge.inria.fr [mailto:pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Levente Uzonyi Sent: Wednesday, February 10, 2010 9:12 PM To: Pharo-project@lists.gforge.inria.fr 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
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: pharo-project-bounces@lists.gforge.inria.fr [mailto:pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Stéphane Ducasse Sent: Thursday, February 11, 2010 7:17 AM To: Pharo-project@lists.gforge.inria.fr 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
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 <bschwab@anest.ufl.edu> 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: pharo-project-bounces@lists.gforge.inria.fr [mailto:pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Stéphane Ducasse Sent: Thursday, February 11, 2010 7:17 AM To: Pharo-project@lists.gforge.inria.fr 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Lukas Renggli http://www.lukas-renggli.ch
participants (6)
-
Eliot Miranda -
Levente Uzonyi -
Lukas Renggli -
Nathan Tuttle -
Schwab,Wilhelm K -
Stéphane Ducasse