diff options
author | the little girl <yui@blekksprut.net> | 2014-06-06 17:43:22 +0200 |
---|---|---|
committer | the little girl <yui@blekksprut.net> | 2014-06-06 17:43:22 +0200 |
commit | 104dfc911b9ddb984fd6f9c0886b174b03208850 (patch) | |
tree | 5731252fa7d1a3fdd2960bffcdf92065731f1929 | |
parent | ac0cdaf7a3db5c23ecfc0a844c1bd4daec160e04 (diff) | |
download | ukulele-104dfc911b9ddb984fd6f9c0886b174b03208850.tar.xz |
include + pre
-rw-r--r-- | wiki.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -229,6 +229,9 @@ int text(char *path, char *type) { void include(FILE *out, char *path) { struct stat s; + int plain = 0; + if(*path == 't') + plain = 1, path++; while(isspace(*path)) path++; if(!legit(path)) return; if(*path == '/') return; @@ -239,7 +242,21 @@ void include(FILE *out, char *path) { } FILE *fp = fopen(path, "r"); if(!fp) return; - marxup(fp, out, NULL); + if(plain) { + printf("<pre>"); + int c; + while((c = fgetc(fp)) != EOF) { + switch(c) { + case '&': printf("&"); break; + case '<': printf("<"); break; + case '>': printf(">"); break; + default: putc(c, stdout); + } + } + printf("</pre>"); + } else { + marxup(fp, out, NULL); + } fclose(fp); } |