I've just released GNU Source-Highlight 2.9.
Apart the usual bug fixes, the major functional addition is the use of a file (called style.defaults) where you can specify that if a style is not defined for a specific element, then it defaults to another element. For instance, the element "preproc" if not specified will be highlighted as "keyword".
Furthermore, references for XHTML output files are not generated.
Then there were some additions concerning language definition files.
First of all, I've added c.lang for highlighting C programs (i.e., not C++). This was required in cases where in C you use names for variables that are keywords in C++ (e.g., "class").
As for programming languages, the new addition is the language definition for Haxe (provided by Jos Hirth); I actually didn't know this language, which is similar to Java.
/*
* test for haxe
*/
import Math;
class ShuffleBag{
var data:Array<Int>;
var cursor:Int;
//c'tor
public function new(){
data=[];
cursor=-1;
//pointless preprocessor tests :)
#if neko //nya :3
trace("neko");
#else flash9//no space
trace("flash9");
#end //foo
#if flash8
trace("flash8");
#end//no space
}
//add one or several item(s)
public function add(item:Int,?quantity:Int){
if(quantity==null){
data.push(item);
}else{
for(i in 0...quantity)
data.push(item);
}
cursor=data.length-1;
}
//returns the next item in the bag
public function next(){
if(cursor<1){
cursor=data.length-1;
return data[0];
}
var grab:Int=Math.floor(Math.random()*(cursor+1));
var temp:Int=data[grab];
data[grab]=data[cursor];
data[cursor]=temp;
cursor--;
return temp;
}
}
Then, I've added highlighting for some property/configuration files:
Property files:
# a comment
! a comment
source.favorites.jar = src/
output.favorites.jar = bin/
bin.includes = plugin.xml,\
META-INF/,\
favorites.jar,\
icons/
foo
a = "foo"
b = a string with escape sequences \t \n \r \\ \" \' \ (space) \u0123
c = a string with a continuation line \
continuation line
d.e.f = another string
.ini files:
[BrowserBar]
Width=295
# a comment
[Filebrowser]
Dir History=
Location=file://$HOME/
Separate Directories=false
Show Preview=false
Show hidden files=false
Sort by=Name
Sort case insensitively=true
Sort directories first=true
Sort reversed=false
View Style=Simple
[General]
HiddenOnExit=false
Timeout=20
[PlaylistColumnsLayout]
ColumnNames=Filename,Title,Artist,AlbumArtist,Composer,Year,Album,DiscNumber,Track,BPM,Genre,Comment,Directory,Type,Length,Bitrate,SampleRate,Score,Rating,PlayCount,LastPlayed,Mood,Filesize
ColumnOrder=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
ColumnWidths=0,184,92,0,0,100,92,0,0,0,0,0,73,0,80,0,0,0,0,0,0,0,0
ColumnsVersion=1
SortAscending=true
SortColumn=200
[Desktop Entry]
Encoding=UTF-8
Name=prova
Exec=prova %i %m -caption "%c"
Icon=prova
Type=Application
DocPath=prova/prova.html
Comment=A KDE KPart Application
Comment[fr]=Une application KPart pour KDE.
Comment[pt_BR]=Um Aplicativo KPart do KDE
Comment[it]=Applicazione KPart di KDE
.lsm files:
Begin3
Title: sourcehighlightide -- Some description
Version: 0.1
Entered-date:
Description:
Keywords: KDE Qt
Author: Lorenzo Bettini <http://www.lorenzobettini.it>
Maintained-by: Lorenzo Bettini <http://www.lorenzobettini.it>
Home-page:
Alternate-site:
Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils
xxxxxx sourcehighlightide-0.1.tar.gz
xxx sourcehighlightide-0.1.lsm
Platform: Linux. Needs KDE
Copying-policy: GPL
End
.rpm spec files:
#
# spec file for package GNU Source Highlight (Version 1.x)
#
# Author: Christian W. Zuckschwerdt, Jan 2003
#
Summary: syntax highlighting for source documents
Name: source-highlight
Version: 2.9
Release: 2.9
License: GPL
Group: Utilities/Console
Source: ftp://ftp.gnu.org/gnu/source-highlight/%{name}-%{version}.tar.gz
URL: http://www.gnu.org/software/src-highlite/
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
This program, given a source file, produces a document
with syntax highlighting. Both source languages and output formats
can be specified with a simple syntax and added dynamically. At the
moment this package can handle many programming languages, such as,
e.g., Java, C/C++, Prolog, Perl, Php3, Python, Flex, ChangeLog, etc.
as source languages, and some output formats such, as, e.g., HTML,
XHTML, LaTeX, etc.
%prep
%setup -q
%build
./configure $MYARCH_FLAGS \
--prefix=%{_prefix} \
--mandir=%{_mandir} \
--datadir=%{_datadir}
make
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644, root, root, 755)
%doc README COPYING ChangeLog TODO.txt AUTHORS THANKS
%doc doc/*.html doc/*.css
%attr(755,root,root) %{_prefix}/bin/*
%{_datadir}/%{name}/*
%{_mandir}/man?/*