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

dg / texy / 22283286087

22 Feb 2026 06:58PM UTC coverage: 93.01% (+0.02%) from 92.991%
22283286087

push

github

dg
LinkModule: deprecated label and modifiers in link definitions

3 of 3 new or added lines in 1 file covered. (100.0%)

72 existing lines in 16 files now uncovered.

2089 of 2246 relevant lines covered (93.01%)

0.93 hits per line

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

96.43
/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(
1✔
20
                private Texy\Texy $texy,
21
        ) {
22
        }
1✔
23

24

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

39

40
        /**
41
         * Parses blockquote.
42
         * @param  array<?string>  $matches
43
         */
44
        public function parse(Texy\BlockParser $parser, array $matches): ?Texy\HtmlElement
1✔
45
        {
46
                /** @var array{string, ?string, string, string} $matches */
47
                [, $mMod, $mPrefix, $mContent] = $matches;
1✔
48
                // [1] => .(title)[class]{style}<>
49
                // [2] => spaces |
50
                // [3] => ... / LINK
51

52
                $texy = $this->texy;
1✔
53

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

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

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

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

73
                $el->parseBlock($texy, $content, $parser->isIndented());
1✔
74

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

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

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