source@mandoc.bsd.lv
 help / color / Atom feed
* cvsweb: Delete GNU Enscript support.
@ 2019-11-11 14:56 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-11-11 14:56 UTC (permalink / raw)
  To: source

Log Message:
-----------
Delete GNU Enscript support.  I don't need and i don't want syntax
highlighting, so i'm certainly not going to maintain it.

Modified Files:
--------------
    cvsweb:
        INSTALL
        README
        cvsweb.cgi

Revision Data
-------------
Index: cvsweb.cgi
===================================================================
RCS file: /home/cvs/mandoc/cvsweb/cvsweb.cgi,v
retrieving revision 4.18
retrieving revision 4.19
diff -Lcvsweb.cgi -Lcvsweb.cgi -u -p -r4.18 -r4.19
--- cvsweb.cgi
+++ cvsweb.cgi
@@ -83,7 +83,6 @@ use vars qw (
   $allow_tar @tar_options @gzip_options @zip_options @cvs_options
   @annotate_options @rcsdiff_options
   $HTML_DOCTYPE $HTML_META $cssurl $CSS $cvshistory_url
-  $allow_enscript @enscript_options %enscript_types
 );
 
 require Compress::Zlib;
@@ -150,14 +149,12 @@ sub config_error($$);
 sub redirect($;$);
 sub safeglob($);
 sub search_path($);
-sub getEnscriptHL($);
 sub getMimeType($;$);
 sub head($;$);
 sub scan_directives(@);
 sub openOutputFilter();
 sub doAnnotate($$);
 sub doCheckout($$$);
-sub doEnscript($$$;$);
 sub cvswebMarkup($$$$$$;$);
 sub viewable($);
 sub doDiff($$$$$$);
@@ -534,27 +531,6 @@ foreach (@stickyvars) {
   }
 }
 
-if ($allow_enscript) {
-  push(@DIFFTYPES, qw(uc cc));
-  @DIFFTYPES{qw(uc cc)} = (
-    {
-     'descr'   => 'unified, colored',
-     'opts'    => ['-u'],
-     'colored' => 0,
-    },
-    {
-     'descr'   => 'context, colored',
-     'opts'    => ['-c'],
-     'colored' => 0,
-    },
-  );
-} else {
-  # No Enscript -> respect difftype, but don't offer colorization.
-  if ($input{f} && $input{f} =~ /^([ucs])c$/) {
-    $input{f} = $1;
-  }
-}
-
 # is there any query ?
 if (@barequery) {
   $barequery = join (';', @barequery);
@@ -1688,21 +1664,6 @@ sub search_path($)
 
 
 #
-# Gets the enscript(1) highlight mode corresponding to the given filename,
-# or undef if unsupported.
-#
-sub getEnscriptHL($)
-{
-  return undef unless $allow_enscript;
-  my ($filename) = @_;
-  while (my ($hl, $regex) = each %enscript_types) {
-    return $hl if ($filename =~ $regex);
-  }
-  return undef;
-}
-
-
-#
 # Gets the MIME type for the given file name.
 #
 sub getMimeType($;$)
@@ -2130,14 +2091,8 @@ EOF
     printf '<embed src="%s" width="100%%" height="100%%" /><br />',
       $url . $barequery;
   } else {
-
     print "<pre>\n";
     my $linenumbers = $input{ln} || 0;
-
-    if (my $enscript_hl = getEnscriptHL($filename)) {
-      doEnscript($filehandle, $enscript_hl, $linenumbers);
-
-    } else {
       my $ln  = 0;
       my @buf = ();
       my $ts  = undef;
@@ -2157,8 +2112,6 @@ EOF
         }
         print $preformat_in_markup ? spacedHtmlText($_, $ts) : htmlquote($_);
       }
-    }
-
     print "</pre>\n";
   }
   html_footer();
@@ -2301,36 +2254,6 @@ sub doDiff($$$$$$)
     html_footer();
     gzipclose();
     exit;
