Add support for 'index' element

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11803 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-12-18 09:31:32 +00:00
parent 4e020d04d8
commit 52e04e800e
6 changed files with 90 additions and 2 deletions

View file

@ -1,7 +1,10 @@
2001-12-18 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/gsdoc-0_6_7.dtd: add scope to index element
* Tools/AGSHtml.h:
* Tools/AGSHtml.m: Output tidyups and general format improvements.
Add lins to other documents in project.
Add links to other documents in project. Add support for 'index'
element with bioth file and project scope.
* Tools/autogsdoc.m: Clean up a little and handle gsdoc files
listed as source files better .... now looks for them in the
source directory.

View file

@ -1470,7 +1470,7 @@ loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctx)
NSString *file;
xmlParserInputPtr ret = 0;
NSString *entityId;
NSString *location ;
NSString *location;
NSArray *components;
NSMutableString *local;
unsigned count;
@ -1601,6 +1601,10 @@ loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctx)
{
ret = xmlNewInputFromFile(ctx, [file fileSystemRepresentation]);
}
else
{
NSLog(@"don't know how to load entity '%s' id '%s'", url, eid);
}
return ret;
}

View file

@ -28,6 +28,7 @@
{
AGSIndex *localRefs;
AGSIndex *globalRefs;
AGSIndex *projectRefs;
NSMutableString *indent;
NSString *base; // Not retained
NSString *unit; // Not retained
@ -64,6 +65,7 @@
- (NSString*) protocolRef: (NSString*)t;
- (void) setGlobalRefs: (AGSIndex*)r;
- (void) setLocalRefs: (AGSIndex*)r;
- (void) setProjectRefs: (AGSIndex*)r;
- (NSString*) typeRef: (NSString*)t;
@end
#endif

View file

@ -78,6 +78,7 @@ static NSMutableSet *textNodes = nil;
{
RELEASE(globalRefs);
RELEASE(localRefs);
RELEASE(projectRefs);
RELEASE(indent);
[super dealloc];
}
@ -750,6 +751,73 @@ static NSMutableSet *textNodes = nil;
[buf appendString: heading];
[buf appendString: @">\n"];
}
else if ([name isEqual: @"index"] == YES)
{
NSString *scope = [prop objectForKey: @"scope"];
NSString *type = [prop objectForKey: @"type"];
NSDictionary *dict = [localRefs refs];
if (projectRefs != nil && [scope isEqual: @"project"] == YES)
{
dict = [projectRefs refs];
}
dict = [dict objectForKey: type];
if ([dict count] > 0)
{
NSArray *a = [dict allKeys];
unsigned c = [a count];
unsigned i;
a = [a sortedArrayUsingSelector: @selector(compare:)];
[buf appendString: indent];
[buf appendString: @"<hr />\n"];
[buf appendString: indent];
[buf appendFormat: @"<b>%@ index</b>\n",
[type capitalizedString]];
[buf appendString: indent];
[buf appendString: @"<ul>\n"];
[self incIndent];
for (i = 0; i < c; i++)
{
if ([type isEqual: @"method"] || [type isEqual: @"ivariable"])
{
NSString *ref = [a objectAtIndex: i];
NSDictionary *units = [dict objectForKey: ref];
NSArray *b = [units allKeys];
unsigned j;
b = [b sortedArrayUsingSelector: @selector(compare:)];
for (j = 0; j < [b count]; j++)
{
NSString *u = [b objectAtIndex: j];
NSString *file = [units objectForKey: u];
[buf appendString: indent];
[buf appendFormat:
@"<li><a href=\"%@.html#%@%@\">%@ in %@</a></li>\n",
file, u, ref, ref, u];
}
}
else
{
NSString *ref = [a objectAtIndex: i];
NSString *file = [dict objectForKey: ref];
[buf appendString: indent];
[buf appendFormat:
@"<li><a href=\"%@.html#%@$%@\">%@</a></li>\n",
file, type, ref, ref];
}
}
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</ul>\n"];
}
}
else if ([name isEqual: @"ivar"] == YES) // %phrase
{
[buf appendString: @"<var>"];
@ -1476,6 +1544,11 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
ASSIGN(localRefs, r);
}
- (void) setProjectRefs: (AGSIndex*)r
{
ASSIGN(projectRefs, r);
}
/**
* Assuming that the supplied string contains type information (as used
* in a method declaration or type cast), we make an attempt at extracting

View file

@ -276,6 +276,10 @@
</p>
</section>
</chapter>
<back>
<index type="class" scope="project" />
<index type="method" scope="project" />
</back>
*/
#include <config.h>
@ -842,6 +846,7 @@ main(int argc, char **argv, char **env)
*/
html = AUTORELEASE([AGSHtml new]);
[html setGlobalRefs: indexer];
[html setProjectRefs: prjRefs];
[html setLocalRefs: locRefs];
generated = [html outputDocument: [[parser doc] root]];
if ([generated writeToFile: htmlfile atomically: YES] == NO)

View file

@ -489,6 +489,7 @@
<!ELEMENT index EMPTY>
<!ATTLIST index
type (class | protocol | method | ivariable | function | type | macro | variable | constant | label) "label"
scope (file | project) "file"
>