Textpattern character replacements

Posted

I had noticed when I first started using Textpattern, that it had an odd penchant for replacing my standard single- and double-quotes with what I like to call, "stupid-ass quotes".

You've seen these if you've ever used Microsoft Word, or any machine running macOS. For some reason they're popular, and I can't figure out why, they hurt my eyes. I'm not a fucking layout person, I regularly deal in code and data and text input I can count on being consistent.

In other words, I can't deal with these non-standard characters. I always disable these as quickly as I can, before they trip me up, mess something I'm working on up, or otherwise ruin my day.

They are easy enough to remove. Or hack out of the core TxP PHP, anyway. I know they say not to do so, but it's just like Wordpress: if they won't make it an option, what else are you supposed to do? No CMS is perfect. (I know, because I'm still looking.)

Edit $DOCUMENTROOT/textpattern/vendors/Netcarver/Textile/Parser.php, and look down at about line 710. (It was line 710 as of TXP version v4.6.2, anyway.)

   protected $symbols = array(
        'quote_single_open'  => '‘',
        'quote_single_close' => '’',
        'quote_double_open'  => '“',
        'quote_double_close' => '”',
        'apostrophe'         => '’',
        'prime'              => '′',
        'prime_double'       => '″',
        'ellipsis'           => '…',
        'emdash'             => '—',
        'endash'             => '–',
        'dimension'          => '×',
        'trademark'          => '™',
        'registered'         => '®',
        'copyright'          => '©',
        'half'               => '½',
        'quarter'            => '¼',
        'threequarters'      => '¾',
        'degrees'            => '°',
        'plusminus'          => '±',
        'fn_ref_pattern'     => '<sup{atts}>{marker}</sup>',
        'fn_foot_pattern'    => '<sup{atts}>{marker}</sup>',
        'nl_ref_pattern'     => '<sup{atts}>{marker}</sup>',
    );

Note the quote_single_open and other quote replacement BS. I went ahead and replaced things like so:

   protected $symbols = array(
##  Oh HELL no. :c
##    ~erin
#          'quote_single_open'  => '&#8216;',
#          'quote_single_close' => '&#8217;',
#          'quote_double_open'  => '&#8220;',
#          'quote_double_close' => '&#8221;',
#        'apostrophe'         => '&#8217;',
        'quote_single_open'  => '&#39;',
        'quote_single_close' => '&#39;',
        'quote_double_open'  => '&#34;',
        'quote_double_close' => '&#34;',
        'apostrophe'         => '&#39;',
        'prime'              => '&#8242;',
        'prime_double'       => '&#8243;',
#        'ellipsis'           => '&#8230;',
        'ellipsis'           => '...',
#        'emdash'             => '&#8212;',
#        'endash'             => '&#8211;',
        'emdash'             => '--',
        'endash'             => '--',
        'dimension'          => '&#215;',
        'trademark'          => '&#8482;',
        'registered'         => '&#174;',
        'copyright'          => '&#169;',
        'half'               => '&#189;',
        'quarter'            => '&#188;',
        'threequarters'      => '&#190;',
        'degrees'            => '&#176;',
        'plusminus'          => '&#177;',
        'fn_ref_pattern'     => '<sup{atts}>{marker}</sup>',
        'fn_foot_pattern'    => '<sup{atts}>{marker}</sup>',
        'nl_ref_pattern'     => '<sup{atts}>{marker}</sup>',
    );

If, like me, you ended up with posts that seem to be stuck with the old quotes, you may be able to fix them by editing and clicking Save without making changes. This worked for me, but your mileage, she may vary considerably.

I'm still new to TxP, but it seems like the old posts get left out because it writes these replacements to the database, instead of rendering after the fact, which would make more sense to me. But whatever, I don't have the time to write my own CMS, so I'm taking what I can get, here...

Author
Categories web