summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xa.outbin21132 -> 21132 bytes
-rw-r--r--assets/content/global.bvr20
-rw-r--r--assets/layout/html/krneki.bvr1
-rw-r--r--src/bvr.h3
-rw-r--r--src/bvrcommands.c28
-rw-r--r--test/tape-test.bvr22
-rw-r--r--tmp/output.htm39
7 files changed, 66 insertions, 47 deletions
diff --git a/a.out b/a.out
index 813e70e..4fc861c 100755
--- a/a.out
+++ b/a.out
Binary files differ
diff --git a/assets/content/global.bvr b/assets/content/global.bvr
index 5fc4dbf..1fbd141 100644
--- a/assets/content/global.bvr
+++ b/assets/content/global.bvr
@@ -1,21 +1,21 @@
# max 128 characters
-<@?s site_name=Anton Luka Šijanec@>
+<@?s site_name Anton Luka Šijanec@>
# max 2 characters
-<@?s site_language=sl@>
+ <@?s site_language sl@>
# max 128 characters
-<@?s site_description=Moj osebni blog.@>
+<@?s site_description Moj osebni blog.@>
# max 32, max 64 characters per entry
-<@?s featured_links=posts/about,posts/contact,posts/sample-post@>
+ <@?s featured_links posts/about posts/contact posts/sample-post@>
# max 64 characters or latest-posts
-<@?s index_page=pages/about@>
+<@?s index_page pages/about@>
# centered paragraph width. Can be 1, 2, 3, 4; 5 means text is left centered.
-<@?s content_width=8@>
+<@?s content_width 8@>
# hour offset to format dates with. NOTE: 11 is subtracted to this value. GMT is then 11, Ljubljana is then 13
-<@?s timezone=13@>
+<@?s timezone 13@>
# what folders to copy from layout to dist (such as fonts)
-<@?s copy_folders=fonts,media@>
-# path, where bvr files will be searched for
-<@?s bvr_include_path assets/content/;assets/content/posts/;assets/layout/;assets/content/html/@>
+<@?s copy_folders fonts,media@>
+# path, where bvr files will be searched for. split with spaces.
+<@?s bvr_include_path assets/content/ assets/content/posts/ assets/layout/ assets/layout/html/ test/@>
# post-specific variables --- you should set them now. unset variables may cause problems --- they return BVR_UNDEFINED
<@?s post_description Unset description.@>
<@?s post_author anonymous@>
diff --git a/assets/layout/html/krneki.bvr b/assets/layout/html/krneki.bvr
new file mode 100644
index 0000000..df6cd9f
--- /dev/null
+++ b/assets/layout/html/krneki.bvr
@@ -0,0 +1 @@
+krneki123
diff --git a/src/bvr.h b/src/bvr.h
index a2bfe00..55b27de 100644
--- a/src/bvr.h
+++ b/src/bvr.h
@@ -26,7 +26,8 @@ int bvr_bvrvar_first_time_set = 1;
#define BVR_VER_MINOR 1
#define BVR_VER_PATCH 0
-#define BVR_PATH_SEPARATOR ';'
+#define BVR_PATH_SEPARATOR ' '
#define BVR_INCLUDE_PATH_VAR_NAME "bvr_include_path"
+#define BVR_COMMAND_FILE_EXT ".bvr"
int bvr_compose_stream(FILE *, FILE *);
diff --git a/src/bvrcommands.c b/src/bvrcommands.c
index 747c757..aac4800 100644
--- a/src/bvrcommands.c
+++ b/src/bvrcommands.c
@@ -60,24 +60,34 @@ int bvr_handle_include(FILE * input, FILE * output) {
FILE * stream = fopen(item, "r");
char notgoodatnamingvariables[PATH_MAX];
char * path = bvr_var_get(BVR_INCLUDE_PATH_VAR_NAME);
- if(strcmp(path, BVR_UNDEFINED) == 0 && stream == NULL) {
- fprintf(output, "\nbVerbose include error. File %s not found. Path is undefined.\n", item);
- fprintf(stderr, "[bvrcommands.c] bvr_handle_include: File %s not found. Path is undefined.\n", item);
- return FAILURE;
+ if(stream == NULL) {
+ strcpy(notgoodatnamingvariables, item);
+ strcat(notgoodatnamingvariables, BVR_COMMAND_FILE_EXT);
+ stream = fopen(notgoodatnamingvariables, "r");
+ if(strcmp(path, BVR_UNDEFINED) == 0 && stream == NULL) {
+ fprintf(output, "\nbVerbose include error. File %s not found. Path is undefined.\n", item);
+ fprintf(stderr, "[bvrcommands.c] bvr_handle_include: File %s not found. Path is undefined.\n", item);
+ return FAILURE;
+ }
}
char * singlepath;
while(stream == NULL) {
singlepath = strrchr(path, BVR_PATH_SEPARATOR);
- strcpy(notgoodatnamingvariables, singlepath);
- strcat(notgoodatnamingvariables, item);
- stream = fopen(notgoodatnamingvariables, "r");
- if(strrchr(path, BVR_PATH_SEPARATOR) == NULL) {
- stream = fopen(notgoodatnamingvariables, "r");
+ if(singlepath == NULL) {
+ stream = fopen(path, "r"); // ob1 fuckery
if(stream == NULL) {
fprintf(output, "\nbVerbose include error. File %s not found.\n", item);
fprintf(stderr, "[bvrcommands.c] bvr_handle_include: File %s not found.\n", item);
return FAILURE;
}
+ break;
+ }
+ strcpy(notgoodatnamingvariables, singlepath);
+ strcat(notgoodatnamingvariables, item);
+ stream = fopen(notgoodatnamingvariables+1, "r"); // ob1 fuckery
+ if(stream == NULL) {
+ strcat(notgoodatnamingvariables, BVR_COMMAND_FILE_EXT);
+ stream = fopen(notgoodatnamingvariables+1, "r"); // ob1 fuckery
}
*singlepath = '\0';
}
diff --git a/test/tape-test.bvr b/test/tape-test.bvr
index 3581604..1bf8761 100644
--- a/test/tape-test.bvr
+++ b/test/tape-test.bvr
@@ -1,11 +1,15 @@
-<@?i test/tape-test-to-include.bvr @>
-<@?g included_variable @>
-<@?s abc 1232@>
-<@?g abc@>
-<@?m abc bbc@>
-<@?g abc@>
-<@?g bbc@>
-hello?
+<@?i assets/content/global.bvr @>
+<@?i krneki@>
+# <@?g post_slug @>
+# <@?g bvr_include_path @>
+# <@?i tape-test-to-includes @>
+# <@?g included_variable @>
+# <@?s abc 1232@>
+# <@?g abc@>
+# <@?m abc bbc@>
+# <@?g abc@>
+# <@?g bbc@>
+# hello?
# <@?g abc@>
# <@?s abc 123@>
# <@?g abc@>
@@ -23,4 +27,4 @@ hello?
# <@?5 image@>
# <@?6 image@>
# <@?7 image@>
-in tako so srečno živeli do konca svojih dni!
+# in tako so srečno živeli do konca svojih dni!
diff --git a/tmp/output.htm b/tmp/output.htm
index b447744..b72385b 100644
--- a/tmp/output.htm
+++ b/tmp/output.htm
@@ -1,20 +1,23 @@
-including worked!
-included file:
-|
-| included variable set and read from included file
-|
-|
-|
-|
-|
-
-included variable set and read
-
-1232
-
-BVR_UNDEFINED
-1232
-hello?
-in tako so srečno živeli do konca svojih dni!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+krneki123
+