mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 07:09:23 +02:00
* Add context info to unresolved links, for better error info
git-svn-id: trunk@23471 -
This commit is contained in:
parent
5783f6d172
commit
1c9ad777d3
@ -47,7 +47,7 @@ resourcestring
|
|||||||
|
|
||||||
SErrDescrTagUnknown = 'Warning: Unknown tag "%s" in description';
|
SErrDescrTagUnknown = 'Warning: Unknown tag "%s" in description';
|
||||||
SErrUnknownEntityReference = 'Warning: Unknown entity reference "&%s;" found';
|
SErrUnknownEntityReference = 'Warning: Unknown entity reference "&%s;" found';
|
||||||
SErrUnknownLinkID = 'Warning: Target ID of <link> in unit "%s" is unknown: "%s"';
|
SErrUnknownLinkID = 'Warning: Target ID of <link> in unit "%s", element "%s", is unknown: "%s"';
|
||||||
SErrUnknownPrintShortID = 'Warning: Target ID of <printshort> is unknown: "%s"';
|
SErrUnknownPrintShortID = 'Warning: Target ID of <printshort> is unknown: "%s"';
|
||||||
SErrUnknownLink = 'Could not resolve link to "%s"';
|
SErrUnknownLink = 'Could not resolve link to "%s"';
|
||||||
SErralreadyRegistered = 'Class for output format "%s" already registered';
|
SErralreadyRegistered = 'Class for output format "%s" already registered';
|
||||||
@ -75,6 +75,7 @@ type
|
|||||||
FEmitNotes: Boolean;
|
FEmitNotes: Boolean;
|
||||||
FEngine : TFPDocEngine;
|
FEngine : TFPDocEngine;
|
||||||
FPackage : TPasPackage;
|
FPackage : TPasPackage;
|
||||||
|
FContext : TPasElement;
|
||||||
FTopics : TList;
|
FTopics : TList;
|
||||||
FImgExt : String;
|
FImgExt : String;
|
||||||
FBeforeEmitNote : TWriterNoteEvent;
|
FBeforeEmitNote : TWriterNoteEvent;
|
||||||
@ -159,6 +160,7 @@ type
|
|||||||
procedure DescrEndTableRow; virtual; abstract;
|
procedure DescrEndTableRow; virtual; abstract;
|
||||||
procedure DescrBeginTableCell; virtual; abstract;
|
procedure DescrBeginTableCell; virtual; abstract;
|
||||||
procedure DescrEndTableCell; virtual; abstract;
|
procedure DescrEndTableCell; virtual; abstract;
|
||||||
|
Property CurrentContext : TPasElement Read FContext ;
|
||||||
public
|
public
|
||||||
Constructor Create(APackage: TPasPackage; AEngine: TFPDocEngine); virtual;
|
Constructor Create(APackage: TPasPackage; AEngine: TFPDocEngine); virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -491,20 +493,24 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
if not Assigned(El) then
|
if not Assigned(El) then
|
||||||
exit;
|
exit;
|
||||||
|
FContext:=AContext;
|
||||||
Node := El.FirstChild;
|
try
|
||||||
while Assigned(Node) do
|
Node := El.FirstChild;
|
||||||
begin
|
while Assigned(Node) do
|
||||||
if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'link') then
|
begin
|
||||||
ConvertLink(AContext, TDOMElement(Node))
|
if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'link') then
|
||||||
else if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'url') then
|
ConvertLink(AContext, TDOMElement(Node))
|
||||||
ConvertURL(AContext, TDOMElement(Node))
|
else if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'url') then
|
||||||
else
|
ConvertURL(AContext, TDOMElement(Node))
|
||||||
if not ConvertBaseShort(AContext, Node) then
|
else
|
||||||
exit;
|
if not ConvertBaseShort(AContext, Node) then
|
||||||
Node := Node.NextSibling;
|
exit;
|
||||||
|
Node := Node.NextSibling;
|
||||||
|
end;
|
||||||
|
Result := True;
|
||||||
|
finally
|
||||||
|
FContext:=Nil;
|
||||||
end;
|
end;
|
||||||
Result := True;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFPDocWriter.ConvertNotes(AContext: TPasElement; El: TDOMElement
|
function TFPDocWriter.ConvertNotes(AContext: TPasElement; El: TDOMElement
|
||||||
@ -732,53 +738,58 @@ var
|
|||||||
Node, Child: TDOMNode;
|
Node, Child: TDOMNode;
|
||||||
ParaCreated: Boolean;
|
ParaCreated: Boolean;
|
||||||
begin
|
begin
|
||||||
if AutoInsertBlock then
|
FContext:=AContext;
|
||||||
if IsExtShort(El.FirstChild) then
|
try
|
||||||
DescrBeginParagraph
|
|
||||||
else
|
|
||||||
AutoInsertBlock := False;
|
|
||||||
|
|
||||||
Node := El.FirstChild;
|
|
||||||
if not ConvertExtShort(AContext, Node) then
|
|
||||||
begin
|
|
||||||
while Assigned(Node) do
|
|
||||||
begin
|
|
||||||
if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'section') then
|
|
||||||
begin
|
|
||||||
DescrBeginSectionTitle;
|
|
||||||
Child := Node.FirstChild;
|
|
||||||
while Assigned(Child) and (Child.NodeType <> ELEMENT_NODE) do
|
|
||||||
begin
|
|
||||||
if not IsDescrNodeEmpty(Child) then
|
|
||||||
Warning(AContext, SErrInvalidContentBeforeSectionTitle);
|
|
||||||
Child := Child.NextSibling;
|
|
||||||
end;
|
|
||||||
if not Assigned(Child) or (Child.NodeName <> 'title') then
|
|
||||||
Warning(AContext, SErrSectionTitleExpected)
|
|
||||||
else
|
|
||||||
ConvertShort(AContext, TDOMElement(Child));
|
|
||||||
|
|
||||||
DescrBeginSectionBody;
|
|
||||||
|
|
||||||
if IsExtShort(Child) then
|
|
||||||
begin
|
|
||||||
DescrBeginParagraph;
|
|
||||||
ParaCreated := True;
|
|
||||||
end else
|
|
||||||
ParaCreated := False;
|
|
||||||
|
|
||||||
ConvertExtShortOrNonSectionBlocks(AContext, Child.NextSibling);
|
|
||||||
|
|
||||||
if ParaCreated then
|
|
||||||
DescrEndParagraph;
|
|
||||||
DescrEndSection;
|
|
||||||
end else if not ConvertNonSectionBlock(AContext, Node) then
|
|
||||||
Warning(AContext, SErrInvalidDescr, [Node.NodeName]);
|
|
||||||
Node := Node.NextSibling;
|
|
||||||
end;
|
|
||||||
end else
|
|
||||||
if AutoInsertBlock then
|
if AutoInsertBlock then
|
||||||
DescrEndParagraph;
|
if IsExtShort(El.FirstChild) then
|
||||||
|
DescrBeginParagraph
|
||||||
|
else
|
||||||
|
AutoInsertBlock := False;
|
||||||
|
|
||||||
|
Node := El.FirstChild;
|
||||||
|
if not ConvertExtShort(AContext, Node) then
|
||||||
|
begin
|
||||||
|
while Assigned(Node) do
|
||||||
|
begin
|
||||||
|
if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'section') then
|
||||||
|
begin
|
||||||
|
DescrBeginSectionTitle;
|
||||||
|
Child := Node.FirstChild;
|
||||||
|
while Assigned(Child) and (Child.NodeType <> ELEMENT_NODE) do
|
||||||
|
begin
|
||||||
|
if not IsDescrNodeEmpty(Child) then
|
||||||
|
Warning(AContext, SErrInvalidContentBeforeSectionTitle);
|
||||||
|
Child := Child.NextSibling;
|
||||||
|
end;
|
||||||
|
if not Assigned(Child) or (Child.NodeName <> 'title') then
|
||||||
|
Warning(AContext, SErrSectionTitleExpected)
|
||||||
|
else
|
||||||
|
ConvertShort(AContext, TDOMElement(Child));
|
||||||
|
|
||||||
|
DescrBeginSectionBody;
|
||||||
|
|
||||||
|
if IsExtShort(Child) then
|
||||||
|
begin
|
||||||
|
DescrBeginParagraph;
|
||||||
|
ParaCreated := True;
|
||||||
|
end else
|
||||||
|
ParaCreated := False;
|
||||||
|
|
||||||
|
ConvertExtShortOrNonSectionBlocks(AContext, Child.NextSibling);
|
||||||
|
|
||||||
|
if ParaCreated then
|
||||||
|
DescrEndParagraph;
|
||||||
|
DescrEndSection;
|
||||||
|
end else if not ConvertNonSectionBlock(AContext, Node) then
|
||||||
|
Warning(AContext, SErrInvalidDescr, [Node.NodeName]);
|
||||||
|
Node := Node.NextSibling;
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
if AutoInsertBlock then
|
||||||
|
DescrEndParagraph;
|
||||||
|
finally
|
||||||
|
FContext:=Nil;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPDocWriter.ConvertExtShortOrNonSectionBlocks(AContext: TPasElement;
|
procedure TFPDocWriter.ConvertExtShortOrNonSectionBlocks(AContext: TPasElement;
|
||||||
|
Loading…
Reference in New Issue
Block a user