smu

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

commit f7cd9bb5101e3565f6d78adbe8076b3f5cb798c3
parent 6a94a6b5ec892789d016af8fd6b99701182fd445
Author: gottox@rootkit.lan <gottox@rootkit.lan>
Date:   Tue,  1 Jan 2008 20:02:20 +0100

dolineprefix can now work without newblock

Diffstat:
Msmu.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/smu.c b/smu.c @@ -164,9 +164,12 @@ dolineprefix(const char *begin, const char *end, int newblock) { char *buffer; const char *p; - if(!newblock) + if(newblock) + p = begin; + else if(*begin == '\n') + p = begin + 1; + else return 0; - p = begin; for(i = 0; i < LENGTH(lineprefix); i++) { l = strlen(lineprefix[i].search); if(end - p < l) @@ -176,6 +179,8 @@ dolineprefix(const char *begin, const char *end, int newblock) { 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; @@ -330,7 +335,7 @@ doparagraph(const char *begin, const char *end, int newblock) { return 0; fputs("<p>\n",stdout); process(p,q,0); - fputs("\n</p>\n",stdout); + fputs("</p>\n",stdout); return -(q - begin); }