Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Classes/Core/HSKBItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


#import <Foundation/Foundation.h>

#import <MMMarkdown/MMMarkdown.h>

typedef NS_OPTIONS(NSUInteger, HSKBItemType) {
HSKBItemTypeArticle = 0,
Expand Down Expand Up @@ -56,6 +56,7 @@ typedef NS_OPTIONS(NSUInteger, HSKBItemType) {
*/
- (id)initAsArticle:(NSString*)title textContent:(NSString*)content kbID:(NSString*)kbID;
- (id)initAsArticle:(NSString*)title htmlContent:(NSString*)content baseUrl:(NSString*)baseUrl kbID:(NSString*)kbID;
- (id)initAsArticle:(NSString*)title markdownContent:(NSString*)content baseUrl:(NSString*)baseUrl kbID:(NSString*)kbID;

/**
Kb will be prepared with given title, content and id, its type will be set as Section.
Expand Down
12 changes: 12 additions & 0 deletions Classes/Core/HSKBItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ - (id)initAsArticle:(NSString*)title htmlContent:(NSString*)content baseUrl:(NSS
return self;
}

- (id)initAsArticle:(NSString*)title markdownContent:(NSString*)content baseUrl:(NSString*)baseUrl kbID:(NSString*)kbID
{
if(self = [super init]) {
self.title = title;
self.htmlContent = [MMMarkdown HTMLStringWithMarkdown:content extensions:MMMarkdownExtensionsGitHubFlavored error:NULL];
self.baseUrl = baseUrl;
self.itemType = HSKBItemTypeArticle;
self.kb_id = kbID;
}
return self;
}

- (id)initAsSection:(NSString*)title kbID:(NSString*)kbID{
if(self = [super init]) {
self.title = title;
Expand Down
9 changes: 8 additions & 1 deletion Classes/Core/HSKBSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,14 @@ - (void)readKBArticleFromLocalPList:(void (^)(void))success failure:(void (^)(NS


for (NSDictionary *object in articleDict) {
HSKBItem* kb = [[HSKBItem alloc] initAsArticle:[object objectForKey:@"title"] textContent:[object objectForKey:@"content"] kbID:nil];
HSKBItem* kb = [HSKBItem alloc];
if ([object objectForKey:@"html"] != nil) {
kb = [[HSKBItem alloc] initAsArticle:[object objectForKey:@"title"] htmlContent:[object objectForKey:@"html"] baseUrl:@"" kbID:nil];
} else if ([object objectForKey:@"markdown"] != nil) {
kb = [[HSKBItem alloc] initAsArticle:[object objectForKey:@"title"] markdownContent:[object objectForKey:@"markdown"] baseUrl:@"" kbID:nil];
} else {
kb = [[HSKBItem alloc] initAsArticle:[object objectForKey:@"title"] textContent:[object objectForKey:@"content"] kbID:nil];
}
[articles addObject:kb];
}

Expand Down
1 change: 1 addition & 0 deletions HelpStack.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/happyfoxinc/helpstack.git", :tag => "1.1.1", :submodules => true }
s.resources = ['Resources/*.png','Resources/*.storyboard']
s.dependency 'AFNetworking', '~> 2.0'
s.dependency 'MMMarkdown', '~> 0.5'
s.frameworks = 'UIKit', 'CoreGraphics'
s.requires_arc = true

Expand Down