Fix local anchor bug.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11767 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-12-15 10:03:24 +00:00
parent fd8458bb9f
commit e1f2019563

View file

@ -150,17 +150,18 @@ static NSMutableSet *textNodes = nil;
{ {
NSString *s; NSString *s;
NSString *kind = (f == YES) ? @"href" : @"name"; NSString *kind = (f == YES) ? @"href" : @"name";
NSString *hash = (f == YES) ? @"#" : @"";
if (f == NO || (s = [localRefs globalRef: r type: t]) != nil) if (f == NO || (s = [localRefs globalRef: r type: t]) != nil)
{ {
s = [NSString stringWithFormat: @"<a %@=\"#%@$%@\">", s = [NSString stringWithFormat: @"<a %@=\"%@%@$%@\">",
kind, t, r]; kind, hash, t, r];
} }
else if ((s = [globalRefs globalRef: r type: t]) != nil) else if ((s = [globalRefs globalRef: r type: t]) != nil)
{ {
s = [s stringByAppendingPathExtension: @"html"]; s = [s stringByAppendingPathExtension: @"html"];
s = [NSString stringWithFormat: @"<a %@=\"%@#%@$%@\">", s = [NSString stringWithFormat: @"<a %@=\"%@%@%@$%@\">",
kind, s, t, r]; kind, s, hash, t, r];
} }
return s; return s;
} }
@ -183,6 +184,7 @@ static NSMutableSet *textNodes = nil;
NSString *s = nil; NSString *s = nil;
BOOL isLocal = YES; BOOL isLocal = YES;
NSString *kind = (f == YES) ? @"href" : @"name"; NSString *kind = (f == YES) ? @"href" : @"name";
NSString *hash = (f == YES) ? @"#" : @"";
/* /*
* No unit specified ... try to infer it. * No unit specified ... try to infer it.
@ -255,14 +257,14 @@ static NSMutableSet *textNodes = nil;
{ {
if (isLocal == YES) if (isLocal == YES)
{ {
s = [NSString stringWithFormat: @"<a %@=\"#%@%@\">", s = [NSString stringWithFormat: @"<a %@=\"%@%@%@\">",
kind, u, r]; kind, hash, u, r];
} }
else else
{ {
s = [s stringByAppendingPathExtension: @"html"]; s = [s stringByAppendingPathExtension: @"html"];
s = [NSString stringWithFormat: @"<a %@=\"%@#%@%@\">", s = [NSString stringWithFormat: @"<a %@=\"%@%@%@%@\">",
kind, s, u, r]; kind, s, hash, u, r];
} }
} }
return s; return s;