Skip to content

Commit

Permalink
--smart: open quote can never occur right after ] or ).
Browse files Browse the repository at this point in the history
Closes #227.
  • Loading branch information
jgm committed Aug 9, 2017
1 parent 61b51fa commit b9c7a49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/inlines.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ static int scan_delims(subject *subj, unsigned char c, bool *can_open,
*can_close = right_flanking &&
(!left_flanking || cmark_utf8proc_is_punctuation(after_char));
} else if (c == '\'' || c == '"') {
*can_open = left_flanking && !right_flanking;
*can_open = left_flanking && !right_flanking &&
before_char != ']' && before_char != ')';
*can_close = right_flanking;
} else {
*can_open = left_flanking;
Expand Down
9 changes: 9 additions & 0 deletions test/smart_punct.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ left double quote, to facilitate this style:
<p>“Second paragraph by same speaker, in fiction.”</p>
````````````````````````````````

A quote following a `]` or `)` character cannot
be an open quote:

```````````````````````````````` example
[a]'s b'
.
<p>[a]’s b’</p>
````````````````````````````````

Quotes that are escaped come out as literal straight
quotes:

Expand Down

0 comments on commit b9c7a49

Please sign in to comment.