From: Stephan Köhler Date: Thu, 24 Nov 2005 16:42:13 +0000 (+0000) Subject: Merge von 588 aus unstable: X-Git-Tag: release-2.2.0~104 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=85f2addd9be287bfc2226e3a08c29efc0c0131d2;p=kivitendo-erp.git Merge von 588 aus unstable: 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 62a76e710..9253f419d 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1035,6 +1035,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(); }