diff options
Diffstat (limited to 'AdminPanel/Rpmdragora/formatting.pm')
-rw-r--r-- | AdminPanel/Rpmdragora/formatting.pm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/AdminPanel/Rpmdragora/formatting.pm b/AdminPanel/Rpmdragora/formatting.pm index 3d650a4f..ccbdf0c8 100644 --- a/AdminPanel/Rpmdragora/formatting.pm +++ b/AdminPanel/Rpmdragora/formatting.pm @@ -29,6 +29,7 @@ use utf8; use POSIX qw(strftime); use AdminPanel::rpmdragora; use lib qw(/usr/lib/libDrakX); +use MDK::Common::Various; # included for internal_error subroutine use common; #use ugtk2 qw(escape_text_for_TextView_markup_format); @@ -54,6 +55,19 @@ our @EXPORT = qw( ); +sub escape_text_for_TextView_markup_format { + my ($str) = @_; + my %rules = ('&' => '&', + '<' => '<', + '>' => '>', + ); + eval { $str =~ s!([&<>])!$rules{$1}!g }; #^(&(amp|lt|gt);)!!) { + if (my $err = $@) { + internal_error("$err\n$str"); + } + $str; +} + # from rpmtools, #37482: sub ensure_utf8 { if (utf8::is_utf8($_[0])) { |