|
@@ -23,6 +23,7 @@ uses DOM, dGlobals, PasTree;
|
|
|
|
|
|
const
|
|
const
|
|
LateXHighLight : Boolean = False;
|
|
LateXHighLight : Boolean = False;
|
|
|
|
+ MaxVerbatimLength : Integer = 65;
|
|
TexExtension : String = '.tex';
|
|
TexExtension : String = '.tex';
|
|
|
|
|
|
Procedure CreateLaTeXDocForPackage(APackage: TPasPackage; AEngine: TFPDocEngine);
|
|
Procedure CreateLaTeXDocForPackage(APackage: TPasPackage; AEngine: TFPDocEngine);
|
|
@@ -130,6 +131,7 @@ Type
|
|
// TFPDocWriter class methods
|
|
// TFPDocWriter class methods
|
|
Property ImageDir : String Read FImageDir Write FImageDir;
|
|
Property ImageDir : String Read FImageDir Write FImageDir;
|
|
public
|
|
public
|
|
|
|
+ Function SplitLine (ALine : String): String; virtual;
|
|
Function InterPretOption(Const Cmd,Arg : String) : boolean; override;
|
|
Function InterPretOption(Const Cmd,Arg : String) : boolean; override;
|
|
Class Function FileNameExtension : String; override;
|
|
Class Function FileNameExtension : String; override;
|
|
end;
|
|
end;
|
|
@@ -153,15 +155,75 @@ begin
|
|
Result[i] := ':';
|
|
Result[i] := ':';
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+Function TLaTeXWriter.SplitLine (ALine : String): String;
|
|
|
|
+
|
|
|
|
+ Function FindLastSplit(S : String) : Integer;
|
|
|
|
+
|
|
|
|
+ Const
|
|
|
|
+ NonSplit = ['a'..'z','A'..'Z','0'..'9','_'];
|
|
|
|
+
|
|
|
|
+ Var
|
|
|
|
+ L,I : integer;
|
|
|
|
+ C : PChar;
|
|
|
|
+ InString : Boolean;
|
|
|
|
+
|
|
|
|
+ begin
|
|
|
|
+ Result:=0;
|
|
|
|
+ L:=Length(S);
|
|
|
|
+ if (L>MaxVerbatimLength) then
|
|
|
|
+ begin
|
|
|
|
+ InString:=False;
|
|
|
|
+ Result:=0;
|
|
|
|
+ I:=1;
|
|
|
|
+ C:=@S[1];
|
|
|
|
+ While (I<=MaxVerbatimLength) do
|
|
|
|
+ begin
|
|
|
|
+ If C^='''' then
|
|
|
|
+ InString:=Not Instring
|
|
|
|
+ else if Not InString then
|
|
|
|
+ begin
|
|
|
|
+ if Not (C^ in NonSplit) then
|
|
|
|
+ Result:=I;
|
|
|
|
+ end;
|
|
|
|
+ Inc(I);
|
|
|
|
+ Inc(C);
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ If Result=0 then
|
|
|
|
+ Result:=L+1;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+Var
|
|
|
|
+ SP : Integer;
|
|
|
|
+ L : String;
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ Result:='';
|
|
|
|
+ While (Aline<>'') do
|
|
|
|
+ begin
|
|
|
|
+ SP:=FindLastSplit(Aline);
|
|
|
|
+ L:=Copy(ALine,1,SP-1);
|
|
|
|
+ Delete(ALine,1,SP-1);
|
|
|
|
+ If (Result<>'') then
|
|
|
|
+ Result:=Result+sLineBreak+' ';
|
|
|
|
+ Result:=Result+Trim(L);
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
|
|
function TLaTeXWriter.EscapeText(S: String): String;
|
|
function TLaTeXWriter.EscapeText(S: String): String;
|
|
|
|
|
|
|
|
+
|
|
var
|
|
var
|
|
i: Integer;
|
|
i: Integer;
|
|
|
|
|
|
begin
|
|
begin
|
|
if FInVerBatim=True then
|
|
if FInVerBatim=True then
|
|
- Result:=S
|
|
|
|
|
|
+ begin
|
|
|
|
+ if (MaxVerbatimLength=0) or (length(S)<=MaxVerbatimLength) then
|
|
|
|
+ Result:=S
|
|
|
|
+ else
|
|
|
|
+ Result:=SplitLine(S);
|
|
|
|
+ end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
SetLength(Result, 0);
|
|
SetLength(Result, 0);
|
|
@@ -725,6 +787,8 @@ begin
|
|
LatexHighLight:=True
|
|
LatexHighLight:=True
|
|
else if Cmd = '--latex-extension' then
|
|
else if Cmd = '--latex-extension' then
|
|
TexExtension:=Arg
|
|
TexExtension:=Arg
|
|
|
|
+ else if Cmd = '--latex--verbatim-length' then
|
|
|
|
+ MaxVerbatimLength:=StrToInt(Arg)
|
|
else if Cmd = '--image-dir' then
|
|
else if Cmd = '--image-dir' then
|
|
ImageDir:=Arg
|
|
ImageDir:=Arg
|
|
else
|
|
else
|