mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 02:59:58 +02:00
TAChart: Escape XML special characters when using svg drawer.
git-svn-id: trunk@55458 -
This commit is contained in:
parent
123e40c66d
commit
43fc0a1324
@ -110,6 +110,22 @@ const
|
||||
var
|
||||
fmtSettings: TFormatSettings;
|
||||
|
||||
function EscapeXML(const AText: String): String;
|
||||
var
|
||||
ch: Char;
|
||||
begin
|
||||
Result := '';
|
||||
for ch in AText do
|
||||
case ch of
|
||||
'<': Result := Result + '<';
|
||||
'>': Result := Result + '>';
|
||||
'"': Result := Result + '"';
|
||||
'''':Result := Result + ''';
|
||||
'&': Result := Result + '&';
|
||||
else Result := Result + ch;
|
||||
end;
|
||||
end;
|
||||
|
||||
function ColorToHex(AColor: TFPColor): String;
|
||||
begin
|
||||
if AColor = colBlack then
|
||||
@ -535,7 +551,7 @@ begin
|
||||
if OpacityStr <> '' then
|
||||
sstyle := sstyle + OpacityStr + ';';
|
||||
|
||||
WriteFmt('<text %s style="%s">%s</text>', [stext, sstyle, AText]);
|
||||
WriteFmt('<text %s style="%s">%s</text>', [stext, sstyle, EscapeXML(AText)]);
|
||||
end;
|
||||
|
||||
function TSVGDrawer.StyleFill: String;
|
||||
|
Loading…
Reference in New Issue
Block a user