chiark / gitweb /
Show canonical strings in printable form
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 22 Nov 2009 13:49:19 +0000 (13:49 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 22 Nov 2009 13:52:00 +0000 (13:52 +0000)
yarrg/web/check_lossperleague
yarrg/web/qtextstring

index a37382e3a48aec5f61ae86eb2562d7c7647f50e4..3198d41df3bec1b2ca72a388e4105daed72615c2 100644 (file)
@@ -46,7 +46,7 @@ s/^\s+//; s/\s+$//;
 my ($pct,$str);
 
 if (!m/\S/) {
-       $str= '';
+       return ('[no losses]', undef);
 } elsif (m/^(\d{1,2}(?:\.\d{0,5})?)\%$/) {
        $pct= $1 * 1.0;
        $str= sprintf("%g%%", $1);
@@ -57,7 +57,7 @@ if (!m/\S/) {
        expected_error("Cannot understand loss per league ".escerrq($_).".");
 }
 
-return ("$str per league", $pct);
+return ("$str [per league]", $pct);
 
 </%perl>
 </%method>
index ebf344d0dc7d7eb47fd5b1859a726409ebd43568..6872e7ecdd449c353a6828dd5807462d62f7808f 100644 (file)
@@ -100,24 +100,12 @@ function <%$p%>Ready() {
 register_onload(<%$p%>Needed);
 </&script>
 
-% if (!printable($m)) {
-<input type="text" <% $boxopts %>
- id="<% $thingstring %>" name="<% $thingstring %>"
- onchange="<%$p%>Needed();" onkeyup="<%$p%>Later();"
- value="<% $stringval |h %>"
- ><% defined($helpref) ? "<a href=\"docs#$helpref\">[?]</a>" : '' %><%
-     $m->content %>
-<br>
-<div id="<%$p%>results">&nbsp;</div><br>
-% } else {
-<kbd><strong><% $stringval |h %></strong></kbd>
-<br>
-<br>
-% }
-
 <%perl>
+my ($canonstring);
+
 if ($significant_nonempty || length $thingstring) {
-       my ($emsg,$canonstring,@results)= $m->comp('qtextstringcheck',
+       my ($emsg,@results);
+       ($emsg,$canonstring,@results)= $m->comp('qtextstringcheck',
                what => $checkkind,
                ocean => $qa->{Ocean},
                string => $stringval,
@@ -130,3 +118,18 @@ if ($significant_nonempty || length $thingstring) {
        $onresults->(@results);
 }
 </%perl>
+
+% if (!printable($m)) {
+<input type="text" <% $boxopts %>
+ id="<% $thingstring %>" name="<% $thingstring %>"
+ onchange="<%$p%>Needed();" onkeyup="<%$p%>Later();"
+ value="<% $stringval |h %>"
+ ><% defined($helpref) ? "<a href=\"docs#$helpref\">[?]</a>" : '' %><%
+     $m->content %>
+<br>
+<div id="<%$p%>results">&nbsp;</div><br>
+% } else {
+<kbd><strong><% $canonstring |h %></strong></kbd>
+<br>
+<br>
+% }