diff options
| author | gottox@rootkit.lan <gottox@rootkit.lan> | 2007-12-11 11:55:47 +0100 |
|---|---|---|
| committer | gottox@rootkit.lan <gottox@rootkit.lan> | 2007-12-11 11:55:47 +0100 |
| commit | 9a9b9e346027fbeb6463b76d6b7b26e3b3589eaf (patch) | |
| tree | 3b3f0d20b614aa0f725d1a1068b9956dd3fdf04b /cmarkdown.c | |
| parent | 3d24178d0c85b907cecec86264ef383474475ed1 (diff) | |
replaced desclen and linklen by descend and linkend
images are now stackable into links.
Diffstat (limited to 'cmarkdown.c')
| -rw-r--r-- | cmarkdown.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/cmarkdown.c b/cmarkdown.c index e134cac..ae71bf0 100644 --- a/cmarkdown.c +++ b/cmarkdown.c @@ -142,35 +142,37 @@ dolineprefix(const char *begin, const char *end) { unsigned int dolink(const char *begin, const char *end) { int img; - const char *desc, *link, *p; - unsigned int desclen, linklen; + const char *desc, *link, *p, *q, *r, *descend, *linkend; - if(*begin != '[' && strncmp(begin,") || p > end) return 0; - desclen = p - desc; + for(q = strstr(desc, ") || p > end) + return 0; + descend = p; link = p + 2; if(!(p = strstr(link, ")")) || p > end) return 0; - linklen = p - link; - + linkend = p; if(img) { fputs("<img src=\"",stdout); - process(link,link+linklen); + process(link,linkend); fputs("\" alt=\"",stdout); - process(desc,desc+desclen); + process(desc,descend); fputs("\" />",stdout); } else { fputs("<a href=\"",stdout); - process(link,link+linklen); + process(link,linkend); fputs("\">",stdout); - process(desc,desc+desclen); + process(desc,descend); fputs("</a>",stdout); } return p + 1 - begin; |