projects
/
webpac
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
support for <br>
[webpac]
/
xmlify.pm
1
#
2
# small function that creates one xml tag
3
#
4
5
# Escape <, >, & and ", and to produce valid XML
6
my %escape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"');
7
my $escape_re = join '|' => keys %escape;
8
9
sub xmlify {
10
my $tag = shift;
11
my $out;
12
13
$out .= " <$tag>";
14
foreach my $v (@_) {
15
$v =~ s/($escape_re)/$escape{$1}/g;
16
$out .= $v;
17
}
18
$out .= "</$tag>\n";
19
return $out;
20
}