countries: indicate code references in description
[sheet.git] / source.plp
index 2ac48336fec79d3aa1d2c87e673da53188c56734..7b0ebec82552e55bb6a09bef911ea6c50c6cff0d 100644 (file)
@@ -5,6 +5,7 @@ $source =~ s{^/}{};
 
 if ($source =~ s{(?<=\Q.inc.pl\E)/jsonp?$}{} and -r $source) {
        # convert perl include to json construct
+       checkmodified($source);
        eval {
                my $data = do $source or die $@ || $! || 'read error';
                require JSON;
@@ -67,6 +68,7 @@ else {
        }
        -r $source or die "Requested file not found\n";
 
+       require Encode;
        if (eval { require Text::VimColor and Text::VimColor->VERSION(0.12) }) {
                delete $Text::VimColor::SYNTAX_TYPE{Underlined};
                my %TYPETAG = (
@@ -92,13 +94,12 @@ else {
                        if (!$_->[0] and $_->[1] =~ s/^(\s*)([A-Z]\w+(?:::\w+)+)(?![^;\s])//) {
                                printf '%s<a href="%s">%s</a>', $1, "/source/$2", $2;
                        }
-                       print Text::VimColor::_xml_escape($_->[1]);
+                       print Text::VimColor::_xml_escape(Encode::decode_utf8($_->[1]));
                        print "</$tag>" if $tag;
                }
                print "</pre>\n";
        }
        else {
-               require Encode;
                print "<pre>\n";
                print EscapeHTML(Encode::decode_utf8(ReadFile($source)));
                print "</pre>\n";