aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wiki.c19
1 files changed, 18 insertions, 1 deletions
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("<pre>");
+ int c;
+ while((c = fgetc(fp)) != EOF) {
+ switch(c) {
+ case '&': printf("&amp;"); break;
+ case '<': printf("&lt;"); break;
+ case '>': printf("&gt;"); break;
+ default: putc(c, stdout);
+ }
+ }
+ printf("</pre>");
+ } else {
+ marxup(fp, out, NULL);
+ }
fclose(fp);
}