chiark / gitweb /
AJAX route validator improved
[ypp-sc-tools.db-live.git] / yarrg / web / routetextstring
index 0e4ae6eaf2b37d5786c05800ab1497dd7d1c6302..b84fd8447708e70b4b463ab10fdf2719545cc1d0 100644 (file)
@@ -6,6 +6,10 @@ $string
 </%args>
 <%perl>
 
+# typical url for this script:
+#  http://www.chiark.greenend.org.uk/ucgi/~clareb/mason/pirates/routetextstring?format=json&ocean=Midnight&string=d
+
+
 use CommodsWeb;
 use HTML::Entities;
 use JSON;
@@ -29,7 +33,7 @@ if ($format =~ 'json') {
        })};
        $output_wrong= sub { print to_json({
                success => 0,
-               show => encode_entities($_[0]),
+               show => $_[0],
        })};
 }              
 
@@ -47,7 +51,7 @@ foreach my $each (split m#[/|,]#, $string) {
        if (!@$results) {
                $err->('no island or arch matches "%s"');
        } elsif (@$results > 3) {
-               $err->('');
+               $err->('&nbsp;');
        } elsif (@$results > 1) {
                my @m= map { $_->[2] } @$results;
                $err->('ambiguous island or arch "%s", could be '.