Skip to content

Commit

Permalink
Expose -className.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeabdullah committed Jul 27, 2010
1 parent 8783f1f commit ecfabe0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions KSHTMLWriter.h
Expand Up @@ -36,6 +36,7 @@
#pragma mark CSS Class Name
// Class names are accumulated and written automatically as an attribute of the next element started
- (void)addClassName:(NSString *)className;
- (NSString *)className;


#pragma mark HTML Fragments
Expand Down
14 changes: 12 additions & 2 deletions KSHTMLWriter.m
Expand Up @@ -59,6 +59,16 @@ - (void)addClassName:(NSString *)className;
[_classNames addObject:className];
}

- (NSString *)className;
{
NSString *result = nil;
if ([_classNames count])
{
result = [_classNames componentsJoinedByString:@" "];
}
return result;
}

#pragma mark HTML Fragments

- (void)writeHTMLString:(NSString *)html;
Expand Down Expand Up @@ -294,9 +304,9 @@ - (BOOL)canWriteElementInline:(NSString *)tagName;
- (void)startElement:(NSString *)elementName writeInline:(BOOL)writeInline; // for more control
{
// Add in any pre-written classes
if ([_classNames count])
NSString *class = [self className];
if (class)
{
NSString *class = [_classNames componentsJoinedByString:@" "];
[_classNames removeAllObjects];
[self addElementAttribute:@"class" value:class];
}
Expand Down

0 comments on commit ecfabe0

Please sign in to comment.