Tidied to fix failures to meet DTD

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11806 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-12-18 11:29:02 +00:00
parent be1d13c791
commit 92cb1fb37b
3 changed files with 26 additions and 5 deletions

View file

@ -732,7 +732,7 @@ static NSMutableSet *textNodes = nil;
if ([[children name] isEqual: @"copy"] == YES) if ([[children name] isEqual: @"copy"] == YES)
{ {
[buf appendString: indent]; [buf appendString: indent];
[buf appendString: @"<p>Copyright: (C) "]; [buf appendString: @"<p><b>Copyright:</b> (C) "];
[self outputText: [children children] to: buf]; [self outputText: [children children] to: buf];
[buf appendString: @"</p>\n"]; [buf appendString: @"</p>\n"];
children = firstElement([children next]); children = firstElement([children next]);

View file

@ -187,6 +187,7 @@ static BOOL snuggleStart(NSString *t)
NSDictionary *protocols; NSDictionary *protocols;
NSArray *authors; NSArray *authors;
NSString *tmp; NSString *tmp;
unsigned chapters = 0;
info = d; info = d;
@ -338,16 +339,19 @@ static BOOL snuggleStart(NSString *t)
if (tmp != nil) if (tmp != nil)
{ {
[self reformat: tmp withIndent: 4 to: str]; [self reformat: tmp withIndent: 4 to: str];
chapters++;
} }
if ([classes count] > 0) if ([classes count] > 0)
{ {
NSArray *names; NSArray *names;
unsigned i; unsigned i;
unsigned c = [classes count];
chapters += c;
names = [classes allKeys]; names = [classes allKeys];
names = [names sortedArrayUsingSelector: @selector(compare:)]; names = [names sortedArrayUsingSelector: @selector(compare:)];
for (i = 0; i < [names count]; i++) for (i = 0; i < c; i++)
{ {
NSString *name = [names objectAtIndex: i]; NSString *name = [names objectAtIndex: i];
NSDictionary *d = [classes objectForKey: name]; NSDictionary *d = [classes objectForKey: name];
@ -360,10 +364,12 @@ static BOOL snuggleStart(NSString *t)
{ {
NSArray *names; NSArray *names;
unsigned i; unsigned i;
unsigned c = [categories count];
chapters += c;
names = [categories allKeys]; names = [categories allKeys];
names = [names sortedArrayUsingSelector: @selector(compare:)]; names = [names sortedArrayUsingSelector: @selector(compare:)];
for (i = 0; i < [names count]; i++) for (i = 0; i < c; i++)
{ {
NSString *name = [names objectAtIndex: i]; NSString *name = [names objectAtIndex: i];
NSDictionary *d = [categories objectForKey: name]; NSDictionary *d = [categories objectForKey: name];
@ -376,10 +382,12 @@ static BOOL snuggleStart(NSString *t)
{ {
NSArray *names; NSArray *names;
unsigned i; unsigned i;
unsigned c = [protocols count];
chapters += c;
names = [protocols allKeys]; names = [protocols allKeys];
names = [names sortedArrayUsingSelector: @selector(compare:)]; names = [names sortedArrayUsingSelector: @selector(compare:)];
for (i = 0; i < [names count]; i++) for (i = 0; i < c; i++)
{ {
NSString *name = [names objectAtIndex: i]; NSString *name = [names objectAtIndex: i];
NSDictionary *d = [protocols objectForKey: name]; NSDictionary *d = [protocols objectForKey: name];
@ -388,6 +396,16 @@ static BOOL snuggleStart(NSString *t)
} }
} }
if (chapters == 0)
{
// We must have at least one chapter!
[str appendString: @" <chapter>\n"];
[str appendString:
@" <heading>No contents found by autogsdoc</heading>\n"];
[str appendString: @" <p></p>\n"];
[str appendString: @" </chapter>\n"];
}
// Output document appendix if available. // Output document appendix if available.
tmp = [info objectForKey: @"back"]; tmp = [info objectForKey: @"back"];
if (tmp != nil) if (tmp != nil)

View file

@ -594,12 +594,15 @@ main(int argc, char **argv, char **env)
@" <author name=\"autogsdoc\"></author>\n" @" <author name=\"autogsdoc\"></author>\n"
@" </head>\n" @" </head>\n"
@" <body>\n" @" <body>\n"
@" <chapter>\n"
@" <heading>%@ project reference</heading>\n"
@" </chapter>\n"
@" <back>\n" @" <back>\n"
@" <index scope=\"project\" type=\"title\" />\n" @" <index scope=\"project\" type=\"title\" />\n"
@" </back>\n" @" </back>\n"
@" </body>\n" @" </body>\n"
@"</gsdoc>\n", @"</gsdoc>\n",
file, project]; file, project, project];
if ([upString writeToFile: upFile atomically: YES] == NO) if ([upString writeToFile: upFile atomically: YES] == NO)
{ {