From 73c8d7f43dba41bc4644acdb0be935ab4f21fa68 Mon Sep 17 00:00:00 2001 From: b Date: Fri, 5 Jan 2024 09:14:21 +0000 Subject: [PATCH] add bbcode quote tag --- bsta_lib.1.pm | 69 +++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/bsta_lib.1.pm b/bsta_lib.1.pm index 005cde8..91c6cf9 100644 --- a/bsta_lib.1.pm +++ b/bsta_lib.1.pm @@ -138,32 +138,36 @@ use constant CHAT_ACTION => { }; use constant tags_bbcode => { - 'ht' => '', - '/ht' => '', - 'fq' => '[quote]', - '/fq' => '[/quote]', - 'tq' => '[quote]', - '/tq' => '[/quote]', - 'ni' => '[color=#0057AF]', - '/ni' => '[/color]', - 'br' => '[color=#BB6622]', - '/br' => '[/color]', - 'po' => '[color=#FF8800]', - '/po' => '[/color]', - 'url' => '[url]', - 'url=' => '[url=', - 'url/=' => ']', - '/url' => '[/url]', - 'i' => '[i]', - '/i' => '[/i]', - 'list' => '[list]', - 'list=' => '[list=', - 'list/='=> ']', - '/list' => '[/list]', - '*' => '[*]', - '/*' => '[/*]', - '?' => '[unknown!]', - '/?' => '[/unknown!]', + 'ht' => '', + '/ht' => '', + 'fq' => '[quote]', + '/fq' => '[/quote]', + 'tq' => '[quote]', + '/tq' => '[/quote]', + 'quote' => '[quote]', + 'quote=' => '[quote="', + 'quote/='=> '"]', + '/quote' => '[/quote]', + 'ni' => '[color=#0057AF]', + '/ni' => '[/color]', + 'br' => '[color=#BB6622]', + '/br' => '[/color]', + 'po' => '[color=#FF8800]', + '/po' => '[/color]', + 'url' => '[url]', + 'url=' => '[url=', + 'url/=' => ']', + '/url' => '[/url]', + 'i' => '[i]', + '/i' => '[/i]', + 'list' => '[list]', + 'list=' => '[list=', + 'list/=' => ']', + '/list' => '[/list]', + '*' => '[*]', + '/*' => '[/*]', + '?' => '[unknown!]', + '/?' => '[/unknown!]', }; use constant tags_html => { 'ht' => '', @@ -172,6 +176,10 @@ use constant tags_html => { '/fq' => '', 'tq' => '
', '/tq' => '
', + 'quote' => '
', + 'quote=' => '
', + 'quote/='=> ' wrote:
', + '/quote' => '
', 'ni' => '', '/ni' => '', 'br' => '', @@ -445,13 +453,16 @@ sub bbtree { while ($bb ne '') { my $new_ind = $ind.'.'.$bbtree{$ind.'.count'}; - if($bb =~ m/\[(\/?)([a-z]+|\*)(=([^\[\]]*))?\]/g) { + if($bb =~ m/\[(\/?)([A-Za-z]+|\*)(=([^\[\]]*))?\]/g) { $pre_text = $`; $tag = $&; $tag_end = $1; - $tag_name = $2; + $tag_name = lc($2); $tag_value = $4; $bb = $'; + if ($tag_value =~ /^"(.*)"$/) { + $tag_value = $1; + } if ($pre_text ne '') { $debug .= debug($printdebug, "[$new_ind]text: $pre_text\n"); @@ -461,7 +472,7 @@ sub bbtree { $new_ind = $ind.'.'.$bbtree{$ind.'.count'}; } - if($tag_name =~ /^(fq|tq|br|ni|po|url|i|list|\*)$/) { + if($tag_name =~ /^(fq|tq|quote|br|ni|po|url|i|list|\*)$/) { if ($tag_end ne '') { if ( ($tag_name ne $bbtree{$ind.'.name'}) || -- 2.30.2