This program, given a source file, produces a document with syntax highlighting.
At the moment it generates output in these formats:
NOTICE: now the name of the program is source-highlight: there are no two separate programs, namely java2html and cpp2html, anymore. However there are two shell scripts with the same name in order to facilitate the migration (however their use is not advised).
GNU Source-highlight is free software. Please see the file COPYING for details. For documentation, please read this file.
GNU Source-highlight is a GNU
program and its main home page is at GNU site:
http://www.gnu.org/software/src-highlite/source-highlight.html
I do not distribute Windows binaries anymore; since, they can be
easily built by using Cygnus C/C++ compiler, available at http://www.cygwin.com/. However, if
you don't feel like downloading such compiler, you can request such
binaries directly to me, by e-mail (find my e-mail at my home page)
and I can send them to you.
An MS-Windows port of Source-highlight is available from http://gnuwin32.sourceforge.net/.
cvs -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/src-highlite login
cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/src-highlite co src-highliteFurther instructions can be found at the address: http://savannah.gnu.org/projects/src-highlite.
Please notice that this way you will get the latest development sources of Source-highlight, which may also be unstable. This solution is the best if you intend to correct/extend this program: you should send me patches against the latest cvs repository sources.
If, on the contrary, you want to get the sources of a given release, through cvs, say, e.g., version X.Y.Z, you must specify the tag rel_X_Y_Z when you run the cvs command or the cvs update command.
When you compile the sources that you get through the cvs repository, before running the configure and make commands, you should, at least the first time, run the command:
sh reconf
This will run the autotools commands in the correct order, and also copy possibly missing files. You should have installed recent versions of automake and autoconf in order for this to succeed. You will also need flex and bison.
NOTICE: This convention holds since release 2.1.
Here we only show some examples of generated files.
Here are some links to some of the C and C++ sources of source-highlight colored with source-highlight itself:
startapp.cc.htmlgenerated with the following command
Obviously it works with C files as well:source-highlight -s cpp -f html --doc startapp.cc
cmdline.c.htmlCreated with the command (notice that this one uses both CSS file and headers and footers):
And obviously it works with header file as well:source-highlight -s cpp -f html -i cmdline.c -o cmdline.c.html
--css="cpp2html.css"
--header="./header.html" --footer="./footer.html"
cmdline.h.htmlcreated with the command:
Here are some examples of Java files processed with source-highlight: Use Hello.java to make some test, if you want. Here's how Hello1.html, Hello2.html, Hello3.html, Hello4.html, Hello5.html, Hello_h_f.html, Hello_lines.html, Hello_xhtml.html, Hello_xhtml2.html were created:source-highlight -s cpp -f html *.h --css="mono.css"
source-highlight -s java -f html -i Hello.java -o Hello1.htmlHere's the output of source-highlight applied to a Prolog program (through the option `source-highlight -s prolog`: test.pl.html. This one is an highlighted Perl program (through the option `source-highlight -s prolog`): test.pm.html. Here's an highlighted PHP3 program: test.php3.html. And here's a Python program: test.py.html. This the flex scanner for flex files flex_scanner.ll.html. This is a Ruby program: test.rb.html. This is a Javascript program test.js.html. This is a Lua test program test.lua.html. This is a Caml test program test.ml.html and this is an Sml test program test.sml.html.
source-highlight -s java -f html --input Hello.java --output Hello2.html --doc
source-highlight -s java -f html -i Hello.java -o Hello3.html --title "Happy Java with java2html :-)" --tab 3
source-highlight -s java -f html < Hello.java > Hello4.html --title "and what about CSS :-)" --css "Hello.css"
source-highlight -s java -f html < Hello.java > Hello5.html --title "Wooo... this is quite dark ;-D" --css "mono-alt.css"
source-highlight -s java -f html --doc *.java
Processed Hello.java (creates Hello.java.html)
source-highlight -s java -f html --doc -i Hello.java -o Hello_h_f.html --style-file="default.style" --header="header.html" --footer="footer.html"
source-highlight -s java -f html --line-number --doc -i Hello.java -o Hello_lines.html
source-highlight -s java -f xhtml --doc -i Hello.java -o Hello_xhtml.html --css xhtml.css
../src/source-highlight -s java -f xhtml --doc -i Hello.java -o Hello_xhtml2.html --style-file default.style
Actually I want to extend it, so if you have some ideas...
The most import one will be to make source-highlight more customizable
:-)
Please send all bug reports by electronic mail to:
bug-source-highlight at gnu dot org
My home page is http://www.lorenzobettini.it
source-highlight is free software. See the file COPYING for copying conditions. Anyway I won't get offended if you send me a postcard :-)
Return to GNU's home page.
Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.
Please send comments on these web pages to webmasters@gnu.org, send other questions to gnu@gnu.org.
Copyright (C) 2001 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
Updated:9 Jan 2001 mhw