Testovací

Something

 1: <?php
 2: namespace App\Model;
 3: 
 4: use \Texy\Texy;
 5: use \FSHL;
 6: use \FSHL\Highlighter;
 7: use \FSHL\Lexer;
 8: 
 9: class FshlTexy extends \Texy\Texy
10: {
11:     public function blockHandler($invocation, $blocktype, $content, $lang, $modifier)
12:     {
13:         if ($blocktype !== 'block/code') {
14:             return $invocation->proceed();
15:         }
16: 
17:         $highlighter = new \FSHL\Highlighter(
18:             new \FSHL\Output\Html(),
19:             Highlighter::OPTION_TAB_INDENT | Highlighter::OPTION_LINE_COUNTER
20:         );
21: 
22:         $texy = $invocation->getTexy();
23:         $content = Texy::outdent($content);
24: 
25:         switch (strtoupper($lang)) {
26:             case 'CPP':
27:                 $lexer = new Lexer\Cpp();
28:                 break;
29:             case 'CSS':
30:                 $lexer = new Lexer\Css();
31:                 break;
32:             case 'HTML':
33:                 $lexer = new Lexer\Html();
34:                 break;
35:             case 'JAVA':
36:                 $lexer = new Lexer\Java();
37:                 break;
38:             case 'JAVASCRIPT':
39:                 $lexer = new Lexer\Javascript();
40:                 break;
41:             case 'NEON':
42:                 $lexer = new Lexer\Neon();
43:                 break;
44:             case 'PHP':
45:                 $lexer = new Lexer\Php();
46:                 break;
47:             case 'PYTHON':
48:                 $lexer = new Lexer\Python();
49:                 break;
50:             case 'SQL':
51:                 $lexer = new Lexer\Sql();
52:                 break;
53:             case 'TEX':
54:                 $lexer = new Lexer\Tex();
55:                 break;
56:             case 'TEXY':
57:                 $lexer = new Lexer\Texy();
58:                 break;
59:             default:
60:                 $lexer = new Lexer\Minimal();
61:                 break;
62:         }
63: 
64:         //$content = $highlighter->highlight($content, $lexer);
65:         $highlighter->setLexer($lexer);
66:         $content = $highlighter->highlight($content, $lexer);
67:         $content = $texy->protect($content, Texy::CONTENT_BLOCK);
68: 
69:         $elPre = \Texy\HtmlElement::el('pre');
70: 
71:         if ($modifier) {
72:             $modifier->decorate($texy, $elPre);
73:         }
74: 
75:         $elPre->attrs['class'] = strtolower($lang);
76:         $elCode = $elPre->create('code', $content);
77:         return $elPre;
78:     }
79: }
1: var count = 123;
příklad: **this is not strong**