smu

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

commit 44bcd35d56ff5bc59e6ef554298efe49b1237b45
parent f6967fe5819b82c722fe4270c55f1ea1cb9c7fae
Author: gottox@rootkit.lan <gottox@rootkit.lan>
Date:   Mon, 14 Jan 2008 13:52:56 +0100

<hr /> is now more proper.

Diffstat:
Msmu.c | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/smu.c b/smu.c @@ -50,8 +50,8 @@ void hprint(const char *begin, const char *end); /* escapes HTML and prints it t void process(const char *begin, const char *end, int isblock); /* Processes range between begin and end. */ -Parser parsers[] = { doreplace, dounderline, dohtml, dolineprefix, dolist, doparagraph, - dogtlt, dosurround, dolink, doshortlink, doamp }; +Parser parsers[] = { dounderline, dohtml, dolineprefix, dolist, doparagraph, + dogtlt, dosurround, dolink, doshortlink, doamp, doreplace }; /* list of parsers */ FILE *source; unsigned int nohtml = 0; @@ -175,12 +175,16 @@ dolineprefix(const char *begin, const char *end, int newblock) { continue; if(strncmp(lineprefix[i].search, p, l)) continue; + if(*begin == '\n') + fputc('\n', stdout); + fputs(lineprefix[i].before, stdout); + if(lineprefix[i].search[l-1] == '\n') { + fputc('\n', stdout); + return l; + } if(!(buffer = malloc(BUFFERSIZE))) eprint("Malloc failed."); buffer[0] = '\0'; - if(*begin == '\n') - fputs("\n", stdout); - fputs(lineprefix[i].before, stdout); for(j = 0, p += l; p < end; p++, j++) { ADDC(buffer, j) = *p; if(*p == '\n' && p + l < end) {