Created
February 23, 2018 17:39
-
-
Save mulle-nat/bfc82ed7822a823c0357179d92a3f835 to your computer and use it in GitHub Desktop.
MulleScion bidirectional
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Allow bidirectional communication with the template. After the template has run, you can pick out | |
// the global variables from `variables`. Might do this as a "standard" in the next version | |
// | |
@implementation MulleScionTemplate( VariableIO) | |
- (NSString *) descriptionWithTemplateFile:(NSObject <MulleScionStringOrURL> *) filename | |
dataSource:(id) dataSource | |
readWriteVariables:(NSMutableDictionary *) variables | |
{ | |
MulleScionTemplate *template; | |
NSAutoreleasePool *pool; | |
NSMutableDictionary *tmp; | |
NSMutableString *output; | |
template = [[[MulleScionTemplate alloc] initWithContentsOfFile:filename] autorelease]; | |
if( ! template) | |
return( nil); | |
pool = [NSAutoreleasePool new]; | |
{ | |
output = [[NSMutableString alloc] initWithCapacity:0x8000]; | |
tmp = [template localVariablesWithDefaultValues:variables]; | |
[variables setDictionary:tmp]; | |
[template renderInto:output | |
localVariables:variables | |
dataSource:dataSource]; | |
} | |
[pool release]; | |
return( [output autorelease]); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment