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

dg / texy / 22262497275

21 Feb 2026 07:01PM UTC coverage: 93.057% (+0.7%) from 92.367%
22262497275

push

github

dg
added CLAUDE.md

2426 of 2607 relevant lines covered (93.06%)

0.93 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 declare(strict_types=1);
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
namespace Texy\Modules;
9

10
use Texy;
11
use function max, strlen;
12

13

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

23
                $texy->registerBlockPattern(
1✔
24
                        $this->pattern(...),
1✔
25
                        '#^(?:' . Texy\Patterns::MODIFIER_H . '\n)?\>([\ \t]++|:)(\S.*+)$#mU', // original
1✔
26
                        'blockquote',
1✔
27
                );
28
        }
1✔
29

30

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

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

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

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

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

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

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

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

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

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