From 104dfc911b9ddb984fd6f9c0886b174b03208850 Mon Sep 17 00:00:00 2001 From: the little girl Date: Fri, 6 Jun 2014 17:43:22 +0200 Subject: include + pre --- wiki.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/wiki.c b/wiki.c index 32f9a82..f30c6c3 100644 --- a/wiki.c +++ b/wiki.c @@ -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("
");
+    int c;
+    while((c = fgetc(fp)) != EOF) {
+      switch(c) {
+        case '&': printf("&"); break;
+        case '<': printf("<"); break;
+        case '>': printf(">"); break;
+        default: putc(c, stdout);
+      }
+    }
+    printf("
"); + } else { + marxup(fp, out, NULL); + } fclose(fp); } -- cgit v1.0