From 85f2addd9be287bfc2226e3a08c29efc0c0131d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20K=C3=B6hler?= Date: Thu, 24 Nov 2005 16:42:13 +0000 Subject: [PATCH] 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). --- SL/Form.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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(); } -- 2.20.1