aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe little girl <yui@blekksprut.net>2014-06-06 17:43:22 +0200
committerthe little girl <yui@blekksprut.net>2014-06-06 17:43:22 +0200
commit104dfc911b9ddb984fd6f9c0886b174b03208850 (patch)
tree5731252fa7d1a3fdd2960bffcdf92065731f1929
parentac0cdaf7a3db5c23ecfc0a844c1bd4daec160e04 (diff)
downloadukulele-104dfc911b9ddb984fd6f9c0886b174b03208850.tar.xz
include + pre
-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);
}