Sun Apr 10 21:36:46 GMT 2005 -- uriel Various fixes and improvements to wikifs: - Handle https: links properly - Handle #relative links, this is really needed for the FAQ page and others, it works only in the web interface but I'm working on support for it in Wiki, but it's not a big deal anyway. - Convert lines of the form /^-----*$/ to
in html and to an standard number of - in acme; this is very useful and will make the "Tip'o Day" page look much better right away. - Use real headers instead of hacked up font hacks, also generate anchors for them so they can be references with #rel links. This is the first step of the sanitization of the wiki HTML. Reference: /n/sources/patch/applied/wikifs-hr-rellinks-html-fixes Date: Sun Apr 10 23:41:27 CES 2005 --- /sys/src/cmd/wikifs/tohtml.c Sun Apr 10 23:35:54 2005 +++ /sys/src/cmd/wikifs/tohtml.c Sun Apr 10 23:35:48 2005 @@ -151,6 +151,8 @@ char *p, *q; if(strncmp(s, "http:", 5)==0 + || strncmp(s, "https:", 6)==0 + || strncmp(s, "#", 1)==0 || strncmp(s, "ftp:", 4)==0 || strncmp(s, "mailto:", 7)==0 || strncmp(s, "telnet:", 7)==0 @@ -189,11 +191,13 @@ for(w=wtxt; w; w=w->next){ switch(w->type){ case Wheading: + /* if(!inpara){ inpara = 1; s = s_append(s, "\n

\n"); - } - s = s_appendlist(s, "", w->text, "\n

\n", nil); + } + */ + s = s_appendlist(s, "
\ntext,"\" />

", w->text, "

\n", nil); break; case Wpara: @@ -265,6 +269,10 @@ s = s_escappend(s, w->text, 1); s = s_append(s, "\n"); break; + + case Whr: + s = s_append(s, "
"); + break; case Wplain: if(inpre){ @@ -684,6 +692,10 @@ inpara = 0; s_endline(s, dosharp); s = s_appendlist(s, "! ", w->text, "\n", sharp, nil); + break; + case Whr: + s_endline(s, dosharp); + s = s_appendlist(s, "------------------------------------------------------ \n", sharp, nil); break; case Wplain: --- /sys/src/cmd/wikifs/parse.c Sun Apr 10 23:36:19 2005 +++ /sys/src/cmd/wikifs/parse.c Sun Apr 10 23:36:15 2005 @@ -227,7 +227,7 @@ Wpage* Brdpage(char *(*rdline)(void*,int), void *b) { - char *p; + char *p, *c; int waspara; Wpage *w, **pw; @@ -257,6 +257,20 @@ *pw = mkwtxt(Wpre, estrdup(p[1]==' '?p+2:p+1)); pw = &(*pw)->next; break; + case '-': + for(c = p; *c != '\0'; c++) { + if(*c != '-') { + c = p; + break; + } + } + + if( (c-p) > 4) { + *pw = mkwtxt(Whr, nil); + pw = &(*pw)->next; + break; + } + /* else fall thru */ default: if(isheading(p)){ *pw = mkwtxt(Wheading, estrdup(p)); @@ -301,6 +315,9 @@ break; case Wplain: print("plain '%s'\n", w->text); + break; + case Whr: + print("hr\n"); break; case Wpre: print("pre '%s'\n", w->text);