diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2014-11-10 10:52:11 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2014-11-10 10:52:11 -0800 |
commit | 4d4a3f72892ee50207e50e447a03f61e5c267867 (patch) | |
tree | fe88eabc8be7648cdb9f10709393417bd7335b33 /src/inlines.c | |
parent | 65af8da7a80a9fb062cacf1ef7e21b0c91cfde53 (diff) |
Allow images to contain images.
Diffstat (limited to 'src/inlines.c')
-rw-r--r-- | src/inlines.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/inlines.c b/src/inlines.c index ea4d3c5..bf55a0f 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -782,25 +782,26 @@ match: *last = inl; // process_emphasis will remove this delimiter and all later ones. - // Now we also remove earlier ones of the same kind - // (so, no links in links, and no images in images): - // (This code can be removed if we decide to allow links - // inside links and images inside images): - opener = subj->delimiters; - closer_above = NULL; - while (opener != NULL) { - tempstack = opener->previous; - if (opener->delim_char == (is_image ? '!' : '[')) { - free(opener); - if (closer_above) { - closer_above->previous = tempstack; + // Now, if we have a link, we also want to remove earlier link + // delimiters. (This code can be removed if we decide to allow links + // inside links.) + if (!is_image) { + opener = subj->delimiters; + closer_above = NULL; + while (opener != NULL) { + tempstack = opener->previous; + if (opener->delim_char == '[') { + free(opener); + if (closer_above) { + closer_above->previous = tempstack; + } else { + subj->delimiters = tempstack; + } } else { - subj->delimiters = tempstack; + closer_above = opener; } - } else { - closer_above = opener; + opener = tempstack; } - opener = tempstack; } return NULL; |