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

dg / texy / 43069517462

11 Nov 2026 05:15PM UTC coverage: 96.934% (+0.3%) from 96.641%
43069517462

push

github

dg
PhraseNode: $type is what the phrase means, $syntax how it is written

PhraseNode::$type is the enum PhraseType, PhraseNode::$syntax the name of the
syntax, as LinkNode has it; Syntax::PhraseTypes says what the phrase syntaxes
mean. Html\Config::$phraseTags is keyed by the values of PhraseType plus 'code',
so one tag serves every notation of a meaning and the PhraseVariants table is
gone. The compatibility layer converts the keys of Texy 3, the syntax names,
with a deprecation, when parsing and when creating the HTML renderer;
Compat\Texy3::moveSwitches() is moveSettings() for it. The Texy printer writes
a phrase in its own notation while that means its type, otherwise, as for one
from Markdown, in the default notation of the meaning.

3a3a923d-ad0b-441d-8e6c-67a0d34075bf

30 of 30 new or added lines in 5 files covered. (100.0%)

24 existing lines in 12 files now uncovered.

3826 of 3947 relevant lines covered (96.93%)

0.97 hits per line

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

93.75
/src/Nodes/HtmlTagNode.php
1
<?php declare(strict_types=1);
2

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

8
namespace Texy\Nodes;
9

10
use Texy\Range;
11

12

13
/**
14
 * HTML tag.
15
 * <article title=hello>
16
 */
17
class HtmlTagNode extends InlineNode
18
{
19
        public function __construct(
1 ✔
20
                public string $name,
21
                /** @var array<string, string|bool|null> HTML attributes */
22
                public array $attributes = [],
23
                public bool $closing = false,
24
                public bool $selfClosing = false,
25
                public ?Range $range = null,
26
                /** the tag as written, shown when it is rejected */
27
                public ?string $source = null,
28
        ) {
29
        }
1 ✔
30

31

32
        /**
33
         * Returns the tag as written; a tag the parser did not make is rebuilt from its attributes.
34
         */
35
        public function toSource(): string
36
        {
37
                if ($this->source !== null) {
1 ✔
38
                        return strtr($this->source, "\r", "\n"); // \r is the hard break mark of a paragraph
1 ✔
39
                }
40

41
                $tag = '<';
1 ✔
42
                if ($this->closing) {
1 ✔
43
                        $tag .= '/';
1 ✔
44
                }
45
                $tag .= $this->name;
1 ✔
46
                foreach ($this->attributes as $name => $value) {
1 ✔
47
                        $tag .= ' ' . $name;
1 ✔
48
                        if ($value !== true) {
1 ✔
49
                                $tag .= '="' . $value . '"';
1 ✔
50
                        }
51
                }
52
                if ($this->selfClosing) {
1 ✔
UNCOV
53
                        $tag .= ' /';
×
54
                }
55

56
                return $tag . '>';
1 ✔
57
        }
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc