diff --git a/extension/_test/typographer.txt b/extension/_test/typographer.txt index cf5fea6..4accb65 100644 --- a/extension/_test/typographer.txt +++ b/extension/_test/typographer.txt @@ -141,3 +141,10 @@ We're talking about the internet --- 'net for short. Let's rock 'n roll! //- - - - - - - - -//

Nice & day, isn’t it?

//= = = = = = = = = = = = = = = = = = = = = = = =// + +20: Quoted words starting with 't' keep their opening quote +//- - - - - - - - -// +It was 'terrifying' but 'twas worth it; please 'turn' here. +//- - - - - - - - -// +

It was ‘terrifying’ but ’twas worth it; please ‘turn’ here.

+//= = = = = = = = = = = = = = = = = = = = = = = =// diff --git a/extension/typographer.go b/extension/typographer.go index 3a3f106..b820232 100644 --- a/extension/typographer.go +++ b/extension/typographer.go @@ -231,9 +231,10 @@ func (s *typographerParser) Parse(parent gast.Node, block text.Reader, pc parser return node } } - // special cases: 'twas, 'em, 'net + // special cases: 'twas/'tis, 'em, 'net (a leading 't only counts before w/i, so quoted words like 'terrifying' keep their opening quote) if len(line) > 1 && (unicode.IsPunct(before) || unicode.IsSpace(before)) && - (line[1] == 't' || line[1] == 'e' || line[1] == 'n' || line[1] == 'l') { + ((line[1] == 't' && len(line) > 2 && (line[2] == 'w' || line[2] == 'i')) || + line[1] == 'e' || line[1] == 'n' || line[1] == 'l') { node := gast.NewString(s.Substitutions[Apostrophe]) node.SetCode(true) block.Advance(1)