nystudio107 /
craft-typogrify
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Typogrify plugin for Craft CMS |
||
| 4 | * |
||
| 5 | * Typogrify prettifies your web typography by preventing ugly quotes and 'widows' and more |
||
| 6 | * |
||
| 7 | * @link https://nystudio107.com/ |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 8 | * @copyright Copyright (c) nystudio107 |
||
|
0 ignored issues
–
show
|
|||
| 9 | */ |
||
|
0 ignored issues
–
show
|
|||
| 10 | |||
| 11 | use PHP_Typography\Settings\Dash_Style; |
||
| 12 | use PHP_Typography\Settings\Quote_Style; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Typogrify config.php |
||
| 16 | * |
||
| 17 | * This file exists only as a template for the Typogrify settings. |
||
| 18 | * It does nothing on its own. |
||
| 19 | * |
||
| 20 | * Don't edit this file, instead copy it to 'craft/config' as 'typogrify.php' |
||
| 21 | * and make your changes there to override default settings. |
||
| 22 | * |
||
| 23 | * Once copied to 'craft/config', this file will be multi-environment aware as |
||
| 24 | * well, so you can have different settings groups for each environment, just as |
||
| 25 | * you do for 'general.php' |
||
| 26 | */ |
||
| 27 | |||
| 28 | return [ |
||
| 29 | // sets whether input should be escaped by default |
||
| 30 | "default_escape" => false, |
||
| 31 | |||
| 32 | // sets tags where typography of children will be untouched |
||
| 33 | "set_tags_to_ignore" => [ |
||
| 34 | "code", |
||
| 35 | "head", |
||
| 36 | "kbd", |
||
| 37 | "object", |
||
| 38 | "option", |
||
| 39 | "pre", |
||
| 40 | "samp", |
||
| 41 | "script", |
||
| 42 | "noscript", |
||
| 43 | "noembed", |
||
| 44 | "select", |
||
| 45 | "style", |
||
| 46 | "textarea", |
||
| 47 | "title", |
||
| 48 | "var", |
||
| 49 | "math", |
||
| 50 | ], |
||
| 51 | |||
| 52 | // sets classes where typography of children will be untouched |
||
| 53 | "set_classes_to_ignore" => [ |
||
| 54 | "vcard", |
||
| 55 | "noTypo", |
||
| 56 | ], |
||
| 57 | |||
| 58 | // sets IDs where typography of children will be untouched |
||
| 59 | "set_ids_to_ignore" => [ |
||
| 60 | ], |
||
| 61 | |||
| 62 | // curl quotemarks |
||
| 63 | "set_smart_quotes" => true, |
||
| 64 | |||
| 65 | // Primary quotemarks style |
||
| 66 | // allowed values for $style |
||
| 67 | // "doubleCurled" => "“foo”", |
||
| 68 | // "doubleCurledReversed" => "”foo”", |
||
| 69 | // "doubleLow9" => "„foo”", |
||
| 70 | // "doubleLow9Reversed" => "„foo“", |
||
| 71 | // "singleCurled" => "‘foo’", |
||
| 72 | // "singleCurledReversed" => "’foo’", |
||
| 73 | // "singleLow9" => "‚foo’", |
||
| 74 | // "singleLow9Reversed" => "‚foo‘", |
||
| 75 | // "doubleGuillemetsFrench" => "« foo »", |
||
| 76 | // "doubleGuillemets" => "«foo»", |
||
| 77 | // "doubleGuillemetsReversed" => "»foo«", |
||
| 78 | // "singleGuillemets" => "‹foo›", |
||
| 79 | // "singleGuillemetsReversed" => "›foo‹", |
||
| 80 | // "cornerBrackets" => "「foo」", |
||
| 81 | // "whiteCornerBracket" => "『foo』", |
||
| 82 | "set_smart_quotes_primary" => Quote_Style::DOUBLE_CURLED, |
||
| 83 | |||
| 84 | // Secondary quotemarks style |
||
| 85 | // allowed values for $style |
||
| 86 | // "doubleCurled" => "“foo”", |
||
| 87 | // "doubleCurledReversed" => "”foo”", |
||
| 88 | // "doubleLow9" => "„foo”", |
||
| 89 | // "doubleLow9Reversed" => "„foo“", |
||
| 90 | // "singleCurled" => "‘foo’", |
||
| 91 | // "singleCurledReversed" => "’foo’", |
||
| 92 | // "singleLow9" => "‚foo’", |
||
| 93 | // "singleLow9Reversed" => "‚foo‘", |
||
| 94 | // "doubleGuillemetsFrench" => "« foo »", |
||
| 95 | // "doubleGuillemets" => "«foo»", |
||
| 96 | // "doubleGuillemetsReversed" => "»foo«", |
||
| 97 | // "singleGuillemets" => "‹foo›", |
||
| 98 | // "singleGuillemetsReversed" => "›foo‹", |
||
| 99 | // "cornerBrackets" => "「foo」", |
||
| 100 | // "whiteCornerBracket" => "『foo』", |
||
| 101 | "set_smart_quotes_secondary" => Quote_Style::SINGLE_CURLED, |
||
| 102 | |||
| 103 | // replaces "a--a" with En Dash " -- " and "---" with Em Dash |
||
| 104 | "set_smart_dashes" => true, |
||
| 105 | |||
| 106 | // Sets the typographical conventions used by smart_dashes. |
||
| 107 | // |
||
| 108 | // Allowed values for $style: |
||
| 109 | // - "traditionalUS" |
||
| 110 | // - "international" |
||
| 111 | "set_smart_dashes_style" => Dash_Style::TRADITIONAL_US, |
||
| 112 | |||
| 113 | // replaces "..." with "…" |
||
| 114 | "set_smart_ellipses" => true, |
||
| 115 | |||
| 116 | // replaces "creme brulee" with "crème brûlée" |
||
| 117 | "set_smart_diacritics" => true, |
||
| 118 | |||
| 119 | // defines hyphenation language for text |
||
| 120 | "set_diacritic_language" => "en-US", |
||
| 121 | |||
| 122 | // $customReplacements must be |
||
| 123 | // an array formatted array(needle=>replacement, needle=>replacement...), or |
||
| 124 | // a string formatted `"needle"=>"replacement","needle"=>"replacement",...` |
||
| 125 | "set_diacritic_custom_replacements" => [ |
||
| 126 | ], |
||
| 127 | |||
| 128 | // replaces (r) (c) (tm) (sm) (p) (R) (C) (TM) (SM) (P) with ® © ™ ℠℗ |
||
| 129 | "set_smart_marks" => true, |
||
| 130 | |||
| 131 | // replaces 1*4 with 1x4, etc. |
||
| 132 | "set_smart_math" => true, |
||
| 133 | |||
| 134 | // replaces 2^4 with 2<sup>4</sup> |
||
| 135 | "set_smart_exponents" => true, |
||
| 136 | |||
| 137 | // replaces 1/4 with <sup>1</sup>⁄<sub>4</sub> |
||
| 138 | "set_smart_fractions" => true, |
||
| 139 | |||
| 140 | // Enables/disables replacement of 1st with 1<sup>st</sup> |
||
| 141 | "set_smart_ordinal_suffix" => true, |
||
| 142 | |||
| 143 | // single character words are forced to next line with insertion of |
||
| 144 | "set_single_character_word_spacing" => true, |
||
| 145 | |||
| 146 | // fractions are kept together with insertion of |
||
| 147 | "set_fraction_spacing" => true, |
||
| 148 | |||
| 149 | // units and values are kept together with insertion of |
||
| 150 | "set_unit_spacing" => true, |
||
| 151 | |||
| 152 | // Enables/disables extra whitespace before certain punction marks, as is the French custom. |
||
| 153 | "set_french_punctuation_spacing" => false, |
||
| 154 | |||
| 155 | // a list of units to keep with their values |
||
| 156 | "set_units" => [ |
||
| 157 | ], |
||
| 158 | |||
| 159 | // Em and En dashes are wrapped in thin spaces |
||
| 160 | "set_dash_spacing" => true, |
||
| 161 | |||
| 162 | // Remove extra space characters |
||
| 163 | "set_space_collapse" => true, |
||
| 164 | |||
| 165 | // Enable usage of true "no-break narrow space" ( ) instead of the normal no-break space ( ). |
||
| 166 | "set_true_no_break_narrow_space" => false, |
||
| 167 | |||
| 168 | // enables widow handling |
||
| 169 | "set_dewidow" => true, |
||
| 170 | |||
| 171 | // establishes maximum length of a widows that will be protected |
||
| 172 | "set_max_dewidow_length" => 5, |
||
| 173 | |||
| 174 | // establishes the maximum number of words considered for dewidowing. |
||
| 175 | "set_dewidow_word_number" => 1, |
||
| 176 | |||
| 177 | // establishes maximum length of pulled text to keep widows company |
||
| 178 | "set_max_dewidow_pull" => 5, |
||
| 179 | |||
| 180 | // enables wrapping at hard hyphens internal to a word with the insertion of a zero-width-space |
||
| 181 | "set_wrap_hard_hyphens" => true, |
||
| 182 | |||
| 183 | // enables wrapping of urls |
||
| 184 | "set_url_wrap" => true, |
||
| 185 | |||
| 186 | // enables wrapping of email addresses |
||
| 187 | "set_email_wrap" => true, |
||
| 188 | |||
| 189 | // establishes minimum character requirement after a url wrapping point |
||
| 190 | "set_min_after_url_wrap" => 5, |
||
| 191 | |||
| 192 | // wrap ampersands in <span class="amp"> |
||
| 193 | "set_style_ampersands" => true, |
||
| 194 | |||
| 195 | // wrap caps in <span class="caps"> |
||
| 196 | "set_style_caps" => true, |
||
| 197 | |||
| 198 | // wrap initial quotes in <span class="quo"> or <span class="dquo"> |
||
| 199 | "set_style_initial_quotes" => true, |
||
| 200 | |||
| 201 | // wrap numbers in <span class="numbers"> |
||
| 202 | "set_style_numbers" => true, |
||
| 203 | |||
| 204 | // sets tags where initial quotes and guillemets should be styled |
||
| 205 | "set_initial_quote_tags" => [ |
||
| 206 | "p", |
||
| 207 | "h1", |
||
| 208 | "h2", |
||
| 209 | "h3", |
||
| 210 | "h4", |
||
| 211 | "h5", |
||
| 212 | "h6", |
||
| 213 | "blockquote", |
||
| 214 | "li", |
||
| 215 | "dd", |
||
| 216 | "dt", |
||
| 217 | ], |
||
| 218 | |||
| 219 | // enables hyphenation of text |
||
| 220 | "set_hyphenation" => true, |
||
| 221 | |||
| 222 | // defines hyphenation language for text |
||
| 223 | "set_hyphenation_language" => "en-US", |
||
| 224 | |||
| 225 | // establishes minimum length of a word that may be hyphenated |
||
| 226 | "set_min_length_hyphenation" => 5, |
||
| 227 | |||
| 228 | // establishes minimum character requirement before a hyphenation point |
||
| 229 | "set_min_before_hyphenation" => 3, |
||
| 230 | |||
| 231 | // establishes minimum character requirement after a hyphenation point |
||
| 232 | "set_min_after_hyphenation" => 2, |
||
| 233 | |||
| 234 | // allows/disallows hyphenation of title/heading text |
||
| 235 | "set_hyphenate_headings" => true, |
||
| 236 | |||
| 237 | // allows hyphenation of strings of all capital characters |
||
| 238 | "set_hyphenate_all_caps" => true, |
||
| 239 | |||
| 240 | // allows hyphenation of strings of all capital characters |
||
| 241 | "set_hyphenate_title_case" => true, |
||
| 242 | |||
| 243 | // defines custom word hyphenations |
||
| 244 | // expected input is an array of words with all hyphenation points marked with a hard hyphen |
||
| 245 | "set_hyphenation_exceptions" => [ |
||
| 246 | ], |
||
| 247 | |||
| 248 | // Enable lenient parser error handling (HTML is "best guess" if enabled). |
||
| 249 | "set_ignore_parser_errors" => true, |
||
| 250 | |||
| 251 | // Sets an optional handler for parser errors. Invalid callbacks will be silently ignored |
||
| 252 | "set_parser_errors_handler" => null, |
||
| 253 | ]; |
||
| 254 |