return attach_link($upfx, $ct, $p, $fn) unless defined $s;
my ($diff, $spfx);
- if ($ibx->{-repo_objs} && $s =~ /^(?:diff|---|\+{3}) /ms) {
+ if ($s =~ /^(?:diff|---|\+{3}) /ms) {
$diff = [];
- my $n_slash = $upfx =~ tr!/!/!;
- if ($n_slash == 0) {
- $spfx = '../';
- } elsif ($n_slash == 1) {
- $spfx = '';
- } else { # nslash == 2
- $spfx = '../../';
+ if ($ibx->{-repo_objs}) {
+ my $n_slash = $upfx =~ tr!/!/!;
+ if ($n_slash == 0) {
+ $spfx = '../';
+ } elsif ($n_slash == 1) {
+ $spfx = '';
+ } else { # nslash == 2
+ $spfx = '../../';
+ }
}
};
my $oid_a = $dctx->{oid_a};
my $oid_b = $dctx->{oid_b};
- (defined($oid_a) && defined($oid_b)) or return "@@ $ca $cb @@";
+ (defined($spfx) && defined($oid_a) && defined($oid_b)) or
+ return "@@ $ca $cb @@";
my ($n) = ($ca =~ /^-(\d+)/);
$n = defined($n) ? do { ++$n; "#n$n" } : '';
$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;
+}
+
sub flush_diff ($$$$) {
my ($dst, $spfx, $linkify, $diff) = @_;
my $state = DSTATE_INIT;
}
$$dst .= to_html($linkify, $s);
} elsif ($s =~ s/^(index $OID_NULL\.\.)($OID_BLOB)\b//o) {
- $$dst .= qq($1<a\nhref=$spfx$2/s/$dctx->{Q}>$2</a>);
+ $$dst .= $1 . oid($dctx, $spfx, $2);
$$dst .= to_html($linkify, $s) ;
} elsif ($s =~ s/^index ($OID_NULL)(\.\.$OID_BLOB)\b//o) {
- $$dst .= 'index ';
- $$dst .= qq(<a\nhref=$spfx$1/s/$dctx->{Q}>$1</a>$2);
+ $$dst .= 'index ' . oid($dctx, $spfx, $1) . $2;
$$dst .= to_html($linkify, $s);
} elsif ($s =~ /^index ($OID_BLOB)\.\.($OID_BLOB)/o) {
$dctx->{oid_a} = $1;