chiark / gitweb /
Allow initials-based abbrevations for ship names
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Thu, 10 Sep 2009 00:58:12 +0000 (01:58 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Thu, 10 Sep 2009 00:58:12 +0000 (01:58 +0100)
yarrg/web/check_capacitystring
yarrg/web/docs
yarrg/web/qtextstringcheck

index f001c790f6963201f6e83f4889af22141fa714e6..13403b19505bc9ae366c99b5f7a952280397cbb1 100644 (file)
@@ -35,6 +35,7 @@
 
 <%attr>
 maxambig => 2
+abbrev_initials => 1
 </%attr>
 
 <%method preparse>
index 48a0062f70c6953d8744e5981ce5807875966a9d..fc1bd0f712a154c2f325b502951f382b38a3a4c4 100755 (executable)
@@ -115,8 +115,8 @@ like:
 <dl>
 <dt>sloop
 <dd>The capacity of a sloop, leaving no allowance for rum and shot
-<dt>sloop - 1%
-<dd>The capacity of a sloop minus 1%
+<dt>wb - 1%
+<dd>The capacity of a war brig minus 1%
 <dt>20t 13kl
 <dd>13 tonnes (13,000kg), 20 kilolitres (20,000l)
 <dt>sloop - 100l 100kg
index a489d8e1232940e6c603c44e05f43eed3add47b9..686a506aa4c348bfefbc2b0f73fd2e160785937a 100755 (executable)
@@ -94,7 +94,11 @@ foreach my $each (@specs) {
        my $err= sub { $emsg= $_[0]; last; };
        my %m;
        my $results;
-       foreach my $pat ("$each", "$each\%", "\%$each\%") {
+       my @pats= ("$each", "$each\%", "\%$each\%");
+       if ($chk->attr_exists('abbrev_initials')) {
+               push @pats, join ' ', map { "$_%" } split //, $each;
+       }
+       foreach my $pat (@pats) {
                $sth->execute(($pat) x @sqlstmt_qs);
                $results= $sth->fetchall_arrayref();
                last if @$results==1;