From 7d3b0b917cdb93d249dc356db8471fe9e6863424 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 5 Dec 2018 18:42:19 -0500 Subject: Added more documentation Added documentation for each function in the include/ctemplates.h file Also did some spellchecking on the readme. --- README.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index f23ad85..1f2c740 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ If you found this page using a search engine, you may be looking for the original [libctemplate](http://libctemplate.sourceforge.net) by Stephen C. Losen libctemplates is a template expander written for use with HTML. It's goals are -to be simple, versitile, and fast. This library started off as a +to be simple, versatile, and fast. This library started off as a fork of libctemplate, but eventually became a total rewrite. libctemplate, the original, was built primarily for cgi applications. libctemplate was tightly coupled with file streams, while libctemplate**S** renders templates to @@ -12,22 +12,20 @@ strings for use in any application, FastCGI or [Kore](kore.io), for example. If you think libctemplates is missing a feature, feel free to suggest it to [alex@cogarr.net](mailto://alex@cogarr.net), or, even better, write it yourself and send the patch! You can find -instructions on createing and sending git patches [here](http://cogarr.net/source/cgit.cgi/?p=about). +instructions on creating and sending git patches [here](http://cogarr.net/source/cgit.cgi/?p=about). ## Contents 1. [Installation](#Installation) 2. [Usage](#Usage) -3. [Quick refrence](#Quick refernce) +3. [Quick reference](#Quick refernce) 4. [Examples](#Examples) - -
## Installation Run the make file. libctemplates should compile on any system with a c99 -complient c compiler. If you are on linux, run +complaint c compiler. If you are on linux, run make; make install @@ -40,7 +38,7 @@ libctemplates.a, for example: gcc main.c -lctemplates
-## Quick refrence +## Quick reference ### Structs @@ -50,7 +48,7 @@ libctemplates.a, for example: Holds a list of variables to be used when rendering a template loops can be held in a varlist, and varlists can be held in loops. * struct TMPL\_loop - Used to defien things to loop through in a varlist. + Used to define things to loop through in a varlist. ### Functions @@ -94,7 +92,7 @@ Adds a varlist that should be used one iteration through the loop char* TMPL_render(struct TMPL_templates* t, struct TMPL_varlist* vl, size_t* length) -Turns a template and varlist into a string. the returned char\* should NOT be freed. The returned char\* is only valid until TMPL\_render() is called again. If you need it even after TMPL\_render() is called, copy it. The length of the returned string is put into `length` to help in copying. +Turns a template and varlist into a string. The returned char\* should NOT be freed. The returned char\* is only valid until TMPL\_render() is called again. If you need it even after TMPL\_render() is called, copy it. The length of the returned string is put into `length` to help in copying. ### Templating tags @@ -114,7 +112,7 @@ Prints the variable named "variable\_name" in it's place, if no variable named " Branching statements, checks if a variable is equal to a constant value. -Checks if the variable "variable\_name" contains the string "check\_value". There is currently no way to check if two variables are equal. Elseif and Else clauses are optional. All `TMPL_IF` statements must be closed with `TMPL_END`. You can use `TMPL_IF` and `TMPL_ELSEIF` to check for a variable's existance by not specifying a `value` parameter. +Checks if the variable "variable\_name" contains the string "check\_value". There is currently no way to check if two variables are equal. Elseif and Else clauses are optional. All `TMPL_IF` statements must be closed with `TMPL_END`. You can use `TMPL_IF` and `TMPL_ELSEIF` to check for a variable's existence by not specifying a `value` parameter. : @@ -327,7 +325,7 @@ a minifier! Just a template expander! ### Loops Loops are special in libctemplates, loops each have their own namespace, and -only variables that have been added to the namespace are acessable in the loop. +only variables that have been added to the namespace are accessible in the loop. *template.html* @@ -411,7 +409,7 @@ only variables that have been added to the namespace are acessable in the loop. This time through the loop, my variable is theird Done! - +