From: Nicolas Boisselier Date: Mon, 4 Dec 2023 00:28:21 +0000 (+0100) Subject: cgi_text new line X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=6447423a9844479cfa7332931d38ee7e1f20b479;p=nb.git cgi_text new line --- diff --git a/lib/perl/NB/CGI.pm b/lib/perl/NB/CGI.pm index aec5d1b0..d332a0e2 100644 --- a/lib/perl/NB/CGI.pm +++ b/lib/perl/NB/CGI.pm @@ -21,6 +21,7 @@ $CGI::PARAM_UTF8 = 1; #&CGI::init; # NB 01.12.23 &CGI::charset('utf-8') if $CGI::PARAM_UTF8; my $NO_HEADERS = 0; +my $TEXT_OUTPUT = 0; sub new { my $cgi = &CGI::new(@_); @@ -31,13 +32,13 @@ sub new { return $cgi; } -my $isTextOutput = 0; sub textOutput {{ no warnings 'redefine'; no warnings 'once'; #return unless $Opt{html}; - $isTextOutput = 1; + $TEXT_OUTPUT = 1; + $CGI::CRLF = ''; *CGI::_tag_func = sub { my $tagname = shift; my ($q,$a,@rest) = CGI::self_or_default(@_); @@ -46,8 +47,10 @@ sub textOutput {{ #warn $tagname; return ''; my($attr) = ''; + my %attr; if (ref($a) && ref($a) eq 'HASH') { my(@attr) = CGI::make_attributes($a,$q->{'escape'}); + %attr = %$a; $attr = " @attr" if @attr; } else { unshift @rest,$a if defined $a; @@ -56,8 +59,10 @@ sub textOutput {{ $tagname = lc( $tagname ); my @result = (ref($rest[0]) eq 'ARRAY') ? @{$rest[0]} : "@rest"; - if (0) + #warn Dumper(\%attr) if $tagname eq 'a';; + if (exists $attr{cgi_text}) { + @result = ($attr{cgi_text},"\n") if $attr{cgi_text}; } # H. elsif ($tagname =~ /^h(\d+)$/) @@ -311,6 +316,6 @@ sub tag { } sub text { - return $isTextOutput; + return $TEXT_OUTPUT; } 1;