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

dg / texy / 21344532034

26 Jan 2026 02:43AM UTC coverage: 91.98% (-0.4%) from 92.376%
21344532034

push

github

dg
added CLAUDE.md

2397 of 2606 relevant lines covered (91.98%)

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->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
         * @param  string[]  $matches
42
         */
43
        public function pattern(Texy\BlockParser $parser, array $matches): ?Texy\HtmlElement
1✔
44
        {
45
                [, $mMod, $mPrefix, $mContent] = $matches;
1✔
46
                // [1] => .(title)[class]{style}<>
47
                // [2] => spaces |
48
                // [3] => ... / LINK
49

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

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

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

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

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

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

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

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

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