smu

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

commit d86557e66a684ce2bd3b16dab9a5e16d47c9df89
parent f8f4f86c211d639b04480bd2ee57d8d7df8cc6c5
Author: gottox@rootkit.lan <gottox@rootkit.lan>
Date:   Mon, 17 Dec 2007 08:34:47 +0100

Nicer output in Makefile; dounderline ends with \n; adding -Werror; dohtml uses newblock; some cleanups

Diffstat:
MMakefile | 2+-
Mcmarkdown.c | 9++++-----
Mconfig.mk | 2+-
3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile @@ -21,7 +21,7 @@ options: ${OBJ}: config.mk cmarkdown: ${OBJ} - @echo CC -o $@ + @echo LD $@ @${CC} -o $@ ${OBJ} ${LDFLAGS} clean: diff --git a/cmarkdown.c b/cmarkdown.c @@ -64,8 +64,8 @@ struct Tag lineprefix[] = { { "# ", 1, "<h1>", "</h1>" }, }; struct Tag underline[] = { - { "=", 1, "<h1>", "</h1>" }, - { "-", 1, "<h2>", "</h2>" }, + { "=", 1, "<h1>", "</h1>\n" }, + { "-", 1, "<h2>", "</h2>\n" }, }; struct Tag surround[] = { { "``", 0, "<code>", "</code>" }, @@ -78,7 +78,6 @@ struct Tag surround[] = { char * replace[][2] = { { "\n- - -\n", "\n<hr />\n" }, { "\n- - - \n", "\n<hr />\n" }, - { " #######\n", "\n" }, { " ######\n", "\n" }, { " #####\n", "\n" }, { " ####\n", "\n" }, @@ -134,7 +133,8 @@ doamp(const char *begin, const char *end, int newblock) { unsigned int dohtml(const char *begin, const char *end, int newblock) { const char *p, *tag, *tagend; - if(nohtml || *begin != '\n' || !*begin) + + if(nohtml || !newblock || *begin == '\n') return 0; p = begin; if(p[1] == '\n') @@ -533,4 +533,3 @@ main(int argc, char *argv[]) { free(buffer); return EXIT_SUCCESS; } - diff --git a/config.mk b/config.mk @@ -10,7 +10,7 @@ INCS = -I. -I/usr/include LIBS = -L/usr/lib # flags -CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\" -Wall +CFLAGS = -Os -Wall -Werror ${INCS} -DVERSION=\"${VERSION}\" LDFLAGS = ${LIBS} # compiler