From: Ian Jackson Date: Thu, 10 Sep 2009 00:58:12 +0000 (+0100) Subject: Allow initials-based abbrevations for ship names X-Git-Tag: 5.0^2~148 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=commitdiff_plain;h=d7465beff921821bf120a25a30a35ef06bddfc0e Allow initials-based abbrevations for ship names --- diff --git a/yarrg/web/check_capacitystring b/yarrg/web/check_capacitystring index f001c79..13403b1 100644 --- a/yarrg/web/check_capacitystring +++ b/yarrg/web/check_capacitystring @@ -35,6 +35,7 @@ <%attr> maxambig => 2 +abbrev_initials => 1 <%method preparse> diff --git a/yarrg/web/docs b/yarrg/web/docs index 48a0062..fc1bd0f 100755 --- a/yarrg/web/docs +++ b/yarrg/web/docs @@ -115,8 +115,8 @@ like:
sloop
The capacity of a sloop, leaving no allowance for rum and shot -
sloop - 1% -
The capacity of a sloop minus 1% +
wb - 1% +
The capacity of a war brig minus 1%
20t 13kl
13 tonnes (13,000kg), 20 kilolitres (20,000l)
sloop - 100l 100kg diff --git a/yarrg/web/qtextstringcheck b/yarrg/web/qtextstringcheck index a489d8e..686a506 100755 --- a/yarrg/web/qtextstringcheck +++ b/yarrg/web/qtextstringcheck @@ -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;