diff options
-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); } |