[openssl-commits] [web] master update
Richard Levitte
levitte at openssl.org
Thu Jun 14 09:57:02 UTC 2018
The branch master has been updated
via 59e4ff330c6ff27e71c040f65d2918f4fb5c0692 (commit)
via 6e56f7d522fa01f454e88a2ffd9c1df4527dad16 (commit)
from 574a269efd409a480d1eef665dddb7362156d70a (commit)
- Log -----------------------------------------------------------------
commit 59e4ff330c6ff27e71c040f65d2918f4fb5c0692
Author: Richard Levitte <levitte at openssl.org>
Date: Thu Jun 14 10:02:01 2018 +0200
OMC generation: account for titles when sorting names
This moves the process of making names sortable to a separate function.
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/61)
commit 6e56f7d522fa01f454e88a2ffd9c1df4527dad16
Author: Richard Levitte <levitte at openssl.org>
Date: Thu Jun 14 10:01:10 2018 +0200
OMC generation: Make sure non-ASCII characters are made into entities
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/61)
-----------------------------------------------------------------------
Summary of changes:
bin/mk-omc | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/bin/mk-omc b/bin/mk-omc
index 5832710..e6dee11 100755
--- a/bin/mk-omc
+++ b/bin/mk-omc
@@ -6,6 +6,7 @@ use warnings;
use Getopt::Long;
use Pod::Usage;
use OpenSSL::Query::REST;
+use HTML::Entities;
my %options = ();
GetOptions(
@@ -55,14 +56,7 @@ print join(" <th> </th>\n",
map { " <th>$_</th>\n" } @columns);
print " </tr>\n";
-foreach my $key (sort { my $sortablename_a =
- ($a =~ m|^(\S+(?:\s\S\.)?)\s+(.*)$|,
- "$2, $1");
- my $sortablename_b =
- ($b =~ m|^(\S+(?:\s\S\.)?)\s+(.*)$|,
- "$2, $1");
- $sortablename_a cmp $sortablename_b }
- keys %data) {
+foreach my $key (sort { mk_sortable($a) cmp mk_sortable($b) } keys %data) {
my $pgpurl = $data{$key}->{pgpid} if $options{pgp};
$pgpurl =~ s|\s+||g if $pgpurl;
$pgpurl =
@@ -73,7 +67,7 @@ foreach my $key (sort { my $sortablename_a =
push @columndata,
join('',
$data{$key}->{active} ? "" : "<i>",
- "$key",
+ encode_entities($key),
$data{$key}->{active} ? "" : "</i> (I)",
$data{$key}->{emeritus} ? " (OMC Emeritus)" : "")
if $options{name};
@@ -93,3 +87,18 @@ foreach my $key (sort { my $sortablename_a =
}
print "</table>\n";
+
+sub mk_sortable {
+ my $name = shift;
+
+ # Peel off any title
+ $name =~ s/(Dr|Mr|Mrs|Miss)\.?\s+//;
+
+ # Split into first+middle name and last names and flip them over with
+ # a comma between.
+ # We work with the assumption that the middle name, if included, is
+ # given as a single letter followed by a possible period.
+ $name = ($name =~ m|^(\S+(?:\s\S\.?)?)\s+(.*)$|, "$2, $1");
+
+ return $name;
+}
More information about the openssl-commits
mailing list