> De: Jacob Rus <jacobolus(a)gmail.com>
>
>
> Juan Falgueras wrote:
>
>> ....but, why it doesn't colour when you give it selections? ehmmm
>> I usually need to cut functions, etc...
>> but anyway the Brad Choate solution is much much better than the
>> enscript one. Thanks
>> Is there some trick for make B. Choate script to colour portions
>> of text?
>>
>
> You're going to have to explain what you're having trouble with. I
> have no trouble turning selections to html with that command...
>
Yes. If you select a slice of your source code like...
-------
int main(){
TpNumero numero;
if (LeerCadena(numero)){
cout << "La cadena es correcta: " << numero << endl;
ImprimeDisplay(numero);
}
return 0;
}
--------
you get:
---------
<pre class="textmate-source"><span class="source source_c++">
<span class="storage storage_type
......
</span></pre>
--------
without the definitions of styles.. and the the rendering of this
html is uncoloured...
You need to select ALL the source text to get the full html with
colour styles, etc.
If you do so, the generated html starts with all the necessary styles:
-------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>displayNum.cpp</title>
<style type="text/css">
/* Stylesheet generated from TextMate theme
*
* VERDE
*
*
*/
/* Mostly to improve view within the TextMate HTML viewer */
body {
margin: 0;
padding: 0;
}
pre.textmate-source {
margin: 0;
padding: 0 0 0 2px;
font-family: ProFont, monospace;
........
---------------
Hi
I used to need pretty print my C++ code for students and I have found
the next simple script solves my problem in a cute way, since it
shows me the formatted code in a separate window (output "Show as
HTML") and then I can easily copy the source (Cmd-Opt-U) or the
styled text (copying directly from the output window):
----- input "Selected text" or "Document"
echo "<PRE>"
enscript --language=html -Ecpp -e -B --color \
--header="$TM_FILENAME|$E|pag. $% de $=" --title="$TM_FILENAME" \
-o- 2>/dev/null | \
perl -ne 'next if (1../<PRE>/i); last if (m|</PRE>|..1); print'
echo "</PRE>"
------ output "Show as HTML"
--- Save nothing, source.c
I would like to generalize it for it to be used with other source
code, not only C, what should be the better way? to have a table
mapping modes with enscript input modes... ?
Any help will be welcome.
--
Juan F.
Thanks Dougal, it is very impressive, really.
...but, why it doesn't colour when you give it selections? ehmmm
I usually need to cut functions, etc...
but anyway the Brad Choate solution is much much better than the
enscript one. Thanks
Is there some trick for make B. Choate script to colour portions of
text?
Thanks!
> De: Dougal <dougal(a)gmail.com>
> Fecha: 22 de mayo de 2007 01:59:38 GMT+02:00
> Para: "TextMate users" <textmate(a)lists.macromates.com>
> Asunto: Re: [TxMt] html pretty print
> Responder a: TextMate users <textmate(a)lists.macromates.com>
>
> Have you tried "Create HTML from Document / Selection" in the
> TextMate bundle?
>
> On 5/21/07, Juan Falgueras < jfalgueras(a)uma.es> wrote:
>
> Hi
>
> I used to need pretty print my C++ code for students and I have found
> the next simple script solves my problem in a cute way, since it
> shows me the formatted code in a separate window (output "Show as
> HTML") and then I can easily copy the source (Cmd-Opt-U) or the
> styled text (copying directly from the output window):
>
> ----- input "Selected text" or "Document"
> echo "<PRE>"
>
> enscript --language=html -Ecpp -e -B --color \
> --header="$TM_FILENAME|$E|pag. $% de $=" --title="$TM_FILENAME" \
> -o- 2>/dev/null | \
> perl -ne 'next if (1../<PRE>/i); last if (m|</PRE>|..1); print'
>
> echo "</PRE>"
> ------ output "Show as HTML"
> --- Save nothing, source.c
>
>
> I would like to generalize it for it to be used with other source
> code, not only C, what should be the better way? to have a table
> mapping modes with enscript input modes... ?
>
> Any help will be welcome.
>
>
> --
> Juan F.
I am having trouble figuring out the spreadsheet bundle. Suppose I have the
following table:
|name |foo |bar |total |
|mike | 1 | 2 | |
How do I calculate the total?
>From the screencasts, I think I should have this line:
% A3 := SUM(A1:A2)
Then what do I need to do to get the cell to display the value?
Mike
I recently added support for .rcss files to my Ruby on Rails project, those
being the equivalent of .rhtml, but for stylesheets. I've been trying to make a
grammar that gives me all the nice ERB autocompletion and syntax coloring that
exists for .rhtml files, but seem to be running into issues with the scope
selectors.
My grammar, based on th HTML (Rails) one is here: http://pastie.textmate.org/63540
Using that, I get proper syntax coloring for embedded Ruby if I use it at the
root level, but I still don't get autocomplete. And inside a CSS selector, I
can't get anything.
The output I'm getting: http://pastie.textmate.org/63543
Is there a way to specify conditional scope within a grammar? It seems like once
it hits the CSS selector, it doesn't recognize ERB anymore.
I've made a command which will list all colours in a CSS file as a list of
swatches.
At the minute it only does Hex colours also I would like it if you could
click
colours and it would jump to them in your document but I lack the ruby
skills as I'm sure you will notice from the shoddy
"colourArrayToTrim.each" bit.
Anyway some people might find it useful
input:entire document
output:show as HTML
activation:Key cmd+shift+opt+ctrl+c (ALL modifiers + C, to show ALL
colours ;) )
scope: source.css
Code as follows:
#!/usr/bin/env ruby
file = STDIN.read
fileName = ENV['TM_FILENAME']
hex = Regexp.new(/(#(\d|[a-f]|[A-F]){3,6})/)
colourArrayToTrim = file.scan(hex)
colourArray = []
colourArrayToTrim.each { |colour|
colourArray.push colour.shift
}
puts '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Colours</title>
<style type="text/css" media="screen">
a {
color: #000;
text-decoration: none;
line-height: 22px;
border: 1px solid #fff;
padding: 2px;
}
a:hover {
background-color: #EFEFEF;
border: 1px solid #999;
}
.colourRow {
display: block;
margin-top: 5px;
margin-bottom: 5px;
width:160px;
margin-right: 10px;
float:left;
}
.swatch {
width: 20px;
height: 20px;
display: block;
border: 1px solid #666;
margin-right: 10px;
float: left;
}
.swatch div {
width: 18px;
height: 18px;
border: 1px solid #fff;
}
</style>
</head>
<body>'
puts "<h2>Colours used #{fileName}</h2>"
colourArray.each { |colour|
puts "
<a href='' class='colourRow'>
<div class='swatch'>
<div style='background-color:#{colour};'></div>
</div>
#{colour}
</a>
"
}
puts "
</body>
</html>
"
Hi,
Just wondering how I go about altering the setup to have folding
block comments in a PHP file? I only need to fold doc-block type
comments which I see have been designated as effectively ^/**$ - I'm
not worried about blocks within functions. My doc comments can be
quite voluminous, and it's frustrating seeing huge swathes of
comments and little class xxxx {... stubs when I want to get an over
view of the entire file...
;-)
R