Hi Folks I'm trying to implement Perl syntax highlighting within cgit, after reading this fascinating post: http://www.cantrell.org.uk/david/journal/index.pl/id_cgit-syntax-highlighting. But the highlighter is not being called. Code is displayed as plain text, without e.g. line numbers. He's my cgitrc:
virtual-root=/cgit cache-root=/tmp/cgit/cache cache-size=1021 snapshots=tar.gz tar.bz zip enable-log-filecount=1 enable-log-linecount=1 summary-log=5 summary-branches=5 summary-tags=5 css=/cgit/cgit.css logo=/cgit/cgit.png max-repo-count=100 source-filter=/home/ron/bin/perl.hiliter.pl repo.url=Acute-ProcessPostScript repo.path=/home/ron/perl.modules/Acute-ProcessPostScript/.git repo.desc=Acute::ProcessPostScript # All following lines are 3 per module, as above.
Here's the hiliter (perl.hiliter.pl):
#!/usr/bin/perl use warnings; use strict; # --------- my $file = shift; if($file =~ /\.(p[ml]|t)$/i) { system "/usr/local/bin/perltidy -html -st -ntoc -npod -pre -nssc - +nnn" } else { system "cat -n"; }
David's code has -nss but perltidy, v20090616 only has ssc, so I assume that's what he meant. This option has no effect on my lack of highlighting. perl.hiliter.pl is executable:
507 ron@zephyr:~/httpd/prefork$ dir /home/ron/bin/perl.hiliter.pl -rwxr-xr-x 1 ron ron 207 2009-10-15 09:36 /home/ron/bin/perl.hiliter.p +l*
Changing it's permissions to 777 had no effect. I'm running cgit.cgi from Apache's cgi-bin/ dir. TIA. Ron

In reply to Need help with syntax highlighting within cgit by ron.savage

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.