From d46fe6e898c09416441f2cbd7b15fc43f89ec348 Mon Sep 17 00:00:00 2001 From: elektrischerwalfisch Date: Fri, 11 Apr 2025 23:22:57 +0200 Subject: [PATCH] mail-shortcode --- pages-en/contact.md | 4 +++- theme/mailto.php | 11 +++++++++++ theme/shortcodes.php | 9 +++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 theme/mailto.php diff --git a/pages-en/contact.md b/pages-en/contact.md index eb4b541..26024ad 100644 --- a/pages-en/contact.md +++ b/pages-en/contact.md @@ -1,3 +1,5 @@ # Contact -... \ No newline at end of file +You got questions about flatmark or you want me to build a flatMark-website for you? + +Just {mail}contact me!{/mail} diff --git a/theme/mailto.php b/theme/mailto.php new file mode 100644 index 0000000..a3793ce --- /dev/null +++ b/theme/mailto.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/theme/shortcodes.php b/theme/shortcodes.php index 2d1e5c4..f3ed2e3 100644 --- a/theme/shortcodes.php +++ b/theme/shortcodes.php @@ -77,8 +77,6 @@ return '
' . $bgHtml . '
'; }, $markdown); - - // Shortcode: img rounded $pattern = '/\{img-rounded\}(.*?)\{\/img-rounded\}/s'; $markdown = preg_replace_callback($pattern, function ($matches) use ($Parsedown) { @@ -87,6 +85,13 @@ return '
' . $imgRounded . '
'; }, $markdown); + // Shortcode: mail link + $pattern = '/\{mail\}(.*?)\{\/mail\}/s'; + $markdown = preg_replace_callback($pattern, function ($matches) { + $linkText = trim($matches[1]); + return '' . htmlspecialchars($linkText) . ''; + }, $markdown); + // Shortcode: output readme-file $pattern = '/\{readme\}/s'; $markdown = preg_replace_callback($pattern, function () use ($Parsedown) { -- 2.47.3