smu

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

commit a2af303ce18a69a8e1aa9a8b9ecdb451380c6689
parent b8d1753e0945ca028ba52908ae8354d5ebf0763b
Author: gottox@rootkit.lan <gottox@rootkit.lan>
Date:   Fri,  4 Jan 2008 12:04:15 +0100

Removed comments and unneeded replace rules ('- - -' should be readded later.)

Diffstat:
Msmu.c | 18++----------------
1 file changed, 2 insertions(+), 16 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[] = { dounderline, dohtml, dolineprefix, dolist, doparagraph, - dogtlt, dosurround, dolink, doshortlink, doamp, doreplace }; +Parser parsers[] = { doreplace, dounderline, dohtml, dolineprefix, dolist, doparagraph, + dogtlt, dosurround, dolink, doshortlink, doamp }; /* list of parsers */ FILE *source; unsigned int nohtml = 0; @@ -79,16 +79,6 @@ struct Tag surround[] = { { "_", 1, "<em>", "</em>" }, }; char * replace[][2] = { - { "\n- - -\n", "\n<hr />\n" }, - { "\n- - - \n", "\n<hr />\n" }, - { " ######\n", "\n" }, - { " #####\n", "\n" }, - { " ####\n", "\n" }, - { " ###\n", "\n" }, - { " ##\n", "\n" }, - { " #\n", "\n" }, - { " >", "&gt;" }, - { "< ", "&lt;" }, { "\\\\", "\\" }, { "\\`", "`" }, { "\\*", "*" }, @@ -126,7 +116,6 @@ doamp(const char *begin, const char *end, int newblock) { if(*begin != '&') return 0; if(!nohtml) { - /* TODO: end ? */ for(p = begin + 1; p != end && !strchr("; \\\n\t", *p); p++); if(p == end || *p == ';') return 0; @@ -144,7 +133,6 @@ unsigned int dohtml(const char *begin, const char *end, int newblock) { const char *p, *tag, *tagend; - /* TODO: end */ if(nohtml || !newblock || *begin == '\n' || begin + 2 >= end) return 0; p = begin; @@ -309,7 +297,6 @@ dolist(const char *begin, const char *end, int newblock) { else j = 0; } - /* TODO: do '\t' properly */ if(q + indent < end) for(; (q[j] == ' ' || q[j] == '\t') && j < indent; j++); if(j == indent) { @@ -343,7 +330,6 @@ doparagraph(const char *begin, const char *end, int newblock) { if(!newblock) return 0; - /* TODO: can go past end */ p = strstr(begin, "\n\n"); if(!p || p > end) p = end;