avdgaag / typogruby

Improves web typography like Django's Typogrify
http://avdgaag.github.com/typogruby
MIT License
51 stars 9 forks source link

Special characters are not being replaced #27

Closed bmikol closed 8 years ago

bmikol commented 8 years ago

When running a text file containing special characters through typogruby, said characters are not being replaced with their HTML entity counterparts.

Ruby v2.2.4p230 Typogruby v.1.0.18

Steps to Repro

  1. echo "Glögg Olé søster" >> ~/foo.txt
  2. typogruby ~/foo.txt

    Expected Result

Glögg Olé søster

Actual Result

Glögg Olé søster

avdgaag commented 8 years ago

Interesting. I guess we can update characters.txt for that. Would you care to create a PR?

bmikol commented 8 years ago

Sorry I've been MIA - life got in the way.

My ruby skills are still pretty novice, but I've been investigating and playing with the source trying to figure out the root of the problem before creating a PR. Turns out passing the -n argument does work:

typogruby -n ~/foo.txt
> Glögg Olé søster

In looking at the source, the improve(text) function is indeed missing the call to the entities(text) function. Put that in, along with adding a exclude_sensitive_tags block to entities(text) so the first fix would stop breaking the exclude tags tests.

Just created the PR.

avdgaag commented 8 years ago

This is replaced with #28.