summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgottox@rootkit.lan <gottox@rootkit.lan>2007-12-13 13:42:03 +0100
committergottox@rootkit.lan <gottox@rootkit.lan>2007-12-13 13:42:03 +0100
commitfea415180a6c626081610ed868ef13e2fd874413 (patch)
tree7922a231f5fc656b6c7cb768267b68ab9cf174d0
parent4fce2bfe47f4ffcc17ff72d0c1dc2ddd9bd7e4d5 (diff)
Further small fixes
-rw-r--r--cmarkdown.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/cmarkdown.c b/cmarkdown.c
index ac1a133..9372430 100644
--- a/cmarkdown.c
+++ b/cmarkdown.c
@@ -260,7 +260,7 @@ dolist(const char *begin, const char *end) {
if(!(buffer = malloc(BUFFERSIZE)))
eprint("Malloc failed.");
- puts(ul ? "<ul>" : "<ol>");
+ puts(ul ? "\n<ul>" : "\n<ol>");
run = 1;
for(i = 0; *p && p < end && run; p++) {
buffer[0] = '\0';
@@ -271,20 +271,22 @@ dolist(const char *begin, const char *end) {
run = 0;
}
q = p + 1;
+ j = 0;
if(ul && (*q == '-' || *q == '*' || *q == '+'))
j = 1;
- else {
- for(j = 0; q[j] >= '0' && q[j] <= '9' && j < indent; j++);
+ else if(!ul) {
+ for(; q[j] >= '0' && q[j] <= '9' && j < indent; j++);
if(j > 0 && q[j] == '.')
j++;
else
j = 0;
}
for(;q[j] == ' ' && j < indent; j++);
+ //printf("--%i %i--\n",j,indent);
if(j == indent) {
p += indent;
run = 1;
- if(q[1] == ' ')
+ if(q[0] == ' ')
p++;
else
break;
@@ -326,7 +328,7 @@ doparagraph(const char *begin, const char *end) {
fputs("\n<p>",stdout);
process(begin+2,p);
fputs("</p>\n",stdout);
- return p - begin;
+ return p - begin + 1;
}
unsigned int