• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dg / texy / 21345344909

26 Jan 2026 03:32AM UTC coverage: 92.382% (-0.4%) from 92.744%
21345344909

push

github

dg
HtmlElement: removed toHtml() & toText()

18 of 19 new or added lines in 5 files covered. (94.74%)

149 existing lines in 21 files now uncovered.

2401 of 2599 relevant lines covered (92.38%)

0.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.3
/src/Texy/Modules/BlockQuoteModule.php
1
<?php
2

3
/**
4
 * This file is part of the Texy! (https://texy.nette.org)
5
 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
 */
7

8
declare(strict_types=1);
9

10
namespace Texy\Modules;
11

12
use Texy;
13
use function max, strlen;
14

15

16
/**
17
 * Processes blockquote syntax with nested content.
18
 */
19
final class BlockQuoteModule extends Texy\Module
20
{
21
        public function __construct(Texy\Texy $texy)
1✔
22
        {
23
                $this->texy = $texy;
1✔
24

25
                $texy->registerBlockPattern(
1✔
26
                        $this->parse(...),
1✔
27
                        '~^
28
                                (?: ' . Texy\Patterns::MODIFIER_H . '\n)? # modifier (1)
1✔
29
                                >                                      # blockquote char
30
                                ( [ \t]++ | : )                        # space/tab or colon (2)
31
                                ( \S.*+ )                              # content (3)
32
                        $~mU',
33
                        'blockquote',
1✔
34
                );
35
        }
1✔
36

37

38
        /**
39
         * Callback for:.
40
         *
41
         * > They went in single file, running like hounds on a strong scent,
42
         * and an eager light was in their eyes. Nearly due west the broad
43
         * swath of the marching Orcs tramped its ugly slot; the sweet grass
44
         * of Rohan had been bruised and blackened as they passed.
45
         * >:http://www.mycom.com/tolkien/twotowers.html
46
         * @param  string[]  $matches
47
         */
48
        public function parse(Texy\BlockParser $parser, array $matches): ?Texy\HtmlElement
1✔
49
        {
50
                [, $mMod, $mPrefix, $mContent] = $matches;
1✔
51
                // [1] => .(title)[class]{style}<>
52
                // [2] => spaces |
53
                // [3] => ... / LINK
54

55
                $texy = $this->texy;
1✔
56

57
                $el = new Texy\HtmlElement('blockquote');
1✔
58
                $mod = new Texy\Modifier($mMod);
1✔
59
                $mod->decorate($texy, $el);
1✔
60

61
                $content = '';
1✔
62
                $spaces = '';
1✔
63
                do {
64
                        if ($spaces === '') {
1✔
65
                                $spaces = max(1, strlen($mPrefix));
1✔
66
                        }
67
                        $content .= $mContent . "\n";
1✔
68

69
                        if (!$parser->next("~^>(?: | ([ \\t]{1,$spaces} | :) (.*))$~mA", $matches)) {
1✔
70
                                break;
1✔
71
                        }
72

73
                        [, $mPrefix, $mContent] = $matches;
1✔
74
                } while (true);
1✔
75

76
                $el->inject($texy->parseBlock($content, $parser->isIndented()));
1✔
77

78
                // no content?
79
                if (!$el->count()) {
1✔
UNCOV
80
                        return null;
×
81
                }
82

83
                // event listener
84
                $texy->invokeHandlers('afterBlockquote', [$parser, $el, $mod]);
1✔
85

86
                return $el;
1✔
87
        }
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc