mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[git-release-notes.pl] html-escape strings in the html output.
This commit is contained in:
@@ -26,6 +26,18 @@ sub text_format {
|
|||||||
print_notes($notes) if ($notes);
|
print_notes($notes) if ($notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# escape_html lifted from https://metacpan.org/source/TOKUHIROM/HTML-Escape-1.10/lib/HTML/Escape/PurePerl.pm.
|
||||||
|
our %_escape_table = ( '&' => '&', '>' => '>', '<' => '<',
|
||||||
|
q{"} => '"', q{'} => ''', q{`} => '`',
|
||||||
|
'{' => '{', '}' => '}' );
|
||||||
|
sub escape_html {
|
||||||
|
my $str = shift;
|
||||||
|
return ''
|
||||||
|
unless defined $str;
|
||||||
|
$str =~ s/([&><"'`{}])/$_escape_table{$1}/ge; #' for poor editors
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
sub html_format_bug {
|
sub html_format_bug {
|
||||||
my $string = shift;
|
my $string = shift;
|
||||||
my $href='"https://bugs.gnucash.org/show_bug.cgi?id=XXXXXX"';
|
my $href='"https://bugs.gnucash.org/show_bug.cgi?id=XXXXXX"';
|
||||||
@@ -34,6 +46,9 @@ sub html_format_bug {
|
|||||||
my $num = $1;
|
my $num = $1;
|
||||||
die "No bug number in $sum" if ! $num;
|
die "No bug number in $sum" if ! $num;
|
||||||
$href =~ s/XXXXXX/$num/;
|
$href =~ s/XXXXXX/$num/;
|
||||||
|
$sum = escape_html($sum);
|
||||||
|
$desc = escape_html($desc);
|
||||||
|
$notes = escape_html($notes);
|
||||||
print "<li><a href=$href>$sum</a>";
|
print "<li><a href=$href>$sum</a>";
|
||||||
print "<p>$desc</p>" if ($desc);
|
print "<p>$desc</p>" if ($desc);
|
||||||
print_notes($notes) if ($notes);
|
print_notes($notes) if ($notes);
|
||||||
@@ -44,6 +59,9 @@ sub html_format_other {
|
|||||||
my $string = shift;
|
my $string = shift;
|
||||||
my ($sum, $desc, $notes) = split('\<\|\>', $string);
|
my ($sum, $desc, $notes) = split('\<\|\>', $string);
|
||||||
die "No summary in $string" if not $sum;
|
die "No summary in $string" if not $sum;
|
||||||
|
$sum = escape_html($sum);
|
||||||
|
$desc = escape_html($desc);
|
||||||
|
$notes = escape_html($notes);
|
||||||
print "<li>$sum";
|
print "<li>$sum";
|
||||||
print "<p>$desc</p>" if ($desc);
|
print "<p>$desc</p>" if ($desc);
|
||||||
print_notes($notes) if ($notes);
|
print_notes($notes) if ($notes);
|
||||||
|
|||||||
Reference in New Issue
Block a user