diff options
author | Thomas White <taw@bitwiz.org.uk> | 2013-05-24 08:35:41 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2013-05-24 08:35:41 +0200 |
commit | 6647f70cb376a0b123f5c4665985b8c343f3e3c0 (patch) | |
tree | fb8fb375cb59322ff70bca46197495c6038da34c | |
parent | f0a7b2531afdbe630c42a4c5ac57f1a69c553212 (diff) |
Loading stuff
-rw-r--r-- | src/loadsave.c | 4 | ||||
-rw-r--r-- | src/stylesheet.c | 14 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/loadsave.c b/src/loadsave.c index 095c63e..0112f45 100644 --- a/src/loadsave.c +++ b/src/loadsave.c @@ -211,12 +211,12 @@ static void parse_line(struct ds_node *root, struct ds_node **cn, s_equals = i; h_equals = 1; } - if ( !h_openbracket && (line[i] == '[') ) { + if ( !h_openbracket && (line[i] == '[') && !h_equals ) { s_openbracket = i; h_openbracket = 1; } if ( h_openbracket && !h_closebracket - && (line[i] == ']') ) + && (line[i] == ']') && !h_equals ) { s_closebracket = i; h_closebracket = 1; diff --git a/src/stylesheet.c b/src/stylesheet.c index d48ed85..b6fec5c 100644 --- a/src/stylesheet.c +++ b/src/stylesheet.c @@ -99,6 +99,7 @@ StyleSheet *default_stylesheet() { char *v; struct ds_node *root; + struct ds_node *ss_root; StyleSheet *ss; size_t len; @@ -111,7 +112,14 @@ StyleSheet *default_stylesheet() root = new_ds_node("root"); deserialize_memory(v, root); - ss = tree_to_stylesheet(root); + + ss_root = find_node(root, "stylesheet", 0); + if ( ss_root == NULL ) { + fprintf(stderr, "Doesn't look like a stylesheet.\n"); + return NULL; + } + ss = tree_to_stylesheet(ss_root); + free_ds_tree(root); free(v); return ss; } @@ -170,9 +178,9 @@ StyleSheet *tree_to_stylesheet(struct ds_node *root) } - node = find_node(root, "bgblocks", 0); + node = find_node(root, "templates", 0); if ( node == NULL ) { - fprintf(stderr, "Couldn't find bgblocks\n"); + fprintf(stderr, "Couldn't find templates\n"); free_stylesheet(ss); return NULL; } |