Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

When merging categories to classes, their comment is also merged. Add…

…resses #117.

This is on by default, but can be controlled through `--merge-category-comment` cmd line switch.
  • Loading branch information...
commit 0acde9dc95166cc32445d0d4a19c5ba96f7dd728 1 parent 9d2499e
@tomaz authored
View
2  AppledocTests-Info.plist
@@ -17,6 +17,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>764</string>
+ <string>765</string>
</dict>
</plist>
View
5 Application/GBAppledocApplication.m
@@ -46,6 +46,7 @@
static NSString *kGBArgKeepUndocumentedMembers = @"keep-undocumented-members";
static NSString *kGBArgFindUndocumentedMembersDocumentation = @"search-undocumented-doc";
static NSString *kGBArgMergeCategoriesToClasses = @"merge-categories";
+static NSString *kGBArgMergeCategoryComment = @"merge-category-comment";
static NSString *kGBArgKeepMergedCategoriesSections = @"keep-merged-sections";
static NSString *kGBArgPrefixMergedCategoriesSectionsWithCategoryName = @"prefix-merged-sections";
@@ -676,6 +677,7 @@ - (void)setRepeatFirstPar:(BOOL)value { self.settings.repeatFirstParagraphForMem
- (void)setPreprocessHeaderdoc:(BOOL)value { self.settings.preprocessHeaderDoc = value; }
- (void)setUseSingleStar:(BOOL)value { self.settings.useSingleStarForBold = value; }
- (void)setMergeCategories:(BOOL)value { self.settings.mergeCategoriesToClasses = value; }
+- (void)setMergeCategoryComment:(BOOL)value { self.settings.mergeCategoryCommentToClass = value; }
- (void)setKeepMergedSections:(BOOL)value { self.settings.keepMergedCategoriesSections = value; }
- (void)setPrefixMergedSections:(BOOL)value { self.settings.prefixMergedCategoriesSectionsWithCategoryName = value; }
- (void)setNoKeepIntermediateFiles:(BOOL)value { self.settings.keepIntermediateFiles = !value;}
@@ -686,6 +688,7 @@ - (void)setNoRepeatFirstPar:(BOOL)value { self.settings.repeatFirstParagraphForM
- (void)setNoUseSingleStar:(BOOL)value { self.settings.useSingleStarForBold = !value; }
- (void)setNoPreprocessHeaderdoc:(BOOL)value { self.settings.preprocessHeaderDoc = !value; }
- (void)setNoMergeCategories:(BOOL)value { self.settings.mergeCategoriesToClasses = !value; }
+- (void)setNoMergeCategoryComment:(BOOL)value { self.settings.mergeCategoryCommentToClass = !value; }
- (void)setNoKeepMergedSections:(BOOL)value { self.settings.keepMergedCategoriesSections = !value; }
- (void)setNoPrefixMergedSections:(BOOL)value { self.settings.prefixMergedCategoriesSectionsWithCategoryName = !value; }
@@ -799,6 +802,7 @@ - (void)printSettingsAndArguments:(NSArray *)arguments {
ddprintf(@"--%@ = %@\n", kGBArgRepeatFirstParagraph, PRINT_BOOL(self.settings.repeatFirstParagraphForMemberDescription));
ddprintf(@"--%@ = %@\n", kGBArgUseSingleStar, PRINT_BOOL(self.settings.useSingleStarForBold));
ddprintf(@"--%@ = %@\n", kGBArgMergeCategoriesToClasses, PRINT_BOOL(self.settings.mergeCategoriesToClasses));
+ ddprintf(@"--%@ = %@\n", kGBArgMergeCategoryComment, PRINT_BOOL(self.settings.mergeCategoryCommentToClass));
ddprintf(@"--%@ = %@\n", kGBArgKeepMergedCategoriesSections, PRINT_BOOL(self.settings.keepMergedCategoriesSections));
ddprintf(@"--%@ = %@\n", kGBArgPrefixMergedCategoriesSectionsWithCategoryName, PRINT_BOOL(self.settings.prefixMergedCategoriesSectionsWithCategoryName));
ddprintf(@"--%@ = %@\n", kGBArgCrossRefFormat, self.settings.commentComponents.crossReferenceMarkersTemplate);
@@ -863,6 +867,7 @@ - (void)printHelp {
PRINT_USAGE(@" ", kGBArgRepeatFirstParagraph, @"", @"[b] Repeat first paragraph in member documentation");
PRINT_USAGE(@" ", kGBArgUseSingleStar, @"", @"[b] Use single star for bold marker");
PRINT_USAGE(@" ", kGBArgMergeCategoriesToClasses, @"", @"[b] Merge categories to classes");
+ PRINT_USAGE(@" ", kGBArgMergeCategoryComment, @"", @"[b] Merge category comment to class");
PRINT_USAGE(@" ", kGBArgKeepMergedCategoriesSections, @"", @"[b] Keep merged categories sections");
PRINT_USAGE(@" ", kGBArgPrefixMergedCategoriesSectionsWithCategoryName, @"", @"[b] Prefix merged sections with category name");
PRINT_USAGE(@" ", kGBArgExplicitCrossRef, @"", @"[b] Shortcut for explicit default cross ref template");
View
8 Application/GBApplicationSettingsProvider.h
@@ -296,6 +296,14 @@ extern id kGBCustomDocumentIndexDescKey;
*/
@property (assign) BOOL mergeCategoriesToClasses;
+/** Indicates wheter category comment should be merged to the end of the class comment or not.
+
+ This is only applicable if `mergeCategoriesToClasses` is `YES`.
+
+ @see mergeCategoriesToClasses
+ */
+@property (assign) BOOL mergeCategoryCommentToClass;
+
/** Indicates whether category or extension sections should be preserved when merging into extended class.
If `YES`, all the sections from category or extension documentation are preserved. In such case, `prefixMergedCategoriesSectionsWithCategoryName` may optionally be used to prefix section name with category name or not. If `NO`, category or extension sections are ignored and a single section with category name is created in the class.
View
2  Application/GBApplicationSettingsProvider.m
@@ -95,6 +95,7 @@ - (id)init {
self.exitCodeThreshold = 0;
self.mergeCategoriesToClasses = YES;
+ self.mergeCategoryCommentToClass = YES;
self.keepMergedCategoriesSections = NO;
self.prefixMergedCategoriesSectionsWithCategoryName = NO;
@@ -606,6 +607,7 @@ - (NSString *)versionIdentifier {
@synthesize findUndocumentedMembersDocumentation;
@synthesize mergeCategoriesToClasses;
+@synthesize mergeCategoryCommentToClass;
@synthesize keepMergedCategoriesSections;
@synthesize prefixMergedCategoriesSectionsWithCategoryName;
View
2  Application/GBApplicationStringsProvider.m
@@ -139,7 +139,7 @@ - (NSDictionary *)appledocData {
result = [[NSMutableDictionary alloc] init];
[result setObject:@"appledoc" forKey:@"tool"];
[result setObject:@"2.0.5" forKey:@"version"];
- [result setObject:@"764" forKey:@"build"];
+ [result setObject:@"765" forKey:@"build"];
[result setObject:@"http://appledoc.gentlebytes.com" forKey:@"homepage"];
}
return result;
View
10 Processing/GBProcessor.m
@@ -375,6 +375,16 @@ - (void)mergeKnownCategoriesFromStore {
}
}
+ // Append category comment to class.
+ if (self.settings.mergeCategoryCommentToClass && [category.comment.stringValue length] > 0) {
+ GBLogDebug(@"Merging category %@ comment to class...", category);
+ if ([class.comment.stringValue length] > 0) {
+ class.comment.stringValue = [NSString stringWithFormat:@"%@\n%@", class.comment.stringValue, category.comment.stringValue];
+ } else {
+ class.comment = category.comment;
+ }
+ }
+
// Finally clean all empty sections and remove merged category from the store.
[class.methods unregisterEmptySections];
[self.store unregisterTopLevelObject:category];
View
9 Testing/GBApplicationTesting.m
@@ -284,6 +284,15 @@ - (void)testMergeCategoriesToClasses_shouldAssignValueToSettings {
assertThatBool(settings2.mergeCategoriesToClasses, equalToBool(NO));
}
+- (void)testMergeCategoryCommentToClass_shouldAssignValueToSettings {
+ // setup & execute
+ GBApplicationSettingsProvider *settings1 = [self settingsByRunningWithArgs:@"--merge-category-comment", nil];
+ GBApplicationSettingsProvider *settings2 = [self settingsByRunningWithArgs:@"--no-merge-category-comment", nil];
+ // verify
+ assertThatBool(settings1.mergeCategoryCommentToClass, equalToBool(YES));
+ assertThatBool(settings2.mergeCategoryCommentToClass, equalToBool(NO));
+}
+
- (void)testKeepMergedCategoriesSections_shouldAssignValueToSettings {
// setup & execute
GBApplicationSettingsProvider *settings1 = [self settingsByRunningWithArgs:@"--keep-merged-sections", nil];
Please sign in to comment.
Something went wrong with that request. Please try again.