summaryrefslogtreecommitdiff
path: root/src/inlines.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-01-08 00:17:53 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-01-08 00:17:53 +0100
commit06156fd9194806ab98889e5ef3a309bb7075b02c (patch)
treec79f410d68062eb42e0414c02e151697325ceaf3 /src/inlines.c
parentfe58a9295d44bd58bb4e48e449eb56c070e099d8 (diff)
Update emphasis parsing for spec change.
Strong now goes inside Emph rather than the reverse, when both scopes are possible. The code is much simpler. This also avoids a spec inconsistency that cmark had previously: `***hi***` became Strong (Emph "hi")) but `***hi****` became Emph (Strong "hi")) "*"
Diffstat (limited to 'src/inlines.c')
-rw-r--r--src/inlines.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/inlines.c b/src/inlines.c
index 92e79c7..3807da9 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -614,12 +614,7 @@ static delimiter *S_insert_emph(subject *subj, delimiter *opener,
cmark_node *tmp, *tmpnext, *emph;
// calculate the actual number of characters used from this closer
- if (closer_num_chars < 3 || opener_num_chars < 3) {
- use_delims = closer_num_chars <= opener_num_chars ? closer_num_chars
- : opener_num_chars;
- } else { // closer and opener both have >= 3 characters
- use_delims = closer_num_chars % 2 == 0 ? 2 : 1;
- }
+ use_delims = (closer_num_chars >= 2 && opener_num_chars >=2) ? 2 : 1;
// remove used characters from associated inlines.
opener_num_chars -= use_delims;