|
|
@ -16,19 +16,19 @@ class Reader |
|
|
|
private array $_rule = |
|
|
|
private array $_rule = |
|
|
|
[ |
|
|
|
[ |
|
|
|
// Headers |
|
|
|
// Headers |
|
|
|
'/^([\s]?)#([^#]+)/' => '$1#$2' . PHP_EOL, |
|
|
|
'/^([\s]*)#([^#]+)/' => '$1#$2' . PHP_EOL, |
|
|
|
'/^([\s]?)##([^#]+)/' => '$1##$2' . PHP_EOL, |
|
|
|
'/^([\s]*)##([^#]+)/' => '$1##$2' . PHP_EOL, |
|
|
|
'/^([\s]?)###([^#]+)/' => '$1###$2' . PHP_EOL, |
|
|
|
'/^([\s]*)###([^#]+)/' => '$1###$2' . PHP_EOL, |
|
|
|
'/^([\s]?)####([^#]+)/' => '$1###$2' . PHP_EOL, |
|
|
|
'/^([\s]*)####([^#]+)/' => '$1###$2' . PHP_EOL, |
|
|
|
'/^([\s]?)#####([^#]+)/' => '$1###$2' . PHP_EOL, |
|
|
|
'/^([\s]*)#####([^#]+)/' => '$1###$2' . PHP_EOL, |
|
|
|
'/^([\s]?)######([^#]+)/' => '$1###$2' . PHP_EOL, |
|
|
|
'/^([\s]*)######([^#]+)/' => '$1###$2' . PHP_EOL, |
|
|
|
|
|
|
|
|
|
|
|
'/^[\s]?[=]{6}([^=]+)[=]{6}/' => '# $1' . PHP_EOL, |
|
|
|
'/^[\s]*[=]{6}([^=]+)[=]{6}/' => '# $1' . PHP_EOL, |
|
|
|
'/^[\s]?[=]{5}([^=]+)[=]{5}/' => '## $1' . PHP_EOL, |
|
|
|
'/^[\s]*[=]{5}([^=]+)[=]{5}/' => '## $1' . PHP_EOL, |
|
|
|
'/^[\s]?[=]{4}([^=]+)[=]{4}/' => '### $1' . PHP_EOL, |
|
|
|
'/^[\s]*[=]{4}([^=]+)[=]{4}/' => '### $1' . PHP_EOL, |
|
|
|
'/^[\s]?[=]{3}([^=]+)[=]{3}/' => '### $1' . PHP_EOL, |
|
|
|
'/^[\s]*[=]{3}([^=]+)[=]{3}/' => '### $1' . PHP_EOL, |
|
|
|
'/^[\s]?[=]{2}([^=]+)[=]{2}/' => '### $1' . PHP_EOL, |
|
|
|
'/^[\s]*[=]{2}([^=]+)[=]{2}/' => '### $1' . PHP_EOL, |
|
|
|
'/^[\s]?[=]{1}([^=]+)[=]{1}/' => '### $1' . PHP_EOL, |
|
|
|
'/^[\s]*[=]{1}([^=]+)[=]{1}/' => '### $1' . PHP_EOL, |
|
|
|
|
|
|
|
|
|
|
|
// Tags |
|
|
|
// Tags |
|
|
|
'/\*\*([^\*]{2,})\*\*/' => '$1', |
|
|
|
'/\*\*([^\*]{2,})\*\*/' => '$1', |
|
|
@ -43,11 +43,11 @@ class Reader |
|
|
|
'/\[\[([^\[]+)\[([A-f:0-9]*)\]([^\]]+)\]\]/' => '$1~IPv6:open~$2~IPv6:close~$3', |
|
|
|
'/\[\[([^\[]+)\[([A-f:0-9]*)\]([^\]]+)\]\]/' => '$1~IPv6:open~$2~IPv6:close~$3', |
|
|
|
|
|
|
|
|
|
|
|
/// Remove extra spaces |
|
|
|
/// Remove extra spaces |
|
|
|
'/\[\[\s?([^\|]+)\s?\|\s?([^\]]+)\s?\]\]/' => '[[$1|$2]]', |
|
|
|
'/\[\[\s*([^\|]+)\s*\|\s*([^\]]+)\s*\]\]/' => '[[$1|$2]]', |
|
|
|
'/\[\[\s?([^\]]+)\s?\]\]/' => '[[$1]]', |
|
|
|
'/\[\[\s*([^\]]+)\s*\]\]/' => '[[$1]]', |
|
|
|
|
|
|
|
|
|
|
|
'/\{\{\s?([^\|]+)\s?\|\s?([^\}]+)\s?\}\}/' => '{{$1|$2}}', |
|
|
|
'/\{\{\s*([^\|]+)\s*\|\s*([^\}]+)\s*\}\}/' => '{{$1|$2}}', |
|
|
|
'/\{\{\s?([^\}]+)\s?\}\}/' => '{{$1}}', |
|
|
|
'/\{\{\s*([^\}]+)\s*\}\}/' => '{{$1}}', |
|
|
|
|
|
|
|
|
|
|
|
/// Wikipedia |
|
|
|
/// Wikipedia |
|
|
|
'/\[\[wp([A-z]{2,})>([^\|]+)\|([^\]]+)\]\]/ui' => '$3 ( https://$1.wikipedia.org/wiki/$2 )', |
|
|
|
'/\[\[wp([A-z]{2,})>([^\|]+)\|([^\]]+)\]\]/ui' => '$3 ( https://$1.wikipedia.org/wiki/$2 )', |
|
|
@ -75,6 +75,10 @@ class Reader |
|
|
|
'/\[\[(https?:)([^\|]+)\|([^\]]+)\]\]/i' => '$3 ( $1$2 )', |
|
|
|
'/\[\[(https?:)([^\|]+)\|([^\]]+)\]\]/i' => '$3 ( $1$2 )', |
|
|
|
'/\[\[(https?:)([^\]]+)\]\]/i' => '$1$2', // @TODO |
|
|
|
'/\[\[(https?:)([^\]]+)\]\]/i' => '$1$2', // @TODO |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Media |
|
|
|
|
|
|
|
'/\{\{(?!https?:)([^\|]+)\|([^\}]+)\}\}/i' => PHP_EOL . '=> /$1$2' . PHP_EOL, |
|
|
|
|
|
|
|
'/\{\{(?!https?:)([^\}]+)\}\}/i' => PHP_EOL . '=> /$1$2' . PHP_EOL, |
|
|
|
|
|
|
|
|
|
|
|
// List |
|
|
|
// List |
|
|
|
'/^[\s]?-/' => '* ', |
|
|
|
'/^[\s]?-/' => '* ', |
|
|
|
'/^[\s]+\*/' => '*', |
|
|
|
'/^[\s]+\*/' => '*', |
|
|
|