Skip to content

Commit

Permalink
Account for indentation level in -writeHTMLString:
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeabdullah committed Jun 1, 2012
1 parent 12b9584 commit 6bfd659
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions KSHTMLWriter.h
Expand Up @@ -71,6 +71,7 @@ extern NSString *KSHTMLWriterDocTypeHTML_5;




#pragma mark HTML Fragments #pragma mark HTML Fragments
// Any newlines in the HTML will be adjusted to account for current indentation level, but that's all
- (void)writeHTMLString:(NSString *)html; - (void)writeHTMLString:(NSString *)html;
- (void)writeHTMLFormat:(NSString *)format , ...; - (void)writeHTMLFormat:(NSString *)format , ...;


Expand Down
10 changes: 10 additions & 0 deletions KSHTMLWriter.m
Expand Up @@ -162,6 +162,16 @@ - (BOOL)hasCurrentAttributes;


- (void)writeHTMLString:(NSString *)html; - (void)writeHTMLString:(NSString *)html;
{ {
NSUInteger indent = [self indentationLevel];
if (indent)
{
NSString *indentedNewline = [@"\n" stringByPaddingToLength:indent + 1
withString:@"\t"
startingAtIndex:0];

html = [html stringByReplacingOccurrencesOfString:@"\n" withString:indentedNewline];
}

[self writeString:html]; [self writeString:html];
} }


Expand Down

0 comments on commit 6bfd659

Please sign in to comment.