Permalink
Browse files

-writeElement:idName:className:content: convenience.

  • Loading branch information...
1 parent 7c2e9f3 commit bc8ed57f39ea109ef6e5ed0f32bcf1d0b35a2dd5 @mikeabdullah mikeabdullah committed Dec 13, 2011
Showing with 10 additions and 5 deletions.
  1. +2 −5 KSHTMLWriter.h
  2. +8 −0 KSHTMLWriter.m
View
@@ -79,12 +79,9 @@ extern NSString *KSHTMLWriterDocTypeHTML_5;
// <tagName id="idName" class="className">
// Pretty standard convenience methods
-
+- (void)writeElement:(NSString *)name idName:(NSString *)idName className:(NSString *)className content:(void (^)(void))content;
- (void)startElement:(NSString *)tagName className:(NSString *)className;
-
-- (void)startElement:(NSString *)tagName
- idName:(NSString *)idName
- className:(NSString *)className;
+- (void)startElement:(NSString *)tagName idName:(NSString *)idName className:(NSString *)className;
- (BOOL)isIDValid:(NSString *)anID; // NO if the ID has already been used
View
@@ -176,6 +176,14 @@ - (void)writeHTMLFormat:(NSString *)format , ...
#pragma mark General
+- (void)writeElement:(NSString *)name idName:(NSString *)idName className:(NSString *)className content:(void (^)(void))content;
+{
+ if (idName) [self pushAttribute:@"id" value:idName];
+ if (className) [self pushAttribute:@"class" value:className];
+
+ [self writeElement:name content:content];
+}
+
- (void)startElement:(NSString *)tagName className:(NSString *)className;
{
[self startElement:tagName idName:nil className:className];

0 comments on commit bc8ed57

Please sign in to comment.