Bug report and suggestion for syntax highlighting script!

Kaz Kylheku kaz at kylheku.com
Sun Oct 30 21:29:59 CET 2011


Hi CGIT guys,

Firstly, I'm finding that this script is working very well for me.
I switched to using the GNU source-highlighting syntax highlighting
program, except for things that it does not handle.

This program can highlight ChangeLogs, lex and yacc, but
the one thing it doesn't do is Makefiles.

Here is what the meat of my script looks like:

Note that since source-highlight fails if it does not
recognize a language, I do not exec it! There are other
ways to solve that. Too bad the shell doesn't support this:

  exec ( command || command )

I.e. exec a subshell pipeline. Doh!


BASENAME="$1"

case "$BASENAME" in
configure )
  LANGUAGE=sh
  ;;
Makefile | makefile | MAKEFILE )
  LANGUAGE=mk
  ;;
ChangeLog | CHANGELOG | changelog )
  LANGUAGE=changelog
  ;;
* )
  LANGUAGE="${BASENAME##*.}"
  ;;
esac

source-highlight --src-lang=$LANGUAGE || \
  exec highlight --force -f -I -X -S $LANGUAGE 2>/dev/null



Now for the bug (feature?) report.  On the main view, tags are
turned into download links. Tag FOO becomes FOO.tar.gz, etc.  This is 
great!

But if you click on a TAG, then you are taken to a page where some 
different
links are given, like project-TAG.tar.gz.

E.g. take a look at http://webserver/cgit/cgit.cgi/txr/tag/?id=txr-041

Here, we are given the opportunity to download "txr-txr-041.tar.gz".
But on the main page for this repo, it is "txr-041.tar.gz".

In fact I've been using the project name in the tag name precisely to 
get
these download links to work out that way in CGIT! Now I discover
there is a "hidden" feature whereby CGIT does tack on the repo name.

:)

Cheers ...





More information about the CGit mailing list