nprapps/book-concierge

Typographic filter sometimes inserts random `$2`

Closed this issue · 1 comments

alykat commented

Possible wonky regex issue in the typography filter we use?

Pam spotted that Houston Astros' 2017 was getting converted to Houston Astros’$2 2017 on the site. And we saw these random $2 instances pop up earlier this year in another recent project using the dgnext rig.

This time, I think we've figured out the pattern:

s + ' (straight quote) + (space) + any number

So:

Houston Astros' 2017 (with a straight quote) converts to Houston Astros’$2 2017

Houston Astros’ 2017 (with a curly quote) converts correctly to Houston Astros’ 2017
as does Houston Astros’ 2017

alykat commented

Can confirm that this seems to be happening at the typo.smartypants(input) phase of markdown.js (https://github.com/nprapps/book-concierge/blob/master/tasks/markdown.js#L29).