aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2019-01-15 19:42:45 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2019-01-15 19:42:45 -0500
commita8ca001a8f811403bccffed03243954f5a52b27b (patch)
tree03c6ac85145afd4b2fd1079dd29a3a1ad0b74974
parent195c332a2314305392ee2a09272e3fbd4f1b134a (diff)
downloadlibctemplates-a8ca001a8f811403bccffed03243954f5a52b27b.tar.gz
libctemplates-a8ca001a8f811403bccffed03243954f5a52b27b.tar.bz2
libctemplates-a8ca001a8f811403bccffed03243954f5a52b27b.zip
Spelling corrections
Corrected a bunch of spelling mistakes in the readme and the Makefile
-rw-r--r--Makefile11
-rw-r--r--README.md27
2 files changed, 23 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 38e220e..3738077 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ objfiles = $(objs:%=build/%.o)
TEST_1_NAME = t/test_1$(BIN_POSTFIX)
+TEST_2_NAME = t/test_2$(BIN_POSTFIX)
$(LIBNAME): $(objfiles)
ar rc $@ $^
@@ -26,10 +27,14 @@ clean:
$(RM) build/*.o *.a $(LIBNAME)
$(TEST_1_NAME): t/test_1.c $(LIBNAME)
- $(CC) $(CFLAGS) -o $(TEST_1_NAME) t/test_1.c -lctemplates
+ $(CC) $(CFLAGS) -o $@ $< -lctemplates
-test: $(TEST_1_NAME)
- $(TEST_1_NAME)
+$(TEST_2_NAME): t/test_2.c $(LIBNAME)
+ $(CC) $(CFLAGS) -o $@ $< -lctemplates
+
+test: $(TEST_1_NAME) $(TEST_2_NAME)
+ #$(TEST_1_NAME)
+ $(TEST_2_NAME)
install: $(LIBNAME)
cp $(LIBNAME) /usr/local/lib
diff --git a/README.md b/README.md
index 1f2c740..043aca3 100644
--- a/README.md
+++ b/README.md
@@ -18,16 +18,16 @@ instructions on creating and sending git patches [here](http://cogarr.net/source
1. [Installation](#Installation)
2. [Usage](#Usage)
-3. [Quick reference](#Quick refernce)
+3. [Quick reference](#Quick refrence)
4. [Examples](#Examples)
<section id="Installation"></section>
## Installation
Run the make file. libctemplates should compile on any system with a c99
-complaint c compiler. If you are on linux, run
+complaint c compiler. If you are on linux, cd into the root directory and run
- make; make install
+ make && make install
<section id="Usage"></section>
## Usage
@@ -45,8 +45,8 @@ libctemplates.a, for example:
* struct TMPL\_templates
Holds a template
* struct TMPL\_varlist
- 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.
+ 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 define things to loop through in a varlist.
@@ -56,7 +56,9 @@ libctemplates.a, for example:
Creates a template from the given string. This can be pretty expensive
so try to only do it once for each template you need, and call render()
-as many times as you need on that template.
+as many times as you need on that template. If there was a problem building
+the template, the returned `template->error` will be non-zero, and you can
+retrive an error message with `TMPL_err()`
void TMPL_free_template(struct TMPL_templates* template)
@@ -171,8 +173,8 @@ For example:
int main(){
/*
It usually helps to seperate the template from the
- C code. It does mean to need to read in a file though.
- Try to only call TMPL_alloc_template once for each
+ C code. You need to read in a file though.
+ Try to only call TMPL_alloc_template() once for each
template you have, and then use TMPL_render() whenever
you need to use them.
*/
@@ -192,9 +194,10 @@ For example:
/*
Render the template without a variable named "varname"
This will use the variable's default, if it has one.
- If the variable has no default, and is not supplied a value,
- it errors, and stores a message that can be retrived with
- TMPL_get_error(...)
+ If the variable has no default and is not supplied a value,
+ it subsitutes an empty string and logs an error message. You
+ can check for error messages by checking if template->error is
+ non-zero. You can retrive error messages with TMPL_get_error()
*/
t = TMPL_alloc_template(template);
vl = TMPL_alloc_varlist();
@@ -206,7 +209,7 @@ For example:
/*
Now render a template with a variable, use the
- TMPL_add_var_to_varlist(...) to supply the template with
+ TMPL_add_var_to_varlist() to supply the template with
variables.
*/
t = TMPL_alloc_template(template);