Revert "Merge tag 'v2.10.6'"

This reverts commit 122ea4ab9e, reversing
changes made to c54a11e250.
This commit is contained in:
2024-02-16 23:06:09 -06:00
parent 122ea4ab9e
commit 6c08ee9675
521 changed files with 12363 additions and 14503 deletions

View File

@@ -7,12 +7,6 @@ namespace Shimmie2;
class BBCode extends FormatterExtension
{
public function format(string $text): string
{
$text = $this->_format($text);
return "<span class='bbcode'>$text</span>";
}
public function _format(string $text): string
{
$text = $this->extract_code($text);
foreach ([
@@ -103,8 +97,8 @@ class BBCode extends FormatterExtension
}
$beginning = substr($text, 0, $start);
$middle = str_rot13(substr($text, $start + $l1, ($end - $start - $l1)));
$ending = substr($text, $end + $l2, (strlen($text) - $end + $l2));
$middle = str_rot13(substr($text, $start+$l1, ($end-$start-$l1)));
$ending = substr($text, $end + $l2, (strlen($text)-$end+$l2));
$text = $beginning . $middle . $ending;
}
@@ -137,8 +131,8 @@ class BBCode extends FormatterExtension
}
$beginning = substr($text, 0, $start);
$middle = base64_encode(substr($text, $start + $l1, ($end - $start - $l1)));
$ending = substr($text, $end + $l2, (strlen($text) - $end + $l2));
$middle = base64_encode(substr($text, $start+$l1, ($end-$start-$l1)));
$ending = substr($text, $end + $l2, (strlen($text)-$end+$l2));
$text = $beginning . "[code!]" . $middle . "[/code!]" . $ending;
}
@@ -161,10 +155,10 @@ class BBCode extends FormatterExtension
}
$beginning = substr($text, 0, $start);
$middle = base64_decode(substr($text, $start + $l1, ($end - $start - $l1)));
$ending = substr($text, $end + $l2, (strlen($text) - $end + $l2));
$middle = base64_decode(substr($text, $start+$l1, ($end-$start-$l1)));
$ending = substr($text, $end + $l2, (strlen($text)-$end+$l2));
$text = $beginning . "<pre class='code'>" . $middle . "</pre>" . $ending;
$text = $beginning . "<pre>" . $middle . "</pre>" . $ending;
}
return $text;
}

View File

@@ -1,20 +1,18 @@
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll(".shm-clink").forEach(function(el) {
var target_id = el.getAttribute("data-clink-sel");
if(target_id && document.querySelectorAll(target_id).length > 0) {
$(".shm-clink").each(function(idx, elm) {
var target_id = $(elm).data("clink-sel");
if(target_id && $(target_id).length > 0) {
// if the target comment is already on this page, don't bother
// switching pages
el.setAttribute("href", target_id);
$(elm).attr("href", target_id);
// highlight it when clicked
el.addEventListener("click", function(e) {
$(elm).click(function(e) {
// This needs jQuery UI
$(target_id).highlight();
});
// vanilla target name should already be in the URL tag, but this
// will include the anon ID as displayed on screen
el.innerHTML = "@"+document.querySelector(target_id+" .username").innerHTML;
$(elm).html("@"+$(target_id+" .username").html());
}
});
});

View File

@@ -1,15 +1,16 @@
.bbcode PRE.code {
background: #DEDEDE;
font-size: 0.9rem;
CODE {
background: #DEDEDE;
font-size: 0.8em;
}
.bbcode BLOCKQUOTE {
BLOCKQUOTE {
border: 1px solid black;
padding: 8px;
background: #DDD;
}
.bbcode .anchor A.alink {
.anchor A.alink {
visibility: hidden;
}
.bbcode .anchor:hover A.alink {
.anchor:hover A.alink {
visibility: visible;
}

View File

@@ -6,7 +6,7 @@ namespace Shimmie2;
class BBCodeTest extends ShimmiePHPUnitTestCase
{
public function testBasics(): void
public function testBasics()
{
$this->assertEquals(
"<b>bold</b><i>italic</i>",
@@ -14,7 +14,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
);
}
public function testStacking(): void
public function testStacking()
{
$this->assertEquals(
"<b>B</b><i>I</i><b>B</b>",
@@ -26,7 +26,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
);
}
public function testFailure(): void
public function testFailure()
{
$this->assertEquals(
"[b]bold[i]italic",
@@ -34,15 +34,15 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
);
}
public function testCode(): void
public function testCode()
{
$this->assertEquals(
"<pre class='code'>[b]bold[/b]</pre>",
"<pre>[b]bold[/b]</pre>",
$this->filter("[code][b]bold[/b][/code]")
);
}
public function testNestedList(): void
public function testNestedList()
{
$this->assertEquals(
"<ul><li>a<ul><li>a<li>b</ul><li>b</ul>",
@@ -54,7 +54,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
);
}
public function testSpoiler(): void
public function testSpoiler()
{
$this->assertEquals(
"<span style=\"background-color:#000; color:#000;\">ShishNet</span>",
@@ -69,7 +69,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
# "[spoiler]ShishNet");
}
public function testURL(): void
public function testURL()
{
$this->assertEquals(
"<a href=\"https://shishnet.org\">https://shishnet.org</a>",
@@ -85,7 +85,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
);
}
public function testEmailURL(): void
public function testEmailURL()
{
$this->assertEquals(
"<a href=\"mailto:spam@shishnet.org\">spam@shishnet.org</a>",
@@ -93,7 +93,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
);
}
public function testAnchor(): void
public function testAnchor()
{
$this->assertEquals(
'<span class="anchor">Rules <a class="alink" href="#bb-rules" name="bb-rules" title="link to this anchor"> ¶ </a></span>',
@@ -101,19 +101,19 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
);
}
private function filter(string $in): string
private function filter($in): string
{
$bb = new BBCode();
return $bb->_format($in);
return $bb->format($in);
}
private function strip(string $in): string
private function strip($in): string
{
$bb = new BBCode();
return $bb->strip($in);
}
public function testSiteLinks(): void
public function testSiteLinks()
{
$this->assertEquals(
'<a class="shm-clink" data-clink-sel="" href="/test/post/view/123">&gt;&gt;123</a>',