mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 02:59:15 +02:00
Help for FPC messages: removing latex tags
git-svn-id: trunk@9176 -
This commit is contained in:
parent
10aa41ecc1
commit
b615c64088
@ -38,7 +38,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLProc, Dialogs, FileUtil, TextTools, MacroIntf,
|
Classes, SysUtils, LCLProc, Dialogs, FileUtil, TextTools, MacroIntf,
|
||||||
ConfigStorage, HelpIntf, HelpHTML;
|
LazarusIDEStrConsts, ConfigStorage, HelpIntf, HelpHTML;
|
||||||
|
|
||||||
const
|
const
|
||||||
lihcFPCMessages = 'FreePascal Compiler messages';
|
lihcFPCMessages = 'FreePascal Compiler messages';
|
||||||
@ -83,7 +83,8 @@ procedure CreateFPCMessagesHelpDB;
|
|||||||
function AddFPCMessageHelpItem(const Title, URL, RegularExpression: string
|
function AddFPCMessageHelpItem(const Title, URL, RegularExpression: string
|
||||||
): THelpDBIRegExprMessage;
|
): THelpDBIRegExprMessage;
|
||||||
|
|
||||||
function FindFPCMessageComment(const CommentFile, Msg: string): string;
|
function FindFPCMessageComment(const CommentFile, Msg: string;
|
||||||
|
ExtractText: boolean): string;
|
||||||
procedure ParseFPCMessagesFile(Lines: TStrings;
|
procedure ParseFPCMessagesFile(Lines: TStrings;
|
||||||
const SearchMessage: string; var FoundComment: string);
|
const SearchMessage: string; var FoundComment: string);
|
||||||
|
|
||||||
@ -119,15 +120,48 @@ begin
|
|||||||
FPCMessagesHelpDB.RegisterItem(Result);
|
FPCMessagesHelpDB.RegisterItem(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FindFPCMessageComment(const CommentFile, Msg: string): string;
|
function FindFPCMessageComment(const CommentFile, Msg: string;
|
||||||
|
ExtractText: boolean): string;
|
||||||
var
|
var
|
||||||
sl: TStringList;
|
sl: TStringList;
|
||||||
|
p: Integer;
|
||||||
|
TagStart: LongInt;
|
||||||
|
Level: Integer;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
sl:=TStringList.Create;
|
sl:=TStringList.Create;
|
||||||
try
|
try
|
||||||
sl.LoadFromFile(CommentFile);
|
sl.LoadFromFile(CommentFile);
|
||||||
ParseFPCMessagesFile(sl,Msg,Result);
|
ParseFPCMessagesFile(sl,Msg,Result);
|
||||||
|
if ExtractText and (Result<>'') then begin
|
||||||
|
p:=1;
|
||||||
|
while (p<length(Result)) do begin
|
||||||
|
case Result[p] of
|
||||||
|
'\':
|
||||||
|
begin
|
||||||
|
TagStart:=p;
|
||||||
|
inc(p);
|
||||||
|
if (p<=length(Result)) and (Result[p]='\') then begin
|
||||||
|
inc(p);
|
||||||
|
end else begin
|
||||||
|
// remove tag
|
||||||
|
while (p<=length(Result)) and (Result[p] in ['a'..'z','A'..'Z'])
|
||||||
|
do
|
||||||
|
inc(p);
|
||||||
|
Result:=copy(Result,1,TagStart-1)+copy(Result,p,length(Result));
|
||||||
|
p:=TagStart;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
'{','}':
|
||||||
|
begin
|
||||||
|
// remove brackets
|
||||||
|
Result:=copy(Result,1,p-1)+copy(Result,p+1,length(Result));
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
inc(p);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
sl.Free;
|
sl.Free;
|
||||||
end;
|
end;
|
||||||
@ -322,7 +356,7 @@ begin
|
|||||||
else
|
else
|
||||||
Filename:=Filename+'errore.msg';
|
Filename:=Filename+'errore.msg';
|
||||||
if FileExists(Filename) then begin
|
if FileExists(Filename) then begin
|
||||||
FoundComment:=FindFPCMessageComment(Filename,AMessage);
|
FoundComment:=FindFPCMessageComment(Filename,AMessage,true);
|
||||||
if FoundComment<>'' then begin
|
if FoundComment<>'' then begin
|
||||||
Result:=shrSuccess;
|
Result:=shrSuccess;
|
||||||
CreateNodeQueryListAndAdd(DefaultNode,nil,ListOfNodes,true);
|
CreateNodeQueryListAndAdd(DefaultNode,nil,ListOfNodes,true);
|
||||||
@ -339,7 +373,8 @@ begin
|
|||||||
if NewNode=DefaultNode then begin
|
if NewNode=DefaultNode then begin
|
||||||
if FoundComment<>'' then begin
|
if FoundComment<>'' then begin
|
||||||
Result:=shrSuccess;
|
Result:=shrSuccess;
|
||||||
MessageDlg('Help',FoundComment,mtInformation,[mbOk],0);
|
MessageDlg(lisHFMHelpForFreePascalCompilerMessage, FoundComment,
|
||||||
|
mtInformation,[mbOk],0);
|
||||||
end else begin
|
end else begin
|
||||||
Result:=shrHelpNotFound;
|
Result:=shrHelpNotFound;
|
||||||
end;
|
end;
|
||||||
|
@ -3023,6 +3023,8 @@ resourcestring
|
|||||||
lisDebugOptionsFrmHandledByDebugger = 'Handled by Debugger';
|
lisDebugOptionsFrmHandledByDebugger = 'Handled by Debugger';
|
||||||
lisDebugOptionsFrmResumeHandled = 'Resume Handled';
|
lisDebugOptionsFrmResumeHandled = 'Resume Handled';
|
||||||
lisDebugOptionsFrmResumeUnhandled = 'Resume Unhandled';
|
lisDebugOptionsFrmResumeUnhandled = 'Resume Unhandled';
|
||||||
|
lisHFMHelpForFreePascalCompilerMessage = 'Help for FreePascal Compiler '
|
||||||
|
+'message';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user