mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-04 17:30:37 +02:00
+ Some fixes in verbatim writing
This commit is contained in:
parent
de4d207208
commit
9abcb9dda1
@ -49,6 +49,7 @@ type
|
|||||||
Module: TPasModule;
|
Module: TPasModule;
|
||||||
ModuleName: String;
|
ModuleName: String;
|
||||||
FTableCount : Integer;
|
FTableCount : Integer;
|
||||||
|
FInVerbatim : Boolean;
|
||||||
TableRowStartFlag, TableCaptionWritten: Boolean;
|
TableRowStartFlag, TableCaptionWritten: Boolean;
|
||||||
|
|
||||||
function GetLabel(AElement: TPasElement): String;
|
function GetLabel(AElement: TPasElement): String;
|
||||||
@ -442,18 +443,23 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
SetLength(Result, 0);
|
if FInVerBatim=True then
|
||||||
for i := 1 to Length(S) do
|
Result:=S
|
||||||
case S[i] of
|
else
|
||||||
'&','{','}','#','_','$','%': // Escape these characters
|
begin
|
||||||
Result := Result + '\' + S[i];
|
SetLength(Result, 0);
|
||||||
'~','^':
|
for i := 1 to Length(S) do
|
||||||
Result := Result + '\'+S[i]+' ';
|
case S[i] of
|
||||||
'\':
|
'&','{','}','#','_','$','%': // Escape these characters
|
||||||
Result:=Result+'$\backslash$'
|
Result := Result + '\' + S[i];
|
||||||
else
|
'~','^':
|
||||||
Result := Result + S[i];
|
Result := Result + '\'+S[i]+' ';
|
||||||
end;
|
'\':
|
||||||
|
Result:=Result+'$\backslash$'
|
||||||
|
else
|
||||||
|
Result := Result + S[i];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function TLatexWriter.StripTex(S : String) : String;
|
Function TLatexWriter.StripTex(S : String) : String;
|
||||||
@ -1348,8 +1354,12 @@ end;
|
|||||||
|
|
||||||
procedure TLaTeXWriter.StartListing(Frames: Boolean; const name: String);
|
procedure TLaTeXWriter.StartListing(Frames: Boolean; const name: String);
|
||||||
begin
|
begin
|
||||||
|
FInVerbatim:=True;
|
||||||
if Not LaTexHighLight then
|
if Not LaTexHighLight then
|
||||||
Writeln('\begin{verbatim}')
|
begin
|
||||||
|
Writeln('');
|
||||||
|
Writeln('\begin{verbatim}');
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if Frames then
|
if Frames then
|
||||||
Writelnf('\begin{lstlisting}{%s}',[StripTex(Name)])
|
Writelnf('\begin{lstlisting}{%s}',[StripTex(Name)])
|
||||||
@ -1364,6 +1374,7 @@ end;
|
|||||||
|
|
||||||
procedure TLaTeXWriter.EndListing;
|
procedure TLaTeXWriter.EndListing;
|
||||||
begin
|
begin
|
||||||
|
FInVerbatim:=False;
|
||||||
If LaTexHighLight then
|
If LaTexHighLight then
|
||||||
Writeln('\end{lstlisting}')
|
Writeln('\end{lstlisting}')
|
||||||
else
|
else
|
||||||
@ -1445,7 +1456,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2004-06-06 10:53:02 michael
|
Revision 1.6 2004-07-23 23:39:48 michael
|
||||||
|
+ Some fixes in verbatim writing
|
||||||
|
|
||||||
|
Revision 1.5 2004/06/06 10:53:02 michael
|
||||||
+ Added Topic support
|
+ Added Topic support
|
||||||
|
|
||||||
Revision 1.4 2003/03/18 19:28:44 michael
|
Revision 1.4 2003/03/18 19:28:44 michael
|
||||||
|
Loading…
Reference in New Issue
Block a user