mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 20:59:06 +02:00
* fixed reading / writing example tag
* fixed memleak git-svn-id: trunk@9389 -
This commit is contained in:
parent
20698952d6
commit
d661a50e37
@ -490,8 +490,10 @@ begin
|
|||||||
if S = 'seealso' then
|
if S = 'seealso' then
|
||||||
Result[SEEALSO] := GetFirstChildValue(Node);
|
Result[SEEALSO] := GetFirstChildValue(Node);
|
||||||
|
|
||||||
if S = 'example' then
|
if S = 'example' then begin
|
||||||
Result[EXAMPLE] := GetFirstChildValue(Node);
|
Result[EXAMPLE] := Node.Attributes.GetNamedItem('file').NodeValue;
|
||||||
|
writeln('TLazDocForm.ElementFromNode example: ',Result[EXAMPLE]);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
Node := Node.NextSibling;
|
Node := Node.NextSibling;
|
||||||
end;
|
end;
|
||||||
@ -593,6 +595,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
FreeAndNil(FCurrentElement);
|
||||||
FCurrentElement := NewElement;
|
FCurrentElement := NewElement;
|
||||||
|
|
||||||
UpdateCaption;
|
UpdateCaption;
|
||||||
@ -611,7 +614,7 @@ begin
|
|||||||
LinkListBox.Items.Text := ConvertLineEndings(dn[SEEALSO]);
|
LinkListBox.Items.Text := ConvertLineEndings(dn[SEEALSO]);
|
||||||
LinkIdComboBox.Text := '';
|
LinkIdComboBox.Text := '';
|
||||||
LinkTextEdit.Clear;
|
LinkTextEdit.Clear;
|
||||||
ExampleEdit.Text := Copy(dn[EXAMPLE], 16, Length(dn[EXAMPLE]) - 19);
|
ExampleEdit.Text := ConvertLineEndings(dn[EXAMPLE]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -691,9 +694,27 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure CheckAndWriteExampleNode(NodeText: String);
|
||||||
|
var
|
||||||
|
FileAttribute: TDOMAttr;
|
||||||
|
begin
|
||||||
|
{$ifdef dbgLazDoc}
|
||||||
|
DebugLn('TLazDocForm.Save[CheckAndWriteExampleNode]');
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
if S = 'example' then
|
||||||
|
begin
|
||||||
|
FileAttribute := doc.CreateAttribute('file');
|
||||||
|
FileAttribute.Value := NodeText;
|
||||||
|
node.Attributes.SetNamedItem(FileAttribute);
|
||||||
|
NodeWritten[EXAMPLE] := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure InsertNodeElement(ElementName: String; ElementText: String);
|
procedure InsertNodeElement(ElementName: String; ElementText: String);
|
||||||
var
|
var
|
||||||
child: TDOMNode;
|
child: TDOMNode;
|
||||||
|
FileAttribute: TDOMAttr;
|
||||||
begin
|
begin
|
||||||
{$ifdef dbgLazDoc}
|
{$ifdef dbgLazDoc}
|
||||||
DebugLn('TLazDocForm.Save[InsertNodeElement]: inserting element: ' +
|
DebugLn('TLazDocForm.Save[InsertNodeElement]: inserting element: ' +
|
||||||
@ -701,10 +722,16 @@ var
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
child := doc.CreateElement(ElementName);
|
child := doc.CreateElement(ElementName);
|
||||||
child.AppendChild(doc.CreateTextNode(ToUnixLineEnding(ElementText)));
|
if ElementName='example' then begin
|
||||||
|
FileAttribute := doc.CreateAttribute('file');
|
||||||
|
FileAttribute.Value := ElementText;
|
||||||
|
child.Attributes.SetNamedItem(FileAttribute);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
child.AppendChild(doc.CreateTextNode(ToUnixLineEnding(ElementText)));
|
||||||
Node.AppendChild(child);
|
Node.AppendChild(child);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// nothing changed, so exit
|
// nothing changed, so exit
|
||||||
if not FChanged then
|
if not FChanged then
|
||||||
@ -731,8 +758,7 @@ begin
|
|||||||
CheckAndWriteNode('descr', DescrMemo.Text, DESCR);
|
CheckAndWriteNode('descr', DescrMemo.Text, DESCR);
|
||||||
CheckAndWriteNode('errors', ErrorsMemo.Text, ERRORS);
|
CheckAndWriteNode('errors', ErrorsMemo.Text, ERRORS);
|
||||||
CheckAndWriteNode('seealso', LinkListBox.Text, SEEALSO);
|
CheckAndWriteNode('seealso', LinkListBox.Text, SEEALSO);
|
||||||
CheckAndWriteNode('example', '<example file="' +
|
CheckAndWriteExampleNode(ExampleEdit.Text);
|
||||||
ExampleEdit.Text + '"/>', EXAMPLE);
|
|
||||||
end;
|
end;
|
||||||
Node := Node.NextSibling;
|
Node := Node.NextSibling;
|
||||||
end;
|
end;
|
||||||
@ -751,8 +777,7 @@ begin
|
|||||||
SEEALSO:
|
SEEALSO:
|
||||||
InsertNodeElement('seealso', LinkListBox.Text);
|
InsertNodeElement('seealso', LinkListBox.Text);
|
||||||
EXAMPLE:
|
EXAMPLE:
|
||||||
InsertNodeElement('example', '<example file="' +
|
InsertNodeElement('example', ExampleEdit.Text);
|
||||||
ExampleEdit.Text + '"/>');
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
WriteXMLFile(doc, FDocFileName);
|
WriteXMLFile(doc, FDocFileName);
|
||||||
|
Loading…
Reference in New Issue
Block a user