-
-  } elsif ($f =~ /^([ucs])c$/) {
-    #
-    # Enscript colored diff.
-    #
-    my $hl = 'diff';
-    $hl .= $1 if ($1 eq 'u' || $1 eq 's');
-    (my $where_nd = $where)       =~ s/\.diff$//;
-    (my $pathname = $where_nd)    =~ s|((?<=/)Attic/)?[^/]*$||;
-    (my $filename = $where_nd)    =~ s|^.*/||;
-    (my $swhere   = $scriptwhere) =~ s|\.diff$||;
-    navigateHeader($swhere, $pathname, $filename, $rev2, 'diff');
-    printf(<<EOF, $where_nd, $rev1, $rev2);
-<h3 style="text-align: center">Diff for /%s between versions %s and %s</h3>
-<pre>
-EOF
-    doEnscript(\$fh, $hl, 0, 'cvsweb_diff');
-    print <<EOF;
-</pre>
-<hr style="width: 100%" />
-<form method="get" action="$scriptwhere">
-EOF
-    printDiffSelectStickyVars();
-    print 'Diff format: ';
-    printDiffSelect();
-    print "<input type=\"submit\" value=\"Show\" />\n</form>\n";
-    html_footer();
-    gzipclose();
-    exit;
-
   } else {
     #
     # Plain diff.
@@ -3450,36 +3373,6 @@ EOF
 </form>
 <br clear="all" />
 EOF
-}
-
-
-sub doEnscript($$$;$)
-{
-  my ($filehandle, $highlight, $linenumbers, $lang) = @_;
-  $lang ||= 'cvsweb';
-
-  my @cmd = ($CMD{enscript},
-             @enscript_options,
-             '-q', "--language=$lang", '-o', '-', "--highlight=$highlight");
-
-  local *ENSCRIPT_OUT;
-  my ($h, $err) =
-    startproc(\@cmd, $filehandle, '>pipe', \*ENSCRIPT_OUT);
-  fatal('500 Internal Error', $err) unless $h;
-
-  # We could short-circuit and have enscript output directly to STDOUT above,
-  # but that doesn't work with mod_perl (at least some 1.99 versions).
-  if ($linenumbers) {
-    my $ln = 0;
-    while (<ENSCRIPT_OUT>) {
-      printf '<a id="l%d" class="src">%5d: </a>', (++$ln) x 2;
-      print $_;
-    }
-  } else {
-    local $/ = undef;
-    print <ENSCRIPT_OUT>;
-  }
-  $h->finish();
 }
 
 
Index: INSTALL
===================================================================
RCS file: /home/cvs/mandoc/cvsweb/INSTALL,v
retrieving revision 4.5
retrieving revision 4.6
diff -LINSTALL -LINSTALL -u -p -r4.5 -r4.6
--- INSTALL
+++ INSTALL
@@ -39,9 +39,6 @@ of this document.
    repository (or a copy of it) therefore; rsh, ssh or pserver access
    doesn't work yet.
 
-   Install GNU Enscript if you want syntax highlighting, and see (7) for
-   more info.  You'll need version 1.6.3 or newer.
-
    Install CVSHistory if you want to use it with CVSweb, and see (8) for
    configuration notes.  You'll need version 2.0 or newer.
 
@@ -75,13 +72,6 @@ of this document.
 5) Copy cvsweb.css from the css/ directory to a web server directory, and
    point the $cssurl variable in cvsweb.conf to it.
 
-7) GNU Enscript <http://www.iki.fi/~mtr/genscript/> can be used for syntax
-   highlighting.  To enable it, copy lang_cvsweb.st and lang_cvsweb_diff.st
-   from the enscript/ dir to your Enscript "hl" directory (often eg.
-   /usr/share/enscript/hl/) and enable $allow_enscript in cvsweb.conf.
-   lang_cvsweb.st is used for generic colorization, and lang_cvsweb_diff.st
-   for diffs.
-
 8) CVSHistory <http://www.jamwt.com/CVSHistory/> can be used with this
    version of CVSweb.  See the $cvshistory_url configuration variable in
    cvsweb.conf.  For best results, configure CVSweb and CVSHistory to use
@@ -183,10 +173,6 @@ The following configuration variables in
    $cvstreedefault is now optional.  If unset, the first one in
    @CVSrepositories is used.
 
-   %DEFAULTVALUE for "f" (default diff format) now understands the values
-   "uc", "cc" and "sc" for enscript-colored diffs (unified, context and
-   side-by-side respectively).
-
    %DEFAULTVALUE for "ln" can now be set to a boolean indicating whether
    line numbers in markup views should be shown or not.  The default is off.
 
@@ -200,9 +186,6 @@ The following configuration variables in
    The following parameters have been removed, with no replacement:
    $open_extern_window, $extern_window_height, $extern_window_width,
    $checkout_magic.
-
-   $allow_enscript, @enscript_options and %enscript_types control the use
-   and behavior of enscript(1).
 
    $file_list_len can be set to work around problems with rlog(1) and dirs
    with lots of files.
Index: README
===================================================================
RCS file: /home/cvs/mandoc/cvsweb/README,v
retrieving revision 4.5
retrieving revision 4.6
diff -LREADME -LREADME -u -p -r4.5 -r4.6
--- README
+++ README
@@ -87,8 +87,6 @@ o Security fixes to let it work under pe
 
 o Annotate works under mod_perl and against a read only repository.
 
-o Syntax highlighting using GNU Enscript <http://www.iki.fi/~mtr/genscript/>.
-
 o CVSHistory <http://www.jamwt.com/CVSHistory/> integration.
 
 o Line number output for HTMLized views.
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 14:56 cvsweb: Delete GNU Enscript support schwarze

source@mandoc.bsd.lv

Archives are clonable: git clone --mirror http://inbox.vuxu.org/mandoc-source

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git