mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:09:20 +02:00
+ Check for empty example file name
git-svn-id: trunk@4466 -
This commit is contained in:
parent
bc5e1be7b1
commit
7eb023d7cd
@ -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;
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -918,6 +918,7 @@ begin
|
||||
while Assigned(Example) do
|
||||
begin
|
||||
s:=Engine.GetExampleFileName(Example);
|
||||
if (s<>'') then
|
||||
WriteExampleFile(S);
|
||||
DescrEndParaGraph;
|
||||
Repeat
|
||||
|
@ -592,6 +592,7 @@ begin
|
||||
while Assigned(Example) do
|
||||
begin
|
||||
s:=Engine.GetExampleFileName(Example);
|
||||
if (s<>'') then
|
||||
WriteExampleFile(S);
|
||||
DescrEndParaGraph;
|
||||
Repeat
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user