Skip to content

Commit b1e5ac3

Browse files
committed
Fixed trailing spaces
1 parent d603ec5 commit b1e5ac3

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

Diff for: phpdotnet/phd/Package/Generic/XHTML.php

+25-25
Original file line numberDiff line numberDiff line change
@@ -1753,73 +1753,73 @@ public function format_constant($open, $name, $attrs, $props)
17531753
}
17541754
return "<strong><code>";
17551755
}
1756-
1756+
17571757
if ($this->getRole() === "constant_group") {
17581758
$this->popRole();
1759-
1759+
17601760
$value = str_replace(
17611761
["<replaceable xmlns=\"http://docbook.org/ns/docbook\">", "</replaceable>"],
17621762
["<span class=\"replaceable\">", "</span>"],
17631763
strip_tags($this->cchunk["constant"], "<replaceable>")
17641764
);
1765-
1765+
17661766
$link = $this->createReplaceableConstantLink(strip_tags($this->cchunk["constant"], "<replaceable>"));
17671767
$this->cchunk["constant"] = "";
1768-
1768+
17691769
if ($link === "") {
17701770
return $value . '</code></strong>';
17711771
}
1772-
1772+
17731773
return '<a href="' . $link . '">' . $value . '</a></code></strong>';
17741774
}
17751775
return "</code></strong>";
17761776
}
17771777

17781778
/**
1779-
* Creates a link to the first constant in the index
1779+
* Creates a link to the first constant in the index
17801780
* that matches the pattern of a constant containing a <replaceable> tag
17811781
* or returns an empty string if no match was found.
1782-
*
1782+
*
17831783
* This works only with one set of <replaceable> tags in a constant
17841784
* e.g. CURLE_<replaceable>*</replaceable> or DOM_<replaceable>*</replaceable>_NODE
17851785
*/
17861786
private function createReplaceableConstantLink(string $constant): string {
17871787
$pattern = "/" . preg_replace(
1788-
"/<replaceable.*<\/replaceable>/",
1789-
".*",
1788+
"/<replaceable.*<\/replaceable>/",
1789+
".*",
17901790
str_replace(
1791-
".",
1792-
"\.",
1791+
".",
1792+
"\.",
17931793
$this->convertConstantNameToId($constant)
17941794
)
17951795
) ."/";
1796-
1796+
17971797
$matchingConstantId = "";
17981798
foreach ($this->indexes as $index) {
17991799
if (preg_match($pattern, $index["docbook_id"])) {
18001800
$matchingConstantId = $index["docbook_id"];
18011801
break;
18021802
}
18031803
}
1804-
1804+
18051805
return $matchingConstantId === "" ? "" : $this->createLink($matchingConstantId);
18061806
}
1807-
1807+
18081808
private function convertConstantNameToId(string $constantName): string {
18091809
$tempLinkValue = str_replace(
18101810
array("\\", "_"),
18111811
array("-", "-"),
18121812
trim($this->normalizeFQN($constantName), "_")
18131813
);
1814-
1814+
18151815
if (str_contains($constantName, '::')) {
18161816
// class constant
18171817
list($extensionAndClass, $constant) = explode("::", $tempLinkValue);
18181818
$normalizedLinkFormat = $extensionAndClass . ".constants." . trim($constant, "-");
18191819
} else {
18201820
$normalizedLinkFormat = 'constant.' . $tempLinkValue;
18211821
}
1822-
1822+
18231823
return $normalizedLinkFormat;
18241824
}
18251825

@@ -1829,7 +1829,7 @@ public function format_constant_text($value, $tag) {
18291829
}
18301830

18311831
$normalizedLinkFormat = $this->convertConstantNameToId($value);
1832-
1832+
18331833
$link = $this->createLink($normalizedLinkFormat);
18341834

18351835
if ($link === null) {
@@ -1844,34 +1844,34 @@ public function format_replaceable($open, $name, $attrs, $props) {
18441844
}
18451845
return false;
18461846
}
1847-
1847+
18481848
public function format_property_text($value, $tag) {
18491849
if (! str_contains($value, '::')) {
18501850
return $value;
18511851
}
1852-
1852+
18531853
$tempLinkValue = str_replace(
18541854
["\\", "_", "$"],
18551855
["-", "-", ""],
18561856
trim($this->normalizeFQN($value), "_")
18571857
);
1858-
1858+
18591859
list($extensionAndClass, $property) = explode("::", $tempLinkValue);
18601860
$normalizedLinkFormat = $extensionAndClass . ".props." . trim($property, "-");
1861-
1861+
18621862
$link = $this->createLink($normalizedLinkFormat);
1863-
1863+
18641864
if ($link === null || $link === "") {
18651865
return $value;
18661866
}
1867-
1867+
18681868
return '<a href="' . $link . '">' . $value . '</a>';
18691869
}
1870-
1870+
18711871
protected function normalizeFQN(string $fqn): string {
18721872
return \ltrim(\strtolower($fqn), "\\");
18731873
}
1874-
1874+
18751875
public function admonition_title($title, $lang)
18761876
{
18771877
return '<strong class="' .(strtolower($title)). '">' .($this->autogen($title, $lang)). '</strong>';

0 commit comments

Comments
 (0)