Hi,
after my successful attempt to output a "designated" test url in Safari, I'd now like to make a command which shows the rendered html in a TextMate browser window. That is show _the actual html itself_, not the browser-interpretation of that html. My system of scripts and templates generate html. Now I like to see that output html with nice code coloring in my favorite theme.
I see roughly two solutions: output the result of 'curl "$MY_URL"' in a TextMate HTML browser window or create a new (html) document from that output.
I would like the HTML Browser window variant much better. For (1) because it keeps only one window –i.e. it refreshes itself when it's already open, instead of opening a 2nd window–, (2) because I won't be tempted to edit the output HTML, and (3) because when I might become really smart –for which the changes are extremely slim, based on previous records ;)– I might be able to give blocks of html code a href to jump back to the specific code in the specific template file (I just *love* the TODO bundle. It saved me so much time. Life has become much more convenient :-))
My first problem is the with output of Apache restarting: it's not quiet. I need Apache to restart for all the last versions of my templates to become effective, but the following code echo "$PWD" | sudo -S apachectl $APACHE_CMD (line 43 from apachectlUsingKeychain.sh in Apache Bundle Support Folder) outputs "Password:", since sudo is asking for that. Is there a way to make this statement quiet?
2nd, about the Create New Document variant. How to set the scope of such a newly created document? Right now there is nothing indicating to TextMate that is might be html, so the output stays unstyled.
Finally on to the core of this email: How to get HTML pretty printed in a (HTML parsing) browser window? I am looking at examples like pastie [1] or TextMate Theme Sourcerer [2]. Are the solutions used in these web 2.0 projects also available for my TextMate commands?
Best dirk
[1]: http://pastie.caboo.se/ [2]: http://projects.serenity.de/textmate/codestyler/source.php
Given what you want is a syntax-highlighted source view, have you considered just running the output to an editor window? That would certainly get you great syntax-highlighted source...
The main downside I see is that, last I knew, this style of output could only create a new editor window, rather than updating an existing window on multiple invocations, like the HTML viewer outputs. -jrk
On 11/3/06, Dirk van Oosterbosch, IR labs labs@ixopusada.com wrote:
Hi,
after my successful attempt to output a "designated" test url in Safari, I'd now like to make a command which shows the rendered html in a TextMate browser window. That is show _the actual html itself_, not the browser-interpretation of that html. My system of scripts and templates generate html. Now I like to see that output html with nice code coloring in my favorite theme.
I see roughly two solutions: output the result of 'curl "$MY_URL"' in a TextMate HTML browser window or create a new (html) document from that output.
I would like the HTML Browser window variant much better. For (1) because it keeps only one window –i.e. it refreshes itself when it's already open, instead of opening a 2nd window–, (2) because I won't be tempted to edit the output HTML, and (3) because when I might become really smart –for which the changes are extremely slim, based on previous records ;)– I might be able to give blocks of html code a href to jump back to the specific code in the specific template file (I just *love* the TODO bundle. It saved me so much time. Life has become much more convenient :-))
My first problem is the with output of Apache restarting: it's not quiet. I need Apache to restart for all the last versions of my templates to become effective, but the following code echo "$PWD" | sudo -S apachectl $APACHE_CMD (line 43 from apachectlUsingKeychain.sh in Apache Bundle Support Folder) outputs "Password:", since sudo is asking for that. Is there a way to make this statement quiet?
2nd, about the Create New Document variant. How to set the scope of such a newly created document? Right now there is nothing indicating to TextMate that is might be html, so the output stays unstyled.
Finally on to the core of this email: How to get HTML pretty printed in a (HTML parsing) browser window? I am looking at examples like pastie [1] or TextMate Theme Sourcerer [2]. Are the solutions used in these web 2.0 projects also available for my TextMate commands?
Best dirk
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 3-nov-2006, at 18:12, Jonathan Ragan-Kelley wrote:
Given what you want is a syntax-highlighted source view, have you considered just running the output to an editor window? That would certainly get you great syntax-highlighted source...
If you mean to set the output to "Create New Document", yes that's one variant. I haven't figured out how to set the language scope of that new document, though.
The main downside I see is that, last I knew, this style of output could only create a new editor window, rather than updating an existing window on multiple invocations, like the HTML viewer outputs.
Indeed, plus I would like to be able to make links in the output pointing to my code.
Let me reply myself:
I solved the 1st problem (the silencing of sudo) with this: echo "$PWD" | sudo -S apachectl $APACHE_CMD > /dev/null 2>&1 I first tried only > /dev/null and didn't understand why I was still getting "Password:" back, but then I discovered about the stderror (the '2')
I still haven't figured out how to set the language of a "Create New Document" document from a command, but as I argued I like the "Show as HTML" output much better and since that succeeded ... :-)
I found pygments [1] as exactly the tool I was looking for. They don't support so much languages as we have in our repository, and of course the css styles that come with it, are not way as stunningly beautiful as the TextMate styles ;-) but it's quiet alright and its API is easy to use and well documented. I found Pygments through paste.e-scribe [2] ... I just wished I could use pastie's [3] codestyler's [4] colors and lexers ... mmm dreaming ...
Anyway, my weekend solution comes close: curl -s "$TEST_URL" | pygmentize -f html -l html -O full=True,style=friendly
[1] http://pygments.pocoo.org [2] http://paste.e-scribe.com [3] http://pastie.textmate.org [4]: http://projects.serenity.de/textmate/codestyler/source.php
On 3-nov-2006, at 17:51, Dirk van Oosterbosch, IR labs wrote:
Hi,
after my successful attempt to output a "designated" test url in Safari, I'd now like to make a command which shows the rendered html in a TextMate browser window. That is show _the actual html itself_, not the browser-interpretation of that html. My system of scripts and templates generate html. Now I like to see that output html with nice code coloring in my favorite theme.
I see roughly two solutions: output the result of 'curl "$MY_URL"' in a TextMate HTML browser window or create a new (html) document from that output.
I would like the HTML Browser window variant much better. For (1) because it keeps only one window –i.e. it refreshes itself when it's already open, instead of opening a 2nd window–, (2) because I won't be tempted to edit the output HTML, and (3) because when I might become really smart –for which the changes are extremely slim, based on previous records ;)– I might be able to give blocks of html code a href to jump back to the specific code in the specific template file (I just *love* the TODO bundle. It saved me so much time. Life has become much more convenient :-))
My first problem is the with output of Apache restarting: it's not quiet. I need Apache to restart for all the last versions of my templates to become effective, but the following code echo "$PWD" | sudo -S apachectl $APACHE_CMD (line 43 from apachectlUsingKeychain.sh in Apache Bundle Support Folder) outputs "Password:", since sudo is asking for that. Is there a way to make this statement quiet?
2nd, about the Create New Document variant. How to set the scope of such a newly created document? Right now there is nothing indicating to TextMate that is might be html, so the output stays unstyled.
Finally on to the core of this email: How to get HTML pretty printed in a (HTML parsing) browser window? I am looking at examples like pastie [1] or TextMate Theme Sourcerer [2]. Are the solutions used in these web 2.0 projects also available for my TextMate commands?
Best dirk
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
----------------------------- Dirk van Oosterbosch de Wittenstraat 225 1052 AT Amsterdam the Netherlands
http://labs.ixopusada.com -----------------------------
Le 5 nov. 06 à 02:18, Dirk van Oosterbosch, IR labs a écrit :
I found pygments [1] as exactly the tool I was looking for. They don't support so much languages as we have in our repository, and of course the css styles that come with it, are not way as stunningly beautiful as the TextMate styles ;-) but it's quiet alright and its API is easy to use and well documented. I found Pygments through paste.e-scribe [2] ... I just wished I could use pastie's [3] codestyler's [4] colors and lexers ... mmm dreaming ...
do you know of a lexer for AppleScript and pygments and/or any other (x)htmlizer (ruby prefered ?)
Yvon
Yvon Thoraval wrote:
do you know of a lexer for AppleScript and pygments and/or any other (x)htmlizer (ruby prefered ?)
You can't really handle AppleScript without a full AppleScript compiler. TM's AppleScript language grammar tries to do the best it can, but there are several places where it's impossible to color things correctly without basing parsing on application script dictionaries used by the script.
I think there are some tools that can get that info from Script Editor, for putting correctly highlighted scripts on the web. Not sure where to find them though. Maybe try some of the scripting sites?
-Jacob
This is a project of interest to me too, although I've not seen any such colorizers that were either complete (as Jacob Rus points out, that depends on application dictionaries), nor have I seen any that were really successful. I suspect there's a lot of work to be done there and I'm only starting to look at it.
Colorization is based on parsing the script into these categories:
New Text (editors show uncompiled text in a different color from those below) (so this is not an important category for colorization of working scripts)
After compilation, these categories apply: Operators (+, &, > etc.) Language Keywords (e.g. selection, file , current date, etc. defined in the AppleScript resource) Application Keywords (e.g. Calendar in iCal, defined in the application dictionary) Comments (blocks defined by -- ... return, or (* ... *) Values (numbers, strings, etc.) Variable and Handler names (defined terms not belonging to the list above) References (not sure about this category)
A colorizer must assign a unique color to each, and it must be able to recognize that certain keywords are not single words, but groups of words - do shell script " text ", as alias list, etc.
One of the best I have seen (but don't have code for) was written by John Nathan (often seen as Jonn8).
Adam
At 10:43 PM -0500 11/19/06, Jacob Rus wrote:
Yvon Thoraval wrote:
do you know of a lexer for AppleScript and pygments and/or any other (x)htmlizer (ruby prefered ?)
You can't really handle AppleScript without a full AppleScript compiler. TM's AppleScript language grammar tries to do the best it can, but there are several places where it's impossible to color things correctly without basing parsing on application script dictionaries used by the script.
I think there are some tools that can get that info from Script Editor, for putting correctly highlighted scripts on the web. Not sure where to find them though. Maybe try some of the scripting sites?
-Jacob
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
At 10:43 PM -0500 11/19/06, Jacob Rus wrote:
Yvon Thoraval wrote:
do you know of a lexer for AppleScript and pygments and/or any other (x)htmlizer (ruby prefered ?)
You can't really handle AppleScript without a full AppleScript compiler. I think there are some tools that can get that info from Script Editor, for putting correctly highlighted scripts on the web. Not sure where to find them though. Maybe try some of the scripting sites?
Compile your script in Script Editor, and take the (now colorized) results and paste it into TextEdit.
Then in TextEdit do File->Save and select HTML as your option. Bingo Bango.
I think Script Debugger lets you do this in all one step, but I don't know for certain (where as I WAS able to test the above method)
HTH, _Ryan Wilcox
Le 20 nov. 06 à 16:37, Ryan Wilcox a écrit :
Then in TextEdit do File->Save and select HTML as your option. Bingo Bango.
Yes thanks, i've found that in the mean time ;-)
and forgot to mention that (i had to rebuild mac os x from scratch because of Script Editor with a script of mine entering an infinite loop)))
I'll write some osascript to do that automatically, and post it here !
best,
Yvon
On 20-nov-2006, at 16:37, Ryan Wilcox wrote:
Then in TextEdit do File->Save and select HTML as your option. Bingo Bango.
Huh ??? Sorry, I am clearly missing something here. Where can I select HTML as an option? (I see an option for File Encoding / Line Endings ... )
dirk
Le 21 nov. 06 à 01:08, Dirk van Oosterbosch, IR labs a écrit :
Sorry, I am clearly missing something here. Where can I select HTML as an option? (I see an option for File Encoding / Line Endings ... )
when you save the file their is a popup within the saving window...