Make WordPress Core


Ignore:
Timestamp:
06/10/2014 02:21:36 PM (12 years ago)
Author:
wonderboymusic
Message:

In wptexturize(), allow dashes before and after curly quotes. Example: This is what she said---"Wow that is cool."

Adds unit tests.

Props adamsilverstein, miqrogroove.
Fixes #20342.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/WPTexturize.php

    r28725 r28726  
    10671067        }
    10681068
     1069        /**
     1070         * Quotations should be allowed to have dashes around them.
     1071         *
     1072         * @ticket 20342
     1073         * @dataProvider data_quotes_and_dashes
     1074         */
     1075        function test_quotes_and_dashes( $input, $output ) {
     1076                return $this->assertEquals( $output, wptexturize( $input ) );
     1077        }
     1078
     1079        function data_quotes_and_dashes() {
     1080                return array(
     1081                        array(
     1082                                'word---"quote"',
     1083                                'word—“quote”',
     1084                        ),
     1085                        array(
     1086                                'word--"quote"',
     1087                                'word–“quote”',
     1088                        ),
     1089                        array(
     1090                                'word-"quote"',
     1091                                'word-“quote”',
     1092                        ),
     1093                        array(
     1094                                "word---'quote'",
     1095                                "word—‘quote’",
     1096                        ),
     1097                        array(
     1098                                "word--'quote'",
     1099                                "word–‘quote’",
     1100                        ),
     1101                        array(
     1102                                "word-'quote'",
     1103                                "word-‘quote’",
     1104                        ),
     1105                        array(
     1106                                '"quote"---word',
     1107                                '“quote”—word',
     1108                        ),
     1109                        array(
     1110                                '"quote"--word',
     1111                                '“quote”–word',
     1112                        ),
     1113                        array(
     1114                                '"quote"-word',
     1115                                '“quote”-word',
     1116                        ),
     1117                        array(
     1118                                "'quote'---word",
     1119                                "‘quote’—word",
     1120                        ),
     1121                        array(
     1122                                "'quote'--word",
     1123                                "‘quote’–word",
     1124                        ),
     1125                        array(
     1126                                "'quote'-word",
     1127                                "‘quote’-word",
     1128                        ),
     1129                );
     1130        }
    10691131}
Note: See TracChangeset for help on using the changeset viewer.