From: Moritz Bunkus Date: Fri, 21 Oct 2005 14:40:23 +0000 (+0000) Subject: HTML-Markup zulassen und in das entsprechende Ausgabeformat (HTML oder LaTeX) umsetze... X-Git-Tag: release-2.4.0^2~497 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1084d82b1208ac5a0e6f64f67e61fe4163d13e59;p=kivitendo-erp.git HTML-Markup zulassen und in das entsprechende Ausgabeformat (HTML oder LaTeX) umsetzen. Unterstuetzt werden ... (fett), ... (kursiv), ... (unterstrichen) und nur fuer HTML ... (durchgestrichen). --- diff --git a/SL/Form.pm b/SL/Form.pm index f2fe969bc..712f655c2 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1070,6 +1070,32 @@ sub format_string { map { $self->{$_} =~ s/$key/$replace{$format}{$key}/g; } @fields; } + # Allow some HTML markup to be converted into the output format's + # corresponding markup code, e.g. bold or italic. + if ('html' eq $format) { + my @markup_replace = ('b', 'i', 's', 'u'); + + foreach my $key (@markup_replace) { + map({ $self->{$_} =~ s/\<(\/?)${key}\>/<$1${key}>/g } @fields); + } + + } elsif ('tex' eq $format) { + my %markup_replace = ('b' => 'textbf', + 'i' => 'textit', + 'u' => 'underline'); + + foreach my $field (@fields) { + if ($field =~ /descrip/) { + print(STDERR "QFT: ${field}: " . $self->{$field} . "\n"); + } + foreach my $key (keys(%markup_replace)) { + my $new = $markup_replace{$key}; + $self->{$field} =~ + s/\$\<\$${key}\$\>\$(.*?)\$<\$\/${key}\$>\$/\\${new}\{$1\}/gi; + } + } + } + $main::lxdebug->leave_sub(); }