From owner-svn-doc-all@freebsd.org Sun Jul 22 13:06:10 2018 Return-Path: Delivered-To: svn-doc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37AB3104B5A0; Sun, 22 Jul 2018 13:06:10 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD0AF74968; Sun, 22 Jul 2018 13:06:09 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFA1D65C6; Sun, 22 Jul 2018 13:06:09 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6MD69ds038191; Sun, 22 Jul 2018 13:06:09 GMT (envelope-from wosch@FreeBSD.org) Received: (from wosch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6MD693K038190; Sun, 22 Jul 2018 13:06:09 GMT (envelope-from wosch@FreeBSD.org) Message-Id: <201807221306.w6MD693K038190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wosch set sender to wosch@FreeBSD.org using -f From: Wolfram Schneider Date: Sun, 22 Jul 2018 13:06:09 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r52042 - head/en_US.ISO8859-1/htdocs/cgi X-SVN-Group: doc-head X-SVN-Commit-Author: wosch X-SVN-Commit-Paths: head/en_US.ISO8859-1/htdocs/cgi X-SVN-Commit-Revision: 52042 X-SVN-Commit-Repository: doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire doc trees \(except for " user" , " projects" , and " translations" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2018 13:06:10 -0000 Author: wosch Date: Sun Jul 22 13:06:09 2018 New Revision: 52042 URL: https://svnweb.freebsd.org/changeset/doc/52042 Log: Improve sort order of manpage releases: - first sort by OS and release number, highest/latest version first. - put FreeBSD releases on top Modified: head/en_US.ISO8859-1/htdocs/cgi/man.cgi Modified: head/en_US.ISO8859-1/htdocs/cgi/man.cgi ============================================================================== --- head/en_US.ISO8859-1/htdocs/cgi/man.cgi Sun Jul 22 04:32:48 2018 (r52041) +++ head/en_US.ISO8859-1/htdocs/cgi/man.cgi Sun Jul 22 13:06:09 2018 (r52042) @@ -859,51 +859,48 @@ while ( ( $key, $val ) = each %manPath ) { ); # -# sort by OS release number +# sort by OS release number, highest version first # # e.g.: # -# XFree86 2.1 -# XFree86 3.3 -# XFree86 3.3.6 # XFree86 4.0 +# XFree86 3.3.6 +# XFree86 3.3 +# XFree86 2.1 # ... -# XFree86 10.0 -# XFree86 10.0.1 # XFree86 11 +# XFree86 10.0.1 +# XFree86 10.0 # sub sort_versions { - my @a = ( lc($a) =~ /(\d+|\D+)/g ); - my @b = ( lc($b) =~ /(\d+|\D+)/g ); - my $flag = 0; - while ( @a and @b ) { - my $a1 = shift @a; - my $b1 = shift @b; + # FreeBSD 11.1-RELEASE ports + my @a = ( lc($a) =~ m,^(\D+)([\d\.]+)(\D*)$, ); + my @b = ( lc($b) =~ m,^(\D+)([\d\.]+)(\D*)$, ); - # sort numerically if possible - if ( $a1 =~ /^\d+$/ && $b1 =~ /^\d+$/ ) { - return $a1 <=> $b1 if $a1 <=> $b1; - $flag++; - } + if (@a and @b) { + return $a[0] cmp $b[0] || (-1 * ($a[1] <=> $b[1])) || $a[2] cmp $a[2] || $a cmp $b; + } - # sort by characters - else { + # 2.9.1 BSD + @a = ( lc($a) =~ m,^(\d\.+)(.*)$, ); + @b = ( lc($b) =~ m,^(\d\.+)(.*)$, ); + if (@a and @b) { + return (-1 * ( $a[0] <=> $b[0])) || $a[1] <=> $b[1] || $a cmp $b; + } - # minor number and characters - # 4.1 RELEASE <=> 4.1.1 RELEASE - if ( $flag && ( $a1 =~ /^\d+$/ || $b1 =~ /^\d+$/ ) ) { - return $a1 =~ /^\d+$/ ? 1 : -1; - } + # rest + return $a cmp $b; +} - # characters only - return $a1 cmp $b1 if $a1 cmp $b1; - $flag = 0; - } - } +# FreeBSD manual pages first before any other manual pages +sub freebsd_first { + my @list = @_; + my @data; + push @data, grep { /^FreeBSD/ } @list; + push @data, grep { !/^FreeBSD/ } @list; - # longest version string wins - return @a <=> @b; + return @data; } foreach ( sort { &sort_versions } keys %manPathAliases ) { @@ -1758,7 +1755,7 @@ ETX print qq{\n