From 1091218471b521574797849aa10533636b087772 Mon Sep 17 00:00:00 2001 From: b Date: Sun, 3 Sep 2023 20:47:38 +0000 Subject: [PATCH] Preview is now ready. --- post_common.1.pm | 23 +++++++++++++---------- preview.1.pl | 4 ++-- settings.txt | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/post_common.1.pm b/post_common.1.pm index b32da66..9658d3e 100644 --- a/post_common.1.pm +++ b/post_common.1.pm @@ -41,7 +41,8 @@ use botm_common ( 'system_encoded', 'write_data_file', 'write_postdata_file', - 'html_entity_encode_dec' + 'html_entity_encode_dec', + 'merge_url' ); ###PERL_DEFAULT_PASSWORD: use constant DEFAULT_PASSWORD => 'password'; @@ -1683,16 +1684,18 @@ sub bbcode_to_html { # [/name] # [name=value] # [name="value"] - if($bbcode =~ m/(\[(\/?)([a-z]+|\*)(=(([^\[\]]*)|("[^"]*")))?\])/g) { + if($bbcode =~ m/\[(\/?)([a-z]+|\*)(=(([^\[\]]*)|("[^"]*")))?\]/g) { # assign detected parts: - $tag = $1; - $tag_end = $2; - $tag_name = $3; - $tag_value = $5; + $tag = $&; + $tag_end = $1; + $tag_name = $2; + $tag_value = $4; # text before the tag: - $text = substr($bbcode, 0, pos($bbcode) - length($tag)); + # $text = substr($bbcode, 0, pos($bbcode) - length($tag)); + $text = $`; # cut off already processed part: - $bbcode = substr ($bbcode, pos ($bbcode)); + # $bbcode = substr ($bbcode, pos ($bbcode)); + $bbcode = $'; } # no tag found, only text left else { @@ -2229,10 +2232,10 @@ sub bbcode_to_html { # convert smilies if (($post->{'smilies'}) and ($tag_name !~ /^((code)|(img))$/)) { if ($cmd_options->{'post-style'} eq 'phpbb') { - $text =~ s/(^|[ \t])((:([D\(\)o\?xP\|]|(((shock)|(lol)|(oops)|(cry)|(evil)|(twisted)|(roll)|(wink)|(idea)|(arrow)|(mrgreen)|[!\?]):)))|(8-\))|(;\)))($|[ \t])/' '.$2.' '/gme; + $text =~ s/(^|[ \t])((:([D\(\)o\?xP\|]|(((shock)|(lol)|(oops)|(cry)|(evil)|(twisted)|(roll)|(wink)|(idea)|(arrow)|(mrgreen)|[!\?]):)))|(8-\))|(;\)))($|[ \t])/' '.$2.' '/gme; } else { - $text =~ s/(^|[ \t])((:([D\(\)o\?xP\|]|(((shock)|(lol)|(oops)|(cry)|(evil)|(twisted)|(roll)|(wink)|(idea)|(arrow)|(mrgreen)|[!\?]):)))|(8-\))|(;\)))($|[ \t])/' '.$2.' '/gme; + $text =~ s/(^|[ \t])((:([D\(\)o\?xP\|]|(((shock)|(lol)|(oops)|(cry)|(evil)|(twisted)|(roll)|(wink)|(idea)|(arrow)|(mrgreen)|[!\?]):)))|(8-\))|(;\)))($|[ \t])/' '.$2.' '/gme; } } diff --git a/preview.1.pl b/preview.1.pl index 3335deb..826f966 100644 --- a/preview.1.pl +++ b/preview.1.pl @@ -66,9 +66,9 @@ use constant HELP_TEXT => " --smiley-url=SMILEY_URL\n". " --css-url=CSS_URL\n". " --inline-css\n". - " --post-style=\n". - " phpbb\n". + " --post-style=phpbb\n". " botm\n". + " bsta\n". "\n". " -q, --quiet\n". " -v, --verbose\n". diff --git a/settings.txt b/settings.txt index f14c7a3..8731502 100644 --- a/settings.txt +++ b/settings.txt @@ -16,7 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -_version: 1.0.2 +_version: 1.0.3 _PERL_STR: '@_ESCAPE($0,')' _SHEBANG: #!$0 -- 2.30.2