Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convenience method for writing standard HTML document structure.

  • Loading branch information...
commit 73124a427432074ca876e73793697491654169be 1 parent 2bdd247
@mikeabdullah mikeabdullah authored
Showing with 18 additions and 0 deletions.
  1. +6 −0 KSHTMLWriter.h
  2. +12 −0 KSHTMLWriter.m
View
6 KSHTMLWriter.h
@@ -89,6 +89,12 @@ extern NSString *KSHTMLWriterDocTypeHTML_5;
- (BOOL)isIDValid:(NSString *)anID; // NO if the ID has already been used
+#pragma mark Document
+// Convenience to give you standard document structure
+// head is optional
+- (void)writeDocumentOfType:(NSString *)docType encoding:(NSStringEncoding)encoding head:(void (^)(void))headBlock body:(void (^)(void))bodyBlock;
+
+
#pragma mark Line Break
// <br /> OR <br>
// depends on isXHTML
View
12 KSHTMLWriter.m
@@ -224,6 +224,18 @@ - (BOOL)isIDValid:(NSString *)anID; // NO if the ID has already been used
return result;
}
+#pragma mark Document
+
+- (void)writeDocumentOfType:(NSString *)docType encoding:(NSStringEncoding)encoding head:(void (^)(void))headBlock body:(void (^)(void))bodyBlock;
+{
+ [self startDocumentWithDocType:docType encoding:encoding];
+
+ [self writeElement:@"html" content:^{
+ if (headBlock) [self writeElement:@"head" content:headBlock];
+ [self writeElement:@"body" content:bodyBlock];
+ }];
+}
+
#pragma mark Line Break
- (void)writeLineBreak;
Please sign in to comment.
Something went wrong with that request. Please try again.