Lines Matching refs:text
3 public function convert($text) { argument
4 $text = $this->stripMetadataBlocks($text);
5 $text = preg_replace('/^======\s*(.*?)\s*======\s*$/m', '# $1', $text);
6 $text = preg_replace('/^=====\s*(.*?)\s*=====\s*$/m', '## $1', $text);
7 $text = preg_replace('/^====\s*(.*?)\s*====\s*$/m', '### $1', $text);
8 $text = preg_replace('/^===\s*(.*?)\s*===\s*$/m', '#### $1', $text);
9 $text = preg_replace('/^==\s*(.*?)\s*==\s*$/m', '##### $1', $text);
10 $text = preg_replace('/\*\*(.*?)\*\*/s', '**$1**', $text);
11 $text = preg_replace('/\/\/(.*?)\/\//s', '*$1*', $text);
12 $text = preg_replace('/__([^_]+)__/', '<u>$1</u>', $text);
13 $text = preg_replace_callback('/<code(?:\s+([^>]+))?>(.*?)<\/code>/is', function($m) {
16 }, $text);
17 $text = preg_replace('/<file(?:\s+[^>]*)?>(.*?)<\/file>/is', "```\n$1\n```", $text);
18 $text = preg_replace_callback('/\[\[([^\]|]+)\|([^\]]+)\]\]/', function($m) {
20 }, $text);
21 $text = preg_replace_callback('/\[\[([^\]]+)\]\]/', function($m) {
23 }, $text);
24 $text = preg_replace_callback('/\{\{([^\}|]+)(?:\|([^\}]+))?\}\}/', function($m) {
27 }, $text);
28 return trim($text) . "\n";
31 public function extractMetadata($text) { argument
32 if (preg_match('/<frontmatter>(.*?)<\/frontmatter>/is', $text, $m)) return trim($m[1]);
33 if (preg_match('/<skillmeta>(.*?)<\/skillmeta>/is', $text, $m)) return trim($m[1]);
34 if (preg_match('/^---\s*\R(.*?)\R---\s*\R/s', $text, $m)) return trim($m[1]);
38 private function stripMetadataBlocks($text) { argument
39 $text = preg_replace('/<frontmatter>.*?<\/frontmatter>\s*/is', '', $text);
40 $text = preg_replace('/<skillmeta>.*?<\/skillmeta>\s*/is', '', $text);
41 $text = preg_replace('/^---\s*\R.*?\R---\s*\R/s', '', $text);
42 return $text;