Jump to content

SmartyPants Typographer incorrect curly quote


alexcapes
 Share

Recommended Posts

Hi,

I have an issue when using the SmartyPants Typographer text formatter.

If the text has an HTML tag (such as italics) straight after the quotation mark, it reverses it. 

So for example:

e03jz9R.png

This only seems to occur when an HTML tag is placed at the beginning. 

Does anyone know how this could be corrected? 

Link to comment
Share on other sites

PW doesn't use latest version of the PHP SmartyPants, it uses 1.7.1 while latest is 1.8.1

Maybe updating that would fix your issue? You can try it by updating that module by yourself and maybe creating github issue or PR for Ryan to update it in Core too (shouldn't be in the core at all imo).

Here you can find the llibrary pw uses: https://michelf.ca/projects/php-smartypants/

  • Like 1
Link to comment
Share on other sites

10 hours ago, alexcapes said:

If the text has an HTML tag (such as italics) straight after the quotation mark, it reverses it.

I can't reproduce that. Maybe you have some odd unicode character in your text that is confusing SmartyPants? Or an unclosed open quote before the sentence in question?

2017-07-27_112215.png.1d8873a4843d47df2592513dd7bfe551.png

  • Like 1
Link to comment
Share on other sites

On 27/07/2017 at 0:27 AM, Robin S said:

I can't reproduce that. Maybe you have some odd unicode character in your text that is confusing SmartyPants? Or an unclosed open quote before the sentence in question?

2017-07-27_112215.png.1d8873a4843d47df2592513dd7bfe551.png

Digging a bit (and by that I mean actually looking at the source!) it looks like this is not a SmartyPants issue. 

I can see that the double quote is being encoded by Processwire incorrectly as a right double quotation mark.

<p class='review'>&#8221;<i>How Music Works </i>is a melange of bookish musings on how music is shaped by the places it is played and the technology used to create and disseminate it”<br/><span class='review-source'>Danny Eccleston<br/><em>mojo</em></span>

However the data source for this content (an XML file) the quotes look just to be normal double quotes

<Text><![CDATA["<i>How Music Works </i>is a melange of bookish musings on how music is shaped by the places it is played and the technology used to create and disseminate it"]]></Text>

So I'm not sure why Processwire would encode (incorrectly) the first double quotation mark (if before an HTML tag) and no others?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...