Merge pull request #1 from mrdomino/master - smu - smu - simple markup (Markdow… | |
git clone git://git.codemadness.org/smu | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 2c7b9d2ec0e1858ba6e5fcc2dfabd229bc914d04 | |
parent 1b0c0b16d11ec50ae1c7c3355634c06ee53047d5 | |
Author: Enno Boland <[email protected]> | |
Date: Sun, 23 Jun 2013 02:19:28 -0700 | |
Merge pull request #1 from mrdomino/master | |
Fix escaping with surrounds | |
Diffstat: | |
M smu.c | 6 ++++-- | |
M testdoc | 4 ++++ | |
2 files changed, 8 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/smu.c b/smu.c | |
@@ -449,10 +449,12 @@ dosurround(const char *begin, const char *end, int newblo… | |
start = begin + l; | |
p = start - 1; | |
do { | |
+ stop = p; | |
p = strstr(p + 1, surround[i].search); | |
} while(p && p[-1] == '\\'); | |
- if(!p || p >= end || | |
- !(stop = strstr(start, surround[i].search)) ||… | |
+ if (p && p[-1] != '\\') | |
+ stop = p; | |
+ if(!stop || stop < start || stop >= end) | |
continue; | |
fputs(surround[i].before, stdout); | |
if(surround[i].process) | |
diff --git a/testdoc b/testdoc | |
@@ -7,6 +7,10 @@ simple tests | |
first paragraph. | |
testing surround: _emph_ then **strong** and `code`. | |
+`\`escaped backticks\``. | |
+ | |
+`x = *y * 6;` | |
+ | |
horizontal rule: | |
- - - |