Permalink
Browse files

Added generator name and version to clean XML output.

  • Loading branch information...
1 parent 606325d commit 56d91f93f0b3adfd25982337a2b73c2ac2d15376 @tomaz committed Sep 15, 2009
Showing with 14 additions and 2 deletions.
  1. +3 −0 CommandLineParser.h
  2. +7 −1 CommandLineParser.m
  3. +4 −1 XMLOutputGenerator.m
View
@@ -267,6 +267,9 @@ This is used by the log macros, so in most cases, you'll not use it directly in
and @c docsetutil. */
@property(readonly) BOOL emitUtilityOutput;
+/** Generator name and version. */
+@property(readonly) NSString* generator;
+
/** The version of appledoc. */
@property(readonly) NSString* version;
View
@@ -308,7 +308,7 @@ - (void) parseCommandLineArguments:(const char**) argv
// Parse the verbose level first, so that we will correctly log as soon as possible.
// Then log the utility command line.
[self parseIntegerWithShortcut:@"-v" andName:@"--verbose" forKey:kTKCmdVerboseLevelKey];
- logNormal(@"appledoc v%@", [self version]);
+ logNormal([self generator]);
logNormal(@"Parsing command line arguments...");
logVerbose([commandLineArguments objectAtIndex:0]);
@@ -1029,6 +1029,12 @@ - (BOOL) emitUtilityOutput
}
//----------------------------------------------------------------------------------------
+- (NSString*) generator
+{
+ return [NSString stringWithFormat:@"appledoc v%@", self.version];
+}
+
+//----------------------------------------------------------------------------------------
- (NSString*) version
{
return @"1.0.1";
@@ -143,14 +143,15 @@ - (void) createCleanObjectDocumentationMarkup
continue;
}
- // (C) Get object name node. If not found, exit.
+ // (C) Get object name node and append utility version to xml. If not found, exit.
NSXMLElement* objectNode = [objectNodes objectAtIndex:0];
NSArray* objectNameNodes = [objectNode nodesForXPath:@"name" error:NULL];
if ([objectNameNodes count] == 0)
{
logError(@"Skipping '%@' because object name node not found!", filename);
continue;
}
+ [objectNode addAttribute:[NSXMLNode attributeWithName:@"generator" stringValue:cmd.generator]];
// (D) Now we have all information, get the data and add the object to the list.
NSXMLElement* objectNameNode = [objectNameNodes objectAtIndex:0];
@@ -447,6 +448,7 @@ - (void) createCleanIndexDocumentationFile
// Create the default markup.
NSXMLDocument* document = [[NSXMLDocument alloc] init];
NSXMLElement* projectElement = [NSXMLElement elementWithName:@"project"];
+ [projectElement addAttribute:[NSXMLNode attributeWithName:@"generator" stringValue:cmd.generator]];
[document setVersion:@"1.0"];
[document addChild:projectElement];
@@ -579,6 +581,7 @@ - (void) createCleanHierarchyDocumentationFile
// root...
NSXMLDocument* document = [[NSXMLDocument alloc] init];
NSXMLElement* projectElement = [NSXMLElement elementWithName:@"project"];
+ [projectElement addAttribute:[NSXMLNode attributeWithName:@"generator" stringValue:cmd.generator]];
[document setVersion:@"1.0"];
[document addChild:projectElement];
NSArray* sortedObjects = [[hierarchies allKeys] sortedArrayUsingSelector:@selector(compare:)];

0 comments on commit 56d91f9

Please sign in to comment.