From 5c38b8b25007a86a38f33346927ad19f221c1f27 Mon Sep 17 00:00:00 2001
From: Dennis Eichhorn
Date: Fri, 10 Nov 2023 14:46:56 +0000
Subject: [PATCH] fix markdown
---
Utils/Parser/Markdown/Markdown.php | 14 +++-----------
.../Utils/Parser/Markdown/manualdata/contact.html | 9 ---------
tests/Utils/Parser/Markdown/manualdata/embed.html | 7 +++++--
tests/Utils/Parser/Markdown/manualdata/embed.md | 3 ++-
tests/Utils/Parser/Markdown/manualdata/map.html | 2 +-
.../Parser/Markdown/manualdata/typographer.html | 2 +-
6 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/Utils/Parser/Markdown/Markdown.php b/Utils/Parser/Markdown/Markdown.php
index 8709c5667..cf9c26196 100755
--- a/Utils/Parser/Markdown/Markdown.php
+++ b/Utils/Parser/Markdown/Markdown.php
@@ -448,19 +448,17 @@ class Markdown
// Keystrokes
if ($this->options['keystrokes'] ?? true) {
$this->inlineTypes['['][] = 'Keystrokes';
- $this->inlineMarkerList .= '[';
}
// Spoiler
if ($this->options['spoiler'] ?? false) {
$this->inlineTypes['>'][] = 'Spoiler';
- $this->inlineMarkerList .= '=';
+ $this->inlineMarkerList .= '>';
}
// Inline Math
if ($this->options['math'] ?? false) {
$this->inlineTypes['\\'][] = 'Math';
- $this->inlineMarkerList .= '\\';
$this->inlineTypes['$'][] = 'Math';
$this->inlineMarkerList .= '$';
}
@@ -479,7 +477,6 @@ class Markdown
// Emojis
if ($this->options['emojis'] ?? true) {
$this->inlineTypes[':'][] = 'Emojis';
- $this->inlineMarkerList .= ':';
}
// Typographer
@@ -491,7 +488,6 @@ class Markdown
$this->inlineTypes['+'][] = 'Typographer';
$this->inlineMarkerList .= '+';
$this->inlineTypes['!'][] = 'Typographer';
- $this->inlineMarkerList .= '!';
$this->inlineTypes['?'][] = 'Typographer';
$this->inlineMarkerList .= '?';
}
@@ -515,25 +511,21 @@ class Markdown
// Embeding
if ($this->options['embeding'] ?? false) {
$this->inlineTypes['['][] = 'Embeding';
- $this->inlineMarkerList .= '[';
}
// Map
if ($this->options['map'] ?? false) {
$this->inlineTypes['['][] = 'Map';
- $this->inlineMarkerList .= '[';
}
// Address
if ($this->options['address'] ?? false) {
$this->inlineTypes['['][] = 'Address';
- $this->inlineMarkerList .= '[';
}
// Contact
if ($this->options['contact'] ?? false) {
$this->inlineTypes['['][] = 'Contact';
- $this->inlineMarkerList .= '[';
}
}
@@ -1493,7 +1485,7 @@ class Markdown
protected function inlineContact(array $excerpt) : ?array
{
if (!($this->options['contact'] ?? false)
- || (\preg_match('/\[contact.*?([a-zA-Z]+)="([a-zA-Z0-9\-_]+)"\]/', $excerpt['text'], $matches) !== 1)
+ || (\preg_match('/\[contact.*?([a-zA-Z]+)="(.*?)"\]/', $excerpt['text'], $matches) !== 1)
) {
return null;
}
@@ -2749,7 +2741,7 @@ class Markdown
while ($rowNo + $rowspan < $rowCount
&& $index < \count($rows[$rowNo + $rowspan]['elements'])
&& $rows[$rowNo + $rowspan]['elements'][$index]['handler']['argument'] === '^'
- && (isset($element['attributes']['colspan']) && $element['attributes']['colspan'] ?? null) === ($rows[$rowNo + $rowspan]['elements'][$index]['attributes']['colspan'] ?? null)
+ && ($element['attributes']['colspan'] ?? null) === ($rows[$rowNo + $rowspan]['elements'][$index]['attributes']['colspan'] ?? null)
) {
$rows[$rowNo + $rowspan]['elements'][$index]['merged'] = true;
++$rowspan;
diff --git a/tests/Utils/Parser/Markdown/manualdata/contact.html b/tests/Utils/Parser/Markdown/manualdata/contact.html
index 3b56536b9..e69de29bb 100644
--- a/tests/Utils/Parser/Markdown/manualdata/contact.html
+++ b/tests/Utils/Parser/Markdown/manualdata/contact.html
@@ -1,9 +0,0 @@
-[contact phone="+49 123 456 789"]
-[contact facebook="@jinggaApp"]
-[contact discord="jingga"]
-[contact email="test@email.com"]
-[contact twitter="@jinggaApp"]
-[contact youtube="@jinggaApp"]
-[contact instagram="jinggaApp"]
-[contact slack="jinggaApp"]
-[contact teams="jinggaApp"]
\ No newline at end of file
diff --git a/tests/Utils/Parser/Markdown/manualdata/embed.html b/tests/Utils/Parser/Markdown/manualdata/embed.html
index 401dc2ae1..d30d6762c 100644
--- a/tests/Utils/Parser/Markdown/manualdata/embed.html
+++ b/tests/Utils/Parser/Markdown/manualdata/embed.html
@@ -1,2 +1,5 @@
-[video src="https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab_channel=RickAstley "]
-
\ No newline at end of file
+VIDEO
+
+
+test.mp4
+test.mp3
\ No newline at end of file
diff --git a/tests/Utils/Parser/Markdown/manualdata/embed.md b/tests/Utils/Parser/Markdown/manualdata/embed.md
index 2a26ec6c9..58e47889a 100644
--- a/tests/Utils/Parser/Markdown/manualdata/embed.md
+++ b/tests/Utils/Parser/Markdown/manualdata/embed.md
@@ -1,4 +1,5 @@
[video src="https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab_channel=RickAstley"]
[video src="https://vimeo.com/874474957"]
[video src="https://www.dailymotion.com/video/x3w7rss"]
-[video src="test.mp4"]
\ No newline at end of file
+[video src="test.mp4"]
+[audio src="test.mp3"]
\ No newline at end of file
diff --git a/tests/Utils/Parser/Markdown/manualdata/map.html b/tests/Utils/Parser/Markdown/manualdata/map.html
index 3ee642cbd..876402e3b 100644
--- a/tests/Utils/Parser/Markdown/manualdata/map.html
+++ b/tests/Utils/Parser/Markdown/manualdata/map.html
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/tests/Utils/Parser/Markdown/manualdata/typographer.html b/tests/Utils/Parser/Markdown/manualdata/typographer.html
index 844c366b5..ea5570267 100644
--- a/tests/Utils/Parser/Markdown/manualdata/typographer.html
+++ b/tests/Utils/Parser/Markdown/manualdata/typographer.html
@@ -1 +1 @@
-©
\ No newline at end of file
+©
\ No newline at end of file