chiark / gitweb /
WIP route fixes etc.
[ypp-sc-tools.web-live.git] / yarrg / web / routetextstring
index 0e4ae6eaf2b37d5786c05800ab1497dd7d1c6302..c39d48bde187a9d86600454c4a1456c44a4d61f1 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 '.
@@ -56,7 +60,7 @@ foreach my $each (split m#[/|,]#, $string) {
        push @results, $results->[0];
 }
 
-$canontext= join ' | ', map { encode_entities($_->[2]) } @results;
+$canontext= join ' | ', map { $_->[2] } @results;
 
 $output->();