summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-06-11 11:12:09 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-06-11 11:12:58 -0700
commitc5b77c7b01ef6ff035b3afe618de5a6bc353c9cf (patch)
treee6db743587f5297197536f9c2393d18b8402959a
parent18c32c79bad08359c5590a93c818be51f1f63021 (diff)
Small logic fixes and a simplification in process_emphasis.
-rw-r--r--src/inlines.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/inlines.c b/src/inlines.c
index 0a75e38..a96a479 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -471,13 +471,7 @@ static void process_emphasis(subject *subj, delimiter *start_delim)
opener = opener->previous;
}
old_closer = closer;
- if (closer->delim_char == '*') {
- if (opener_found) {
- closer = S_insert_emph(subj, opener, closer);
- } else {
- closer = closer->next;
- }
- } else if (closer->delim_char == '_') {
+ if (closer->delim_char == '*' || closer->delim_char == '_') {
if (opener_found) {
closer = S_insert_emph(subj, opener, closer);
} else {
@@ -504,13 +498,15 @@ static void process_emphasis(subject *subj, delimiter *start_delim)
}
closer = closer->next;
}
- if (!opener_found && !old_closer->can_open) {
+ if (!opener_found) {
// set lower bound for future searches for openers:
potential_openers[old_closer->delim_char] = closer;
- // we can remove a closer that can't be an
- // opener, once we've seen there's no
- // matching opener:
- remove_delimiter(subj, old_closer);
+ if (!old_closer->can_open) {
+ // we can remove a closer that can't be an
+ // opener, once we've seen there's no
+ // matching opener:
+ remove_delimiter(subj, old_closer);
+ }
}
} else {
closer = closer->next;