/usr/bin/gfs-highlight is in gerris 20110329-dfsg.2-1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | #!/bin/sh
wiki="http:\/\/gfs.sf.net\/wiki\/index.php"
title=""
css="darcs.css"
path="/usr/share/gerris"
usage()
{
cat <<EOF
Usage: gfs-highlight [OPTIONS] < input.gfs > output.html
Syntax highlighting/hypertext linking of Gerris simulation files.
Options:
[--title=TITLE] sets the page title
[--css=FILE] sets the CSS stylesheet filename
[--comments] include comment block at the start
[--bold] use bold instead of links
[--help] displays this message and exits
EOF
exit $1
}
comment=0
bold=0
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--title=*)
title=$optarg
;;
--css=*)
css=$optarg
;;
--comment)
comment=1
;;
--bold)
bold=1
;;
--help)
usage 0 1>&2
;;
*)
usage 0 1>&2
;;
esac
shift
done
if test "x$title" = "x"; then :
cat <<EOF
<tt class="gfs">
EOF
else
cat <<EOF
<html>
<head>
<title>$title</title>
<link rel="stylesheet" type="text/css" href="$css">
</head>
<body><tt class="gfs">
EOF
fi
file=`mktemp gfs-highlight.XXXXXX`
ln -s -f $path/gfs.lang $file
awk -v comment=$comment 'BEGIN{ infile=comment } {
if ($2 == "Generated" && $3 == "files:") {
infile = 1;
while ($1 == "#") getline;
print $0;
}
else if (infile)
print $0;
else if ($5 == "GfsGEdge") {
infile = 1;
print $0;
}
}' | \
source-highlight --lang-def=$file --out-format=html-css | \
(
if test $bold = "1"; then
sed "s/\"gfs_keyword\">\(Gfs\)\{0,1\}\([a-zA-Z0-9_]*\)<\/span>/"gfs_keyword"><b>\1\2<\/b><\/span>/g"
else
sed "s/\"gfs_keyword\">\(Gfs\)\{0,1\}\([a-zA-Z0-9_]*\)<\/span>/"gfs_keyword"><a href=\"$wiki\/Gfs\2\">\1\2<\/a><\/span>/g"
fi
)
rm -f $file
if test "x$title" = "x"; then :
cat <<EOF
</tt>
EOF
else
cat <<EOF
</tt></body>
</html>
EOF
fi
|