]> Sergey Matveev's repositories - public-inbox.git/commitdiff
viewdiff: quote attributes for Atom feed
authorEric Wong <e@80x24.org>
Sun, 20 Jan 2019 10:57:13 +0000 (10:57 +0000)
committerEric Wong <e@80x24.org>
Sun, 20 Jan 2019 11:43:19 +0000 (11:43 +0000)
We still need to use XHTML the Atom feed, and XHTML requires
attributes to be quoted, whereas HTML 5 does not.

lib/PublicInbox/ViewDiff.pm

index 1fa18459425533893f3b725ed64c8a0b7f3d89e4..45d28e37792146cbdfd2d4e3c3e93e92241a251c 100644 (file)
@@ -54,17 +54,17 @@ sub diff_hunk ($$$$) {
        my ($n) = ($ca =~ /^-(\d+)/);
        $n = defined($n) ? do { ++$n; "#n$n" } : '';
 
-       my $rv = qq(@@ <a\nhref=$spfx$oid_a/s/$dctx->{Q}$n>$ca</a>);
+       my $rv = qq(@@ <a\nhref="$spfx$oid_a/s/$dctx->{Q}$n">$ca</a>);
 
        ($n) = ($cb =~ /^\+(\d+)/);
        $n = defined($n) ? do { ++$n; "#n$n" } : '';
 
-       $rv .= qq( <a\nhref=$spfx$oid_b/s/$dctx->{Q}$n>$cb</a> @@);
+       $rv .= qq( <a\nhref="$spfx$oid_b/s/$dctx->{Q}$n">$cb</a> @@);
 }
 
 sub oid ($$$) {
        my ($dctx, $spfx, $oid) = @_;
-       defined($spfx) ? qq(<a\nhref=$spfx$oid/s/$dctx->{Q}>$oid</a>) : $oid;
+       defined($spfx) ? qq(<a\nhref="$spfx$oid/s/$dctx->{Q}">$oid</a>) : $oid;
 }
 
 sub to_state ($$$) {
@@ -72,7 +72,7 @@ sub to_state ($$$) {
        $$dst .= '</span>' if $state2class[$state];
        $_[1] = $new_state;
        my $class = $state2class[$new_state] or return;
-       $$dst .= "<span\nclass=$class>";
+       $$dst .= qq(<span\nclass="$class">);
 }
 
 sub flush_diff ($$$$) {
@@ -117,7 +117,7 @@ sub flush_diff ($$$$) {
                        $$dst .= to_html($linkify, $s);
                } elsif ($s =~ s/^@@ (\S+) (\S+) @@//) {
                        $$dst .= '</span>' if $state2class[$state];
-                       $$dst .= "<span\nclass=hunk>";
+                       $$dst .= qq(<span\nclass="hunk">);
                        $$dst .= diff_hunk($dctx, $spfx, $1, $2);
                        $$dst .= '</span>';
                        $state = DSTATE_CTX;