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

dg / texy / 22262381750

25 Jan 2026 11:44PM UTC coverage: 92.367% (-0.7%) from 93.057%
22262381750

push

github

dg
cs

9 of 11 new or added lines in 8 files covered. (81.82%)

161 existing lines in 23 files now uncovered.

2384 of 2581 relevant lines covered (92.37%)

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
 * Blockquote module.
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->pattern(...),
1✔
27
                        '#^(?:' . Texy\Patterns::MODIFIER_H . '\n)?\>([\ \t]++|:)(\S.*+)$#mU', // original
1✔
28
                        'blockquote',
1✔
29
                );
30
        }
1✔
31

32

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

49
                $texy = $this->texy;
1✔
50

51
                $el = new Texy\HtmlElement('blockquote');
1✔
52
                $mod = new Texy\Modifier($mMod);
1✔
53
                $mod->decorate($texy, $el);
1✔
54

55
                $content = '';
1✔
56
                $spaces = '';
1✔
57
                do {
58
                        if ($spaces === '') {
1✔
59
                                $spaces = max(1, strlen($mPrefix));
1✔
60
                        }
61
                        $content .= $mContent . "\n";
1✔
62

63
                        if (!$parser->next("#^>(?:|([\\ \\t]{1,$spaces}|:)(.*))()$#mA", $matches)) {
1✔
64
                                break;
1✔
65
                        }
66

67
                        [, $mPrefix, $mContent] = $matches;
1✔
68
                } while (true);
1✔
69

70
                $el->parseBlock($texy, $content, $parser->isIndented());
1✔
71

72
                // no content?
73
                if (!$el->count()) {
1✔
UNCOV
74
                        return null;
×
75
                }
76

77
                // event listener
78
                $texy->invokeHandlers('afterBlockquote', [$parser, $el, $mod]);
1✔
79

80
                return $el;
1✔
81
        }
82
}
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