| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Jfcherng\Diff\Renderer; |
| 6 |
|
| 7 |
final class RendererConstant |
| 8 |
{ |
| 9 |
/** |
| 10 |
* The base namespace of renderers. |
| 11 |
* |
| 12 |
* @var string |
| 13 |
*/ |
| 14 |
public const RENDERER_NAMESPACE = __NAMESPACE__; |
| 15 |
|
| 16 |
/** |
| 17 |
* Available renderer types. |
| 18 |
* |
| 19 |
* @var string[] |
| 20 |
*/ |
| 21 |
public const RENDERER_TYPES = ['Html', 'Text']; |
| 22 |
|
| 23 |
/** |
| 24 |
* Closures that are used to enclose different parts in string. |
| 25 |
* |
| 26 |
* Arbitrary chars from the 15-16th Unicode reserved areas |
| 27 |
* and hopefully, they won't appear in source texts. |
| 28 |
* |
| 29 |
* @var string[] |
| 30 |
*/ |
| 31 |
public const HTML_CLOSURES = ["\u{fcffc}\u{ff2fb}", "\u{fff41}\u{fcffc}"]; |
| 32 |
|
| 33 |
/** |
| 34 |
* Closures that are used to enclose deleted chars in output HTML. |
| 35 |
* |
| 36 |
* @var string[] |
| 37 |
*/ |
| 38 |
public const HTML_CLOSURES_DEL = ['<del>', '</del>']; |
| 39 |
|
| 40 |
/** |
| 41 |
* Closures that are used to enclose inserted chars in output HTML. |
| 42 |
* |
| 43 |
* @var string[] |
| 44 |
*/ |
| 45 |
public const HTML_CLOSURES_INS = ['<ins>', '</ins>']; |
| 46 |
|
| 47 |
/** |
| 48 |
* The delimiter to be used as the glue in string/array functions. |
| 49 |
* |
| 50 |
* Arbitrary chars from the 15-16th Unicode reserved areas |
| 51 |
* and hopefully, it won't appear in source texts. |
| 52 |
* |
| 53 |
* @var string |
| 54 |
*/ |
| 55 |
public const IMPLODE_DELIMITER = "\u{ff2fa}\u{fcffc}\u{fff42}"; |
| 56 |
|
| 57 |
/** |
| 58 |
* Regex range for punctuations. |
| 59 |
* |
| 60 |
* Presuming the regex delimiter is "/". |
| 61 |
* |
| 62 |
* @var string |
| 63 |
*/ |
| 64 |
public const PUNCTUATIONS_RANGE = ( |
| 65 |
// Latin-1 Supplement |
| 66 |
// @see https://unicode-table.com/en/blocks/latin-1-supplement/ |
| 67 |
"\u{0080}-\u{00BB}" . |
| 68 |
// Spacing Modifier Letters |
| 69 |
// @see https://unicode-table.com/en/blocks/spacing-modifier-letters/ |
| 70 |
"\u{02B0}-\u{02FF}" . |
| 71 |
// Combining Diacritical Marks |
| 72 |
// @see https://unicode-table.com/en/blocks/combining-diacritical-marks/ |
| 73 |
"\u{0300}-\u{036F}" . |
| 74 |
// Small Form Variants |
| 75 |
// @see https://unicode-table.com/en/blocks/small-form-variants/ |
| 76 |
"\u{FE50}-\u{FE6F}" . |
| 77 |
// General Punctuation |
| 78 |
// @see https://unicode-table.com/en/blocks/general-punctuation/ |
| 79 |
"\u{2000}-\u{206F}" . |
| 80 |
// Supplemental Punctuation |
| 81 |
// @see https://unicode-table.com/en/blocks/supplemental-punctuation/ |
| 82 |
"\u{2E00}-\u{2E7F}" . |
| 83 |
// CJK Symbols and Punctuation |
| 84 |
// @see https://unicode-table.com/en/blocks/cjk-symbols-and-punctuation/ |
| 85 |
"\u{3000}-\u{303F}" . |
| 86 |
// Ideographic Symbols and Punctuation |
| 87 |
// @see https://unicode-table.com/en/blocks/ideographic-symbols-and-punctuation/ |
| 88 |
"\u{16FE0}-\u{16FFF}" . |
| 89 |
// hmm... these seem to be no rule |
| 90 |
" \t\r\n$,.:;!?'\"()\\[\\]{}%@<=>_+\\-*\\/~\\\\|" . |
| 91 |
' $,.:;!?’"()[]{}%@<=>_+-*/~\|' . |
| 92 |
'「」『』〈〉《》【】()()‘’“”' . |
| 93 |
'.‧・・•·¿' |
| 94 |
); |
| 95 |
|
| 96 |
/** |
| 97 |
* Colorize the CLI output if possible. |
| 98 |
* |
| 99 |
* @var int |
| 100 |
*/ |
| 101 |
public const CLI_COLOR_AUTO = -1; |
| 102 |
|
| 103 |
/** |
| 104 |
* Force not to colorize the CLI output. |
| 105 |
* |
| 106 |
* @var int |
| 107 |
*/ |
| 108 |
public const CLI_COLOR_DISABLE = 0; |
| 109 |
|
| 110 |
/** |
| 111 |
* Force to colorize the CLI output if possible. |
| 112 |
* |
| 113 |
* @var int |
| 114 |
*/ |
| 115 |
public const CLI_COLOR_ENABLE = 1; |
| 116 |
} |