Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple template engine for Objective-C
Objective-C C
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
ObjCtpl.xcodeproj
.gitignore
ObjCtpl.1
ObjCtpl.m
ObjCtplBlock.h
ObjCtplBlock.m
ObjCtplParser.h
ObjCtplParser.m
ObjCtpl_Prefix.pch
README

README

 _____   __           ____     __            ___      
/\  __`\/\ \       __/\  _`\  /\ \__        /\_ \     
\ \ \/\ \ \ \____ /\_\ \ \/\_\\ \ ,_\  _____\//\ \    
 \ \ \ \ \ \ '__`\\/\ \ \ \/_/_\ \ \/ /\ '__`\\ \ \   
  \ \ \_\ \ \ \L\ \\ \ \ \ \L\ \\ \ \_\ \ \L\ \\_\ \_ 
   \ \_____\ \_,__/_\ \ \ \____/ \ \__\\ \ ,__//\____\
    \/_____/\/___//\ \_\ \/___/   \/__/ \ \ \/ \/____/
                  \ \____/               \ \_\        
                   \/___/                 \/_/        

This project attempts to recreate the functionality given by
Jtpl (http://jtpl.sourceforge.net/).

How to use:
You only need the following files in your project to use ObjCtpl:
* ObjCtplParser (.h and .m)
* ObjCtplBlock (.h and .m)

Make sure the following is in the file you are going to be parsing with:
#include ObjCtpl.h

Then setup your instance of the class:
ObjCtplParser *p = [[ObjCtplParser alloc] initWithHTML:HTML_STRING];

Next set your variables:
[p setVar:@"WEBSITE" withValue:@"www.google.com"];
[p setVar:@"NAME" withValue:@"test name"];
[p setVar:@"EMAIL" withValue:@"joe@test.com"]

And then parse the blocks:
[p parse:@"main.email"];
[p parse:@"main.phone"];
[p parse:@"main.website"];
[p parse:@"main"];

To retrieve the completed output, call:
[p output]

IMPORTANT:  The beginning and end block syntax included in the HTML
template IS dependant on whitespace.
<!-- BEGIN: block_name -->
<!-- END: block_name -->

Searching via regular expressions is only available in iOS 3.2 or higher,
so to allow more compatability I am not using that function as of now.
Something went wrong with that request. Please try again.