IN FILE formatter.pas
uses
DomCore, Classes;
(Not required if you can do this better without
TStringList).
function IndentText(S: TDomString; Depth: Integer):
TDomString;
var
Str: string;
TmpStr: TStringList;
I, J: Integer;
begin
TmpStr := TStringList.Create;
try
TmpStr.Text := S;
for I := 1 to TmpStr.Count - 1 do
// Start at 1, don't indent first line with <!--
begin
Str := TrimLeftSpaces
(TmpStr[I]);
SetLength(Str, Length(Str)
+ Depth);
for J := Length(Str) downto
Depth + 1 do
Str[J] := Str[J -
Depth];
for J := Depth downto 1 do
Str[J] := #9;
TmpStr[I] := Str;
end;
Result := TmpStr.Text;
SetLength(Result, Length(Result) -
2); // Remove trailing #D#A added by TStringList
finally
TmpStr.Free;
end;
end;
procedure TBaseFormatter.ProcessComment(Comment:
TComment);
begin
AppendText('')
end;