Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add an option to turn apple-style anchors on or off.

  • Loading branch information...
commit bfcadb21057b3f617e6a49c50e5610ad9ef45422 1 parent e700063
@beelsebob beelsebob authored
View
6 Application/GBAppledocApplication.m
@@ -39,6 +39,7 @@
static NSString *kGBArgCreateDocSet = @"create-docset";
static NSString *kGBArgInstallDocSet = @"install-docset";
static NSString *kGBArgPublishDocSet = @"publish-docset";
+static NSString *kGBArgUseAppleAnchors = @"use-apple-anchors";
static NSString *kGBArgKeepIntermediateFiles = @"keep-intermediate-files";
static NSString *kGBArgExitCodeThreshold = @"exit-threshold";
@@ -266,6 +267,7 @@ - (void)application:(DDCliApplication *)app willParseOptions:(DDGetoptLongParser
{ kGBArgCreateDocSet, 'd', DDGetoptNoArgument },
{ kGBArgInstallDocSet, 'n', DDGetoptNoArgument },
{ kGBArgPublishDocSet, 'u', DDGetoptNoArgument },
+ { kGBArgUseAppleAnchors, 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgCreateHTML), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgCreateDocSet), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgInstallDocSet), 0, DDGetoptNoArgument },
@@ -765,11 +767,13 @@ - (void)setPublishDocset:(BOOL)value {
// self.settings.installDocSet = YES;
}
}
+- (void)setUseAppleAnchors:(BOOL)value { self.settings.useAppleAnchors = value; }
- (void)setNoCleanOutput:(BOOL)value { self.settings.cleanupOutputPathBeforeRunning = !value; }
- (void)setNoCreateHtml:(BOOL)value { [self setCreateHtml:!value]; }
- (void)setNoCreateDocset:(BOOL)value { [self setCreateDocset:!value]; }
- (void)setNoInstallDocset:(BOOL)value { [self setInstallDocset:!value]; }
- (void)setNoPublishDocset:(BOOL)value { [self setPublishDocset:!value]; }
+- (void)setNoUseAppleAnchors:(BOOL)value { [self setUseAppleAnchors:!value]; }
- (void)setCrossrefFormat:(NSString *)value { self.settings.commentComponents.crossReferenceMarkersTemplate = value; }
- (void)setExplicitCrossref:(BOOL)value { self.settings.commentComponents.crossReferenceMarkersTemplate = value ? @"<%@>" : @"<?%@>?"; }
@@ -905,6 +909,7 @@ - (void)printSettingsAndArguments:(NSArray *)arguments {
ddprintf(@"--%@ = %@\n", kGBArgCreateDocSet, PRINT_BOOL(self.settings.createDocSet));
ddprintf(@"--%@ = %@\n", kGBArgInstallDocSet, PRINT_BOOL(self.settings.installDocSet));
ddprintf(@"--%@ = %@\n", kGBArgPublishDocSet, PRINT_BOOL(self.settings.publishDocSet));
+ ddprintf(@"--%@ = %@\n", kGBArgUseAppleAnchors, PRINT_BOOL(self.settings.useAppleAnchors));
ddprintf(@"--%@ = %@\n", kGBArgKeepIntermediateFiles, PRINT_BOOL(self.settings.keepIntermediateFiles));
ddprintf(@"--%@ = %@\n", kGBArgKeepUndocumentedObjects, PRINT_BOOL(self.settings.keepUndocumentedObjects));
ddprintf(@"--%@ = %@\n", kGBArgKeepUndocumentedMembers, PRINT_BOOL(self.settings.keepUndocumentedMembers));
@@ -969,6 +974,7 @@ - (void)printHelp {
PRINT_USAGE(@"-d,", kGBArgCreateDocSet, @"", @"[b] Create documentation set");
PRINT_USAGE(@"-n,", kGBArgInstallDocSet, @"", @"[b] Install documentation set to Xcode");
PRINT_USAGE(@"-u,", kGBArgPublishDocSet, @"", @"[b] Prepare DocSet for publishing");
+ PRINT_USAGE(@" ", kGBArgUseAppleAnchors, @"", @"[b] Use apple style anchors in docsets");
PRINT_USAGE(@" ", kGBArgCleanOutput, @"", @"[b] Remove contents of output path before starting !!CAUTION!!");
ddprintf(@"\n");
ddprintf(@"OPTIONS\n");
View
7 Application/GBApplicationSettingsProvider.h
@@ -213,6 +213,13 @@ extern id kGBCustomDocumentIndexDescKey;
*/
@property (assign) BOOL publishDocSet;
+/** Specifies whether docSets should use the Apple or appledoc anchor format.
+
+ If `YES`, docset HTML files will use the format `//apple_ref/occ/symbol_type/parent_symbol/symbol_name/` for anchor names. Otherwise the format `//api/name/symbol_name` will be used.
+ @see createDocSet
+ */
+@property (assign) BOOL useAppleAnchors;
+
/** Specifies whether intermediate files should be kept in `outputPath` or not.
If `YES`, all intermediate files (i.e. HTML files and documentation set files) are kept in output path. If `NO`, only final results are kept. This setting not only affects how the files are being handled, it also affects performance. If intermediate files are not kept, appledoc moves files between various generation phases, otherwise it copies them. So it's prefferable to leave this option to `NO`. This option only affects output files, input source files are always left intact!
View
6 Application/GBApplicationSettingsProvider.m
@@ -83,6 +83,7 @@ - (id)init {
self.createDocSet = YES;
self.installDocSet = YES;
self.publishDocSet = NO;
+ self.useAppleAnchors = NO;
self.repeatFirstParagraphForMemberDescription = YES;
self.preprocessHeaderDoc = NO;
self.printInformationBlockTitles = YES;
@@ -373,7 +374,9 @@ - (NSString *)htmlReferenceForMember:(GBModelBase *)member prefixedWith:(NSStrin
NSParameterAssert(prefix != nil);
if ([member isKindOfClass:[GBMethodData class]]) {
GBMethodData *method = (GBMethodData *)member;
- return [NSString stringWithFormat:@"%@//apple_ref/occ/%@/%@/%@", prefix, [method methodTypeString], [method parentObject], method.methodSelector];
+ return (useAppleAnchors ?
+ [NSString stringWithFormat:@"%@//apple_ref/occ/%@/%@/%@", prefix, [method methodTypeString], [method parentObject], method.methodSelector] :
+ [NSString stringWithFormat:@"%@//api/name/%@", prefix, method.methodSelector]);
}
return @"";
}
@@ -623,6 +626,7 @@ - (NSString *)versionIdentifier {
@synthesize createDocSet;
@synthesize installDocSet;
@synthesize publishDocSet;
+@synthesize useAppleAnchors;
@synthesize keepIntermediateFiles;
@synthesize cleanupOutputPathBeforeRunning;
@synthesize treatDocSetIndexingErrorsAsFatals;
View
2  Model/GBMethodData.m
@@ -369,7 +369,7 @@ - (NSString *)description {
- (NSString *)methodTypeString {
BOOL isInterfaceParent = (![self.parentObject isKindOfClass:[GBClassData class]] &&
- ![self.parentObject isKindOfClass:[GBProtocolData class]]);
+ ![self.parentObject isKindOfClass:[GBCategoryData class]]);
switch (self.methodType)
{
case GBMethodTypeClass:
View
100 Testing/GBApplicationSettingsProviderTesting.m
@@ -167,8 +167,11 @@ - (void)testHtmlReferenceNameForObject_shouldReturnProperValueForDocuments {
- (void)testHtmlReferenceNameForObject_shouldReturnProperValueForMethods {
// setup
- GBApplicationSettingsProvider *settings = [GBApplicationSettingsProvider provider];
- settings.outputPath = @"anything :)";
+ GBApplicationSettingsProvider *settings1 = [GBApplicationSettingsProvider provider];
+ GBApplicationSettingsProvider *settings2 = [GBApplicationSettingsProvider provider];
+ settings1.outputPath = @"anything :)";
+ settings2.outputPath = @"anything :)";
+ settings2.useAppleAnchors = YES;
GBMethodArgument *argument = [GBMethodArgument methodArgumentWithName:@"method"];
GBMethodData *method1 = [GBTestObjectsRegistry instanceMethodWithArguments:argument, nil];
GBMethodData *method2 = [GBTestObjectsRegistry instanceMethodWithNames:@"doSomething", @"withVars", nil];
@@ -178,47 +181,65 @@ - (void)testHtmlReferenceNameForObject_shouldReturnProperValueForMethods {
[class.methods registerMethod:method2];
[class.methods registerMethod:property];
// execute & verify
- assertThat([settings htmlReferenceNameForObject:method1], is(@"//apple_ref/occ/instm/Class/method"));
- assertThat([settings htmlReferenceNameForObject:method2], is(@"//apple_ref/occ/instm/Class/doSomething:withVars:"));
- assertThat([settings htmlReferenceNameForObject:property], is(@"//apple_ref/occ/instp/Class/value"));
+ assertThat([settings1 htmlReferenceNameForObject:method1], is(@"//api/name/method"));
+ assertThat([settings1 htmlReferenceNameForObject:method2], is(@"//api/name/doSomething:withVars:"));
+ assertThat([settings1 htmlReferenceNameForObject:property], is(@"//api/name/value"));
+ assertThat([settings2 htmlReferenceNameForObject:method1], is(@"//apple_ref/occ/instm/Class/method"));
+ assertThat([settings2 htmlReferenceNameForObject:method2], is(@"//apple_ref/occ/instm/Class/doSomething:withVars:"));
+ assertThat([settings2 htmlReferenceNameForObject:property], is(@"//apple_ref/occ/instp/Class/value"));
}
#pragma mark HTML href references handling - index
- (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForClassFromIndex {
// setup
- GBApplicationSettingsProvider *settings = [GBApplicationSettingsProvider provider];
- settings.outputPath = @"anything :)";
+ GBApplicationSettingsProvider *settings1 = [GBApplicationSettingsProvider provider];
+ GBApplicationSettingsProvider *settings2 = [GBApplicationSettingsProvider provider];
+ settings1.outputPath = @"anything :)";
+ settings2.outputPath = @"anything :)";
+ settings2.useAppleAnchors = YES;
GBClassData *class = [GBClassData classDataWithName:@"Class"];
GBMethodData *method = [GBTestObjectsRegistry instanceMethodWithNames:@"method", nil];
[class.methods registerMethod:method];
// execute & verify
- assertThat([settings htmlReferenceForObject:class fromSource:nil], is(@"Classes/Class.html"));
- assertThat([settings htmlReferenceForObject:method fromSource:nil], is(@"Classes/Class.html#//apple_ref/occ/instm/Class/method:"));
+ assertThat([settings1 htmlReferenceForObject:class fromSource:nil], is(@"Classes/Class.html"));
+ assertThat([settings1 htmlReferenceForObject:method fromSource:nil], is(@"Classes/Class.html#//api/name/method:"));
+ assertThat([settings2 htmlReferenceForObject:class fromSource:nil], is(@"Classes/Class.html"));
+ assertThat([settings2 htmlReferenceForObject:method fromSource:nil], is(@"Classes/Class.html#//apple_ref/occ/instm/Class/method:"));
}
- (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForCategoryFromIndex {
// setup
- GBApplicationSettingsProvider *settings = [GBApplicationSettingsProvider provider];
- settings.outputPath = @"anything :)";
+ GBApplicationSettingsProvider *settings1 = [GBApplicationSettingsProvider provider];
+ GBApplicationSettingsProvider *settings2 = [GBApplicationSettingsProvider provider];
+ settings1.outputPath = @"anything :)";
+ settings2.outputPath = @"anything :)";
+ settings2.useAppleAnchors = YES;
GBCategoryData *category = [GBCategoryData categoryDataWithName:@"Category" className:@"Class"];
GBMethodData *method = [GBTestObjectsRegistry instanceMethodWithNames:@"method", nil];
[category.methods registerMethod:method];
// execute & verify
- assertThat([settings htmlReferenceForObject:category fromSource:nil], is(@"Categories/Class+Category.html"));
- assertThat([settings htmlReferenceForObject:method fromSource:nil], is(@"Categories/Class+Category.html#//apple_ref/occ/intfm/Class(Category)/method:"));
+ assertThat([settings1 htmlReferenceForObject:category fromSource:nil], is(@"Categories/Class+Category.html"));
+ assertThat([settings1 htmlReferenceForObject:method fromSource:nil], is(@"Categories/Class+Category.html#//api/name/method:"));
+ assertThat([settings2 htmlReferenceForObject:category fromSource:nil], is(@"Categories/Class+Category.html"));
+ assertThat([settings2 htmlReferenceForObject:method fromSource:nil], is(@"Categories/Class+Category.html#//apple_ref/occ/instm/Class(Category)/method:"));
}
- (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForProtocolFromIndex {
// setup
- GBApplicationSettingsProvider *settings = [GBApplicationSettingsProvider provider];
- settings.outputPath = @"anything :)";
+ GBApplicationSettingsProvider *settings1 = [GBApplicationSettingsProvider provider];
+ GBApplicationSettingsProvider *settings2 = [GBApplicationSettingsProvider provider];
+ settings1.outputPath = @"anything :)";
+ settings2.outputPath = @"anything :)";
+ settings2.useAppleAnchors = YES;
GBProtocolData *protocol = [GBProtocolData protocolDataWithName:@"Protocol"];
GBMethodData *method = [GBTestObjectsRegistry instanceMethodWithNames:@"method", nil];
[protocol.methods registerMethod:method];
// execute & verify
- assertThat([settings htmlReferenceForObject:protocol fromSource:nil], is(@"Protocols/Protocol.html"));
- assertThat([settings htmlReferenceForObject:method fromSource:nil], is(@"Protocols/Protocol.html#//apple_ref/occ/instm/Protocol/method:"));
+ assertThat([settings1 htmlReferenceForObject:protocol fromSource:nil], is(@"Protocols/Protocol.html"));
+ assertThat([settings1 htmlReferenceForObject:method fromSource:nil], is(@"Protocols/Protocol.html#//api/name/method:"));
+ assertThat([settings2 htmlReferenceForObject:protocol fromSource:nil], is(@"Protocols/Protocol.html"));
+ assertThat([settings2 htmlReferenceForObject:method fromSource:nil], is(@"Protocols/Protocol.html#//apple_ref/occ/intfm/Protocol/method:"));
}
- (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForDocumentFromIndex {
@@ -346,35 +367,50 @@ - (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForCustomDoc
- (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForTopLevelObjectToItsMemberReference {
// setup
- GBApplicationSettingsProvider *settings = [GBApplicationSettingsProvider provider];
- settings.outputPath = @"anything :)";
+ GBApplicationSettingsProvider *settings1 = [GBApplicationSettingsProvider provider];
+ GBApplicationSettingsProvider *settings2 = [GBApplicationSettingsProvider provider];
+ settings1.outputPath = @"anything :)";
+ settings2.outputPath = @"anything :)";
+ settings2.useAppleAnchors = YES;
GBClassData *class = [GBClassData classDataWithName:@"Class"];
GBMethodData *method = [GBTestObjectsRegistry propertyMethodWithArgument:@"value"];
[class.methods registerMethod:method];
// execute & verify
- assertThat([settings htmlReferenceForObject:method fromSource:class], is(@"#//apple_ref/occ/instp/Class/value"));
- assertThat([settings htmlReferenceForObject:class fromSource:method], is(@"Class.html"));
+ assertThat([settings1 htmlReferenceForObject:method fromSource:class], is(@"#//api/name/value"));
+ assertThat([settings1 htmlReferenceForObject:class fromSource:method], is(@"Class.html"));
+ assertThat([settings2 htmlReferenceForObject:method fromSource:class], is(@"#//apple_ref/occ/instp/Class/value"));
+ assertThat([settings2 htmlReferenceForObject:class fromSource:method], is(@"Class.html"));
}
- (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForTopLevelObjectToSameTypeRemoteMemberReference {
// setup
- GBApplicationSettingsProvider *settings = [GBApplicationSettingsProvider provider];
- settings.outputPath = @"anything :)";
+ GBApplicationSettingsProvider *settings1 = [GBApplicationSettingsProvider provider];
+ GBApplicationSettingsProvider *settings2 = [GBApplicationSettingsProvider provider];
+ settings1.outputPath = @"anything :)";
+ settings2.outputPath = @"anything :)";
+ settings2.useAppleAnchors = YES;
GBClassData *class1 = [GBClassData classDataWithName:@"Class1"];
GBClassData *class2 = [GBClassData classDataWithName:@"Class2"];
GBMethodData *method = [GBTestObjectsRegistry propertyMethodWithArgument:@"value"];
[class1.methods registerMethod:method];
// execute & verify
- assertThat([settings htmlReferenceForObject:method fromSource:class2], is(@"../Classes/Class1.html#//apple_ref/occ/instp/Class1/value"));
- assertThat([settings htmlReferenceForObject:method fromSource:class1], is(@"#//apple_ref/occ/instp/Class1/value"));
- assertThat([settings htmlReferenceForObject:class1 fromSource:method], is(@"Class1.html"));
- assertThat([settings htmlReferenceForObject:class2 fromSource:method], is(@"../Classes/Class2.html"));
+ assertThat([settings1 htmlReferenceForObject:method fromSource:class2], is(@"../Classes/Class1.html#//api/name/value"));
+ assertThat([settings1 htmlReferenceForObject:method fromSource:class1], is(@"#//api/name/value"));
+ assertThat([settings1 htmlReferenceForObject:class1 fromSource:method], is(@"Class1.html"));
+ assertThat([settings1 htmlReferenceForObject:class2 fromSource:method], is(@"../Classes/Class2.html"));
+ assertThat([settings2 htmlReferenceForObject:method fromSource:class2], is(@"../Classes/Class1.html#//apple_ref/occ/instp/Class1/value"));
+ assertThat([settings2 htmlReferenceForObject:method fromSource:class1], is(@"#//apple_ref/occ/instp/Class1/value"));
+ assertThat([settings2 htmlReferenceForObject:class1 fromSource:method], is(@"Class1.html"));
+ assertThat([settings2 htmlReferenceForObject:class2 fromSource:method], is(@"../Classes/Class2.html"));
}
- (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForTopLevelObjectToDifferentTypeRemoteMemberReference {
// setup
- GBApplicationSettingsProvider *settings = [GBApplicationSettingsProvider provider];
- settings.outputPath = @"anything :)";
+ GBApplicationSettingsProvider *settings1 = [GBApplicationSettingsProvider provider];
+ GBApplicationSettingsProvider *settings2 = [GBApplicationSettingsProvider provider];
+ settings1.outputPath = @"anything :)";
+ settings2.outputPath = @"anything :)";
+ settings2.useAppleAnchors = YES;
GBClassData *class = [GBClassData classDataWithName:@"Class"];
GBCategoryData *protocol = [GBProtocolData protocolDataWithName:@"Protocol"];
GBMethodData *method1 = [GBTestObjectsRegistry propertyMethodWithArgument:@"value1"];
@@ -382,8 +418,10 @@ - (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForTopLevelO
[class.methods registerMethod:method1];
[protocol.methods registerMethod:method2];
// execute & verify
- assertThat([settings htmlReferenceForObject:method1 fromSource:protocol], is(@"../Classes/Class.html#//apple_ref/occ/instp/Class/value1"));
- assertThat([settings htmlReferenceForObject:method2 fromSource:class], is(@"../Protocols/Protocol.html#//apple_ref/occ/instp/Protocol/value2"));
+ assertThat([settings1 htmlReferenceForObject:method1 fromSource:protocol], is(@"../Classes/Class.html#//api/name/value1"));
+ assertThat([settings1 htmlReferenceForObject:method2 fromSource:class], is(@"../Protocols/Protocol.html#//api/name/value2"));
+ assertThat([settings2 htmlReferenceForObject:method1 fromSource:protocol], is(@"../Classes/Class.html#//apple_ref/occ/instp/Class/value1"));
+ assertThat([settings2 htmlReferenceForObject:method2 fromSource:class], is(@"../Protocols/Protocol.html#//apple_ref/occ/intfp/Protocol/value2"));
}
#pragma mark Template files handling
View
9 Testing/GBApplicationTesting.m
@@ -212,6 +212,15 @@ - (void)testPublishDocSet_shouldAssignValueToSettings {
assertThatBool(settings2.publishDocSet, equalToBool(NO));
}
+- (void)testUseAppleAnchors_shouldAssignValueToSettings {
+ // setup & execute
+ GBApplicationSettingsProvider *settings1 = [self settingsByRunningWithArgs:@"--use-apple-anchors", nil];
+ GBApplicationSettingsProvider *settings2 = [self settingsByRunningWithArgs:@"--no-use-apple-anchors", nil];
+ // verify
+ assertThatBool(settings1.useAppleAnchors, equalToBool(YES));
+ assertThatBool(settings2.useAppleAnchors, equalToBool(NO));
+}
+
- (void)testKeepIntermediateFiles_shouldAssignValueToSettings {
// setup & execute
GBApplicationSettingsProvider *settings1 = [self settingsByRunningWithArgs:@"--keep-intermediate-files", nil];
View
26 Testing/GBCommentsProcessor-MarkdownTesting.m
@@ -95,9 +95,9 @@ - (void)testProcessCommentWithContextStore_markdown_shouldKeepInlineLocalMemberC
[processor processComment:comment2 withContext:context store:store];
[processor processComment:comment3 withContext:context store:store];
// verify
- [self assertComment:comment1 matchesLongDescMarkdown:@"[instanceMethod:](#//apple_ref/occ/instm/Class/instanceMethod:)", nil];
- [self assertComment:comment2 matchesLongDescMarkdown:@"[classMethod:](#//apple_ref/occ/clm/Class/classMethod:)", nil];
- [self assertComment:comment3 matchesLongDescMarkdown:@"[value](#//apple_ref/occ/instp/Class/value)", nil];
+ [self assertComment:comment1 matchesLongDescMarkdown:@"[instanceMethod:](#//api/name/instanceMethod:)", nil];
+ [self assertComment:comment2 matchesLongDescMarkdown:@"[classMethod:](#//api/name/classMethod:)", nil];
+ [self assertComment:comment3 matchesLongDescMarkdown:@"[value](#//api/name/value)", nil];
}
- (void)testProcessCommentWithContextStore_markdown_shouldKeepInlineRemoteMemberCrossRefsTexts {
@@ -112,9 +112,9 @@ - (void)testProcessCommentWithContextStore_markdown_shouldKeepInlineRemoteMember
[processor processComment:comment2 withContext:nil store:store];
[processor processComment:comment3 withContext:nil store:store];
// verify
- [self assertComment:comment1 matchesLongDescMarkdown:@"[[Class instanceMethod:]](Classes/Class.html#//apple_ref/occ/instm/Class/instanceMethod:)", nil];
- [self assertComment:comment2 matchesLongDescMarkdown:@"[[Class classMethod:]](Classes/Class.html#//apple_ref/occ/clm/Class/classMethod:)", nil];
- [self assertComment:comment3 matchesLongDescMarkdown:@"[[Class value]](Classes/Class.html#//apple_ref/occ/instp/Class/value)", nil];
+ [self assertComment:comment1 matchesLongDescMarkdown:@"[[Class instanceMethod:]](Classes/Class.html#//api/name/instanceMethod:)", nil];
+ [self assertComment:comment2 matchesLongDescMarkdown:@"[[Class classMethod:]](Classes/Class.html#//api/name/classMethod:)", nil];
+ [self assertComment:comment3 matchesLongDescMarkdown:@"[[Class value]](Classes/Class.html#//api/name/value)", nil];
}
- (void)testProcessCommentWithContextStore_markdown_shouldProperlyFormatInlineLinksWithinStandardMarkdownFormattingMarkers {
@@ -216,9 +216,9 @@ - (void)testProcessCommentWithContextStore_markdown_shouldUsePrefixForRelatedIte
[processor processComment:comment2 withContext:context store:store];
[processor processComment:comment3 withContext:context store:store];
// verify
- [self assertComponents:comment1.relatedItems matchMarkdown:@"[- instanceMethod:](#//apple_ref/occ/instm/Class/instanceMethod:)", nil];
- [self assertComponents:comment2.relatedItems matchMarkdown:@"[+ classMethod:](#//apple_ref/occ/clm/Class/classMethod:)", nil];
- [self assertComponents:comment3.relatedItems matchMarkdown:@"[@property value](#//apple_ref/occ/instp/Class/value)", nil];
+ [self assertComponents:comment1.relatedItems matchMarkdown:@"[- instanceMethod:](#//api/name/instanceMethod:)", nil];
+ [self assertComponents:comment2.relatedItems matchMarkdown:@"[+ classMethod:](#//api/name/classMethod:)", nil];
+ [self assertComponents:comment3.relatedItems matchMarkdown:@"[@property value](#//api/name/value)", nil];
}
- (void)testProcessCommentWithContextStore_markdown_shouldKeepRelatedItemsRemoteMemberCrossRefsTexts {
@@ -233,9 +233,9 @@ - (void)testProcessCommentWithContextStore_markdown_shouldKeepRelatedItemsRemote
[processor processComment:comment2 withContext:nil store:store];
[processor processComment:comment3 withContext:nil store:store];
// verify
- [self assertComponents:comment1.relatedItems matchMarkdown:@"[[Class instanceMethod:]](Classes/Class.html#//apple_ref/occ/instm/Class/instanceMethod:)", nil];
- [self assertComponents:comment2.relatedItems matchMarkdown:@"[[Class classMethod:]](Classes/Class.html#//apple_ref/occ/clm/Class/classMethod:)", nil];
- [self assertComponents:comment3.relatedItems matchMarkdown:@"[[Class value]](Classes/Class.html#//apple_ref/occ/instp/Class/value)", nil];
+ [self assertComponents:comment1.relatedItems matchMarkdown:@"[[Class instanceMethod:]](Classes/Class.html#//api/name/instanceMethod:)", nil];
+ [self assertComponents:comment2.relatedItems matchMarkdown:@"[[Class classMethod:]](Classes/Class.html#//api/name/classMethod:)", nil];
+ [self assertComponents:comment3.relatedItems matchMarkdown:@"[[Class value]](Classes/Class.html#//api/name/value)", nil];
}
#pragma mark Making sure reasonably complex stuff gets handled properly
@@ -274,7 +274,7 @@ - (void)testStringByConvertingCrossReferencesInString_copied_shouldUseUniversalR
// execute
[processor processComment:comment withContext:class store:store];
// verify
- [self assertComment:comment matchesLongDescMarkdown:@"[instanceMethod:](../Classes/Class.html#//apple_ref/occ/instm/Class/instanceMethod:)", nil];
+ [self assertComment:comment matchesLongDescMarkdown:@"[instanceMethod:](../Classes/Class.html#//api/name/instanceMethod:)", nil];
}
- (void)testStringByConvertingCrossReferencesInString_copied_shouldIgnoreCommentIfOriginalContextDoesntMatch {
View
88 Testing/GBCommentsProcessor-PreprocessingTesting.m
@@ -184,10 +184,10 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertClassLocalIns
NSString *result5 = [processor stringByConvertingCrossReferencesInString:@"another:" withFlags:0];
NSString *result6 = [processor stringByConvertingCrossReferencesInString:@"<another:>" withFlags:0];
// verify
- assertThat(result1, is(@"[method:](#//apple_ref/occ/instm/Class/method:)"));
- assertThat(result2, is(@"[method:](#//apple_ref/occ/instm/Class/method:)"));
- assertThat(result3, is(@"[method:](#//apple_ref/occ/instm/Class/method:)"));
- assertThat(result4, is(@"[method:](#//apple_ref/occ/instm/Class/method:)"));
+ assertThat(result1, is(@"[method:](#//api/name/method:)"));
+ assertThat(result2, is(@"[method:](#//api/name/method:)"));
+ assertThat(result3, is(@"[method:](#//api/name/method:)"));
+ assertThat(result4, is(@"[method:](#//api/name/method:)"));
assertThat(result5, is(@"another:"));
assertThat(result6, is(@"<another:>"));
}
@@ -205,10 +205,10 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertClassLocalCla
NSString *result5 = [processor stringByConvertingCrossReferencesInString:@"another:" withFlags:0];
NSString *result6 = [processor stringByConvertingCrossReferencesInString:@"<another:>" withFlags:0];
// verify
- assertThat(result1, is(@"[method:](#//apple_ref/occ/clm/Class/method:)"));
- assertThat(result2, is(@"[method:](#//apple_ref/occ/clm/Class/method:)"));
- assertThat(result3, is(@"[method:](#//apple_ref/occ/clm/Class/method:)"));
- assertThat(result4, is(@"[method:](#//apple_ref/occ/clm/Class/method:)"));
+ assertThat(result1, is(@"[method:](#//api/name/method:)"));
+ assertThat(result2, is(@"[method:](#//api/name/method:)"));
+ assertThat(result3, is(@"[method:](#//api/name/method:)"));
+ assertThat(result4, is(@"[method:](#//api/name/method:)"));
assertThat(result5, is(@"another:"));
assertThat(result6, is(@"<another:>"));
}
@@ -226,8 +226,8 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertClassLocalPro
NSString *result5 = [processor stringByConvertingCrossReferencesInString:@"another" withFlags:0];
NSString *result6 = [processor stringByConvertingCrossReferencesInString:@"<another>" withFlags:0];
// verify
- assertThat(result1, is(@"[method](#//apple_ref/occ/instp/Class/method)"));
- assertThat(result2, is(@"[method](#//apple_ref/occ/instp/Class/method)"));
+ assertThat(result1, is(@"[method](#//api/name/method)"));
+ assertThat(result2, is(@"[method](#//api/name/method)"));
assertThat(result3, is(@"method:"));
assertThat(result4, is(@"<method:>"));
assertThat(result5, is(@"another"));
@@ -251,11 +251,11 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertCategoryAndPr
NSString *result5 = [processor2 stringByConvertingCrossReferencesInString:@"<method2:>" withFlags:0];
NSString *result6 = [processor2 stringByConvertingCrossReferencesInString:@"method1:" withFlags:0];
// verify
- assertThat(result1, is(@"[method1:](#//apple_ref/occ/intfm/Class(Category)/method1:)"));
- assertThat(result2, is(@"[method1:](#//apple_ref/occ/intfm/Class(Category)/method1:)"));
+ assertThat(result1, is(@"[method1:](#//api/name/method1:)"));
+ assertThat(result2, is(@"[method1:](#//api/name/method1:)"));
assertThat(result3, is(@"method2:"));
- assertThat(result4, is(@"[method2:](#//apple_ref/occ/instm/Protocol/method2:)"));
- assertThat(result5, is(@"[method2:](#//apple_ref/occ/instm/Protocol/method2:)"));
+ assertThat(result4, is(@"[method2:](#//api/name/method2:)"));
+ assertThat(result5, is(@"[method2:](#//api/name/method2:)"));
assertThat(result6, is(@"method1:"));
}
@@ -276,11 +276,11 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertCategoryAndPr
NSString *result5 = [processor2 stringByConvertingCrossReferencesInString:@"<method2:>" withFlags:0];
NSString *result6 = [processor2 stringByConvertingCrossReferencesInString:@"method1:" withFlags:0];
// verify
- assertThat(result1, is(@"[method1:](#//apple_ref/occ/intfcm/Class(Category)/method1:)"));
- assertThat(result2, is(@"[method1:](#//apple_ref/occ/intfcm/Class(Category)/method1:)"));
+ assertThat(result1, is(@"[method1:](#//api/name/method1:)"));
+ assertThat(result2, is(@"[method1:](#//api/name/method1:)"));
assertThat(result3, is(@"method2:"));
- assertThat(result4, is(@"[method2:](#//apple_ref/occ/clm/Protocol/method2:)"));
- assertThat(result5, is(@"[method2:](#//apple_ref/occ/clm/Protocol/method2:)"));
+ assertThat(result4, is(@"[method2:](#//api/name/method2:)"));
+ assertThat(result5, is(@"[method2:](#//api/name/method2:)"));
assertThat(result6, is(@"method1:"));
}
@@ -301,11 +301,11 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertCategoryAndPr
NSString *result5 = [processor2 stringByConvertingCrossReferencesInString:@"<method2>" withFlags:0];
NSString *result6 = [processor2 stringByConvertingCrossReferencesInString:@"method1" withFlags:0];
// verify
- assertThat(result1, is(@"[method1](#//apple_ref/occ/intfp/Class(Category)/method1)"));
- assertThat(result2, is(@"[method1](#//apple_ref/occ/intfp/Class(Category)/method1)"));
+ assertThat(result1, is(@"[method1](#//api/name/method1)"));
+ assertThat(result2, is(@"[method1](#//api/name/method1)"));
assertThat(result3, is(@"method2"));
- assertThat(result4, is(@"[method2](#//apple_ref/occ/instp/Protocol/method2)"));
- assertThat(result5, is(@"[method2](#//apple_ref/occ/instp/Protocol/method2)"));
+ assertThat(result4, is(@"[method2](#//api/name/method2)"));
+ assertThat(result5, is(@"[method2](#//api/name/method2)"));
assertThat(result6, is(@"method1"));
}
@@ -325,10 +325,10 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertClassRemoteIn
NSString *result5 = [processor stringByConvertingCrossReferencesInString:@"[Unknown method:]" withFlags:0];
NSString *result6 = [processor stringByConvertingCrossReferencesInString:@"method:" withFlags:0];
// verify
- assertThat(result1, is(@"[[Class1 method:]](../Classes/Class1.html#//apple_ref/occ/instm/Class1/method:)"));
- assertThat(result2, is(@"[[Class1 method:]](../Classes/Class1.html#//apple_ref/occ/instm/Class1/method:)"));
- assertThat(result3, is(@"[[Class1 method:]](../Classes/Class1.html#//apple_ref/occ/instm/Class1/method:)"));
- assertThat(result4, is(@"[[Class1 method:]](../Classes/Class1.html#//apple_ref/occ/instm/Class1/method:)"));
+ assertThat(result1, is(@"[[Class1 method:]](../Classes/Class1.html#//api/name/method:)"));
+ assertThat(result2, is(@"[[Class1 method:]](../Classes/Class1.html#//api/name/method:)"));
+ assertThat(result3, is(@"[[Class1 method:]](../Classes/Class1.html#//api/name/method:)"));
+ assertThat(result4, is(@"[[Class1 method:]](../Classes/Class1.html#//api/name/method:)"));
assertThat(result5, is(@"[Unknown method:]"));
assertThat(result6, is(@"method:"));
}
@@ -347,10 +347,10 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertCategoryRemot
NSString *result5 = [processor stringByConvertingCrossReferencesInString:@"[Class(Unknown) method:]" withFlags:0];
NSString *result6 = [processor stringByConvertingCrossReferencesInString:@"[Unknown(Category) method:]" withFlags:0];
// verify
- assertThat(result1, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//apple_ref/occ/intfm/Class(Category)/method:)"));
- assertThat(result2, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//apple_ref/occ/intfm/Class(Category)/method:)"));
- assertThat(result3, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//apple_ref/occ/intfm/Class(Category)/method:)"));
- assertThat(result4, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//apple_ref/occ/intfm/Class(Category)/method:)"));
+ assertThat(result1, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//api/name/method:)"));
+ assertThat(result2, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//api/name/method:)"));
+ assertThat(result3, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//api/name/method:)"));
+ assertThat(result4, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//api/name/method:)"));
assertThat(result5, is(@"[Class(Unknown) method:]"));
assertThat(result6, is(@"[Unknown(Category) method:]"));
}
@@ -369,10 +369,10 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertProtocolRemot
NSString *result5 = [processor stringByConvertingCrossReferencesInString:@"[Unknown method:]" withFlags:0];
NSString *result6 = [processor stringByConvertingCrossReferencesInString:@"method:" withFlags:0];
// verify
- assertThat(result1, is(@"[[Protocol method:]](../Protocols/Protocol.html#//apple_ref/occ/instm/Protocol/method:)"));
- assertThat(result2, is(@"[[Protocol method:]](../Protocols/Protocol.html#//apple_ref/occ/instm/Protocol/method:)"));
- assertThat(result3, is(@"[[Protocol method:]](../Protocols/Protocol.html#//apple_ref/occ/instm/Protocol/method:)"));
- assertThat(result4, is(@"[[Protocol method:]](../Protocols/Protocol.html#//apple_ref/occ/instm/Protocol/method:)"));
+ assertThat(result1, is(@"[[Protocol method:]](../Protocols/Protocol.html#//api/name/method:)"));
+ assertThat(result2, is(@"[[Protocol method:]](../Protocols/Protocol.html#//api/name/method:)"));
+ assertThat(result3, is(@"[[Protocol method:]](../Protocols/Protocol.html#//api/name/method:)"));
+ assertThat(result4, is(@"[[Protocol method:]](../Protocols/Protocol.html#//api/name/method:)"));
assertThat(result5, is(@"[Unknown method:]"));
assertThat(result6, is(@"method:"));
}
@@ -617,16 +617,16 @@ - (void)testStringByConvertingCrossReferencesInString_shouldKeepManualObjectMeth
NSString *result7 = [processor stringByConvertingCrossReferencesInString:@"[doSomething:withVars:]([Class doSomething:withVars:]), [text with space]([Class method])" withFlags:0];
NSString *result8 = [processor stringByConvertingCrossReferencesInString:@"[text](<-[Class value]>)" withFlags:0];
- assertThat(result1, is(@"[text](Classes/Class.html#//apple_ref/occ/instm/Class/method)"));
- assertThat(result2, is(@"[text](Classes/Class.html#//apple_ref/occ/instm/Class/doSomething:withVars:)"));
- assertThat(result3, is(@"[text](Classes/Class.html#//apple_ref/occ/instp/Class/value)"));
- assertThat(result4, is(@"[text with space](Classes/Class.html#//apple_ref/occ/instm/Class/method)"));
- assertThat(result4b, is(@"[text onlyOneSpace](Classes/Class.html#//apple_ref/occ/instm/Class/method)"));
- assertThat(result4c, is(@"[text](Classes/Class.html#//apple_ref/occ/instm/Class/method), [text onlyOneSpace](Classes/Class.html#//apple_ref/occ/instm/Class/method)"));
- assertThat(result5, is(@"[doSomething:withVars:](Classes/Class.html#//apple_ref/occ/instm/Class/doSomething:withVars:)"));
- assertThat(result6, is(@"[doSomething:withVars:](Classes/Class.html#//apple_ref/occ/instm/Class/doSomething:withVars:), [text](Classes/Class.html#//apple_ref/occ/instm/Class/method)"));
- assertThat(result7, is(@"[doSomething:withVars:](Classes/Class.html#//apple_ref/occ/instm/Class/doSomething:withVars:), [text with space](Classes/Class.html#//apple_ref/occ/instm/Class/method)"));
- assertThat(result8, is(@"[text](Classes/Class.html#//apple_ref/occ/instp/Class/value)"));
+ assertThat(result1, is(@"[text](Classes/Class.html#//api/name/method)"));
+ assertThat(result2, is(@"[text](Classes/Class.html#//api/name/doSomething:withVars:)"));
+ assertThat(result3, is(@"[text](Classes/Class.html#//api/name/value)"));
+ assertThat(result4, is(@"[text with space](Classes/Class.html#//api/name/method)"));
+ assertThat(result4b, is(@"[text onlyOneSpace](Classes/Class.html#//api/name/method)"));
+ assertThat(result4c, is(@"[text](Classes/Class.html#//api/name/method), [text onlyOneSpace](Classes/Class.html#//api/name/method)"));
+ assertThat(result5, is(@"[doSomething:withVars:](Classes/Class.html#//api/name/doSomething:withVars:)"));
+ assertThat(result6, is(@"[doSomething:withVars:](Classes/Class.html#//api/name/doSomething:withVars:), [text](Classes/Class.html#//api/name/method)"));
+ assertThat(result7, is(@"[doSomething:withVars:](Classes/Class.html#//api/name/doSomething:withVars:), [text with space](Classes/Class.html#//api/name/method)"));
+ assertThat(result8, is(@"[text](Classes/Class.html#//api/name/value)"));
}
- (void)testStringByConvertingCrossReferencesInString_shouldIgnoreKnownObjectsInManualLinkDescriptionOrTitle {
Please sign in to comment.
Something went wrong with that request. Please try again.