+ Check for empty example file name

git-svn-id: trunk@4466 -
This commit is contained in:
michael 2006-08-20 09:44:43 +00:00
parent bc5e1be7b1
commit 7eb023d7cd
5 changed files with 43 additions and 32 deletions

View File

@ -1179,16 +1179,20 @@ end;
function TFPDocEngine.GetExampleFilename(const ExElement: TDOMElement): String; function TFPDocEngine.GetExampleFilename(const ExElement: TDOMElement): String;
var var
i: Integer; i: Integer;
fn : String;
begin begin
Result:='';
for i := 0 to DescrDocs.Count - 1 do for i := 0 to DescrDocs.Count - 1 do
if TDOMDocument(DescrDocs[i]) = ExElement.OwnerDocument then
begin begin
Result := ExtractFilePath(DescrDocNames[i]) + ExElement['file']; Fn:=ExElement['file'];
if (FN<>'') and (TDOMDocument(DescrDocs[i]) = ExElement.OwnerDocument) then
begin
Result := ExtractFilePath(DescrDocNames[i]) + FN;
if (ExtractFileExt(Result)='') then if (ExtractFileExt(Result)='') then
Result:=Result+'.pp'; Result:=Result+'.pp';
exit;
end; end;
SetLength(Result, 0); end;
end; end;

View File

@ -1884,7 +1884,7 @@ Procedure THTMLWriter.AppendExampleSection(AElement : TPasElement;DocNode : TDoc
var var
Node: TDOMNode; Node: TDOMNode;
// TableEl, El, TREl, TDEl, ParaEl, NewEl, DescrEl: TDOMElement; // TableEl, El, TREl, TDEl, ParaEl, NewEl, DescrEl: TDOMElement;
s: String; fn,s: String;
f: Text; f: Text;
begin begin
@ -1894,10 +1894,13 @@ begin
while Assigned(Node) do while Assigned(Node) do
begin begin
if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'example') then if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'example') then
begin
fn:=Engine.GetExampleFilename(TDOMElement(Node));
If (fn<>'') then
begin begin
AppendText(CreateH2(BodyElement), SDocExample); AppendText(CreateH2(BodyElement), SDocExample);
try try
Assign(f, Engine.GetExampleFilename(TDOMElement(Node))); Assign(f, FN);
Reset(f); Reset(f);
try try
PushOutputNode(BodyElement); PushOutputNode(BodyElement);
@ -1920,6 +1923,7 @@ begin
end; end;
end; end;
end; end;
end;
Node := Node.NextSibling; Node := Node.NextSibling;
end; end;
end; end;

View File

@ -918,6 +918,7 @@ begin
while Assigned(Example) do while Assigned(Example) do
begin begin
s:=Engine.GetExampleFileName(Example); s:=Engine.GetExampleFileName(Example);
if (s<>'') then
WriteExampleFile(S); WriteExampleFile(S);
DescrEndParaGraph; DescrEndParaGraph;
Repeat Repeat

View File

@ -592,6 +592,7 @@ begin
while Assigned(Example) do while Assigned(Example) do
begin begin
s:=Engine.GetExampleFileName(Example); s:=Engine.GetExampleFileName(Example);
if (s<>'') then
WriteExampleFile(S); WriteExampleFile(S);
DescrEndParaGraph; DescrEndParaGraph;
Repeat Repeat

View File

@ -842,6 +842,7 @@ begin
if (S<>'') then // not first example, start new paragraph if (S<>'') then // not first example, start new paragraph
DescrBeginParagraph; DescrBeginParagraph;
s:=Engine.GetExampleFileName(Example); s:=Engine.GetExampleFileName(Example);
if (S<>'') then
WriteExampleFile(S); WriteExampleFile(S);
if Assigned(Example.NextSibling) then if Assigned(Example.NextSibling) then
DescrEndParaGraph; DescrEndParaGraph;