+ 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;
var
i: Integer;
fn : String;
begin
Result:='';
for i := 0 to DescrDocs.Count - 1 do
if TDOMDocument(DescrDocs[i]) = ExElement.OwnerDocument then
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
Result:=Result+'.pp';
exit;
end;
SetLength(Result, 0);
end;
end;

View File

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

View File

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

View File

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

View File

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