Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pyro2927/objctpl
Simple template engine for Objective-C
https://github.com/pyro2927/objctpl
Last synced: about 17 hours ago
JSON representation
Simple template engine for Objective-C
- Host: GitHub
- URL: https://github.com/pyro2927/objctpl
- Owner: pyro2927
- Created: 2010-10-04T17:14:50.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2011-03-24T19:41:34.000Z (over 13 years ago)
- Last Synced: 2024-05-02T00:07:31.293Z (7 months ago)
- Language: Objective-C
- Homepage:
- Size: 129 KB
- Stars: 4
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
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.hThen 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:@"[email protected]"]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.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.