smu

Simple markup processor
git clone https://git.sinitax.com/codemadness/smu
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 53443f1d561b821f1e0cad5223ffacb3b0b1bd5c
parent 857be7fb4dcfd6a19f0e6d228f4095624c0a67e8
Author: gottox@rootkit.lan <gottox@rootkit.lan>
Date:   Tue, 11 Dec 2007 20:14:41 +0100

dolineprefix works now with doparagraph

Diffstat:
Mcmarkdown.c | 17++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/cmarkdown.c b/cmarkdown.c @@ -113,16 +113,19 @@ dolineprefix(const char *begin, const char *end) { if(*begin != '\n') return 0; + p = begin; + if(p[1] == '\n') + p++; for(i = 0; i < LENGTH(lineprefix); i++) { l = strlen(lineprefix[i].search); - if(end - begin+1 < l) + if(end - p+1 < l) continue; - if(strncmp(lineprefix[i].search,begin+1,l)) + if(strncmp(lineprefix[i].search,p+1,l)) continue; - if(!(buffer = malloc(end - begin+1))) + if(!(buffer = malloc(end - p+1))) eprint("Malloc failed."); - printf("<%s>",lineprefix[i].tag); - for(p = begin, j = 0; p != end; p++, j++) { + printf("\n<%s>",lineprefix[i].tag); + for(j = 0; p != end; p++, j++) { buffer[j] = *p; if(*p == '\n') { if(strncmp(lineprefix[i].search,p+1,l) != 0) @@ -134,7 +137,7 @@ dolineprefix(const char *begin, const char *end) { process(buffer,buffer+strlen(buffer)); else hprint(buffer,buffer+strlen(buffer)); - printf("</%s>",lineprefix[i].tag); + printf("</%s>\n",lineprefix[i].tag); free(buffer); return p - begin; } @@ -212,7 +215,7 @@ dolist(const char *begin, const char *end) { buffer[0] = '\0'; for(i = 0; *p && p != end && run; p++,i++) { if(*p == '\n') { - if(p[1] == '\n') { + if(p[1] == '\n' && p[2] == '\n') { run = 0; break; }