Class TTexDocGenerator

Unit

Declaration

type TTexDocGenerator = class(TDocGenerator)

Description

LaTeX documentation generator.

Extends TDocGenerator and overwrites many of its methods to generate output in LaTex format.

Source: source/component/PasDoc_GenLatex.pas (line 42).

Hierarchy

Overview

Methods

Protected function ConvertString(const s: string): string; override;
Protected function ConvertChar(c: char): String; override;
Protected procedure WriteUnit(const HL: integer; const U: TPasUnit); override;
Protected function LatexString(const S: string): string; override;
Protected function CodeString(const s: string): string; override;
Protected function CreateLink(const Item: TBaseItem): string; override;
Protected procedure WriteStartOfCode; override;
Protected procedure WriteEndOfCode; override;
Protected function Paragraph: string; override;
Protected function ShortDash: string; override;
Protected function LineBreak: string; override;
Protected function URLLink(const URL: string): string; override;
Protected function URLLink(const URL, LinkDisplay: string): string; override;
Protected procedure WriteExternalCore(const ExternalItem: TExternalItem; const Id: TTranslationID); override;
Protected function FormatKeyWord(AString: string): string; override;
Protected function FormatCompilerComment(AString: string): string; override;
Protected function FormatComment(AString: string): string; override;
Protected function FormatAnchor(const Anchor: string): string; override;
Protected function MakeItemLink(const Item: TBaseItem; const LinkCaption: string; const LinkContext: TLinkContext): string; override;
Protected function FormatBold(const Text: string): string; override;
Protected function FormatItalic(const Text: string): string; override;
Protected function FormatWarning(const Text: string): string; override;
Protected function FormatNote(const Text: string): string; override;
Protected function FormatPreformatted(const Text: string): string; override;
Protected function FormatImage(FileNames: TStringList): string; override;
Protected function FormatList(ListData: TListData): string; override;
Protected function FormatTable(Table: TTableData): string; override;
Public function FormatPascalCode(const Line: string): string; override;
Public function GetFileExtension: string; override;
Public procedure WriteDocumentation; override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public function EscapeURL(const AString: string): string; virtual;
Public function FormatSection(HL: integer; const Anchor: string; const Caption: string): string; override;

Properties

Published property Latex2rtf: boolean read FLatex2rtf write FLatex2rtf default false;
Published property LatexHead: TStrings read FLatexHead write SetLatexHead;

Description

Methods

Protected function ConvertString(const s: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.ConvertString.

Converts for each character in S, thus assembling a String that is returned and can be written to the documentation file.

The @ character should not be converted, this will be done later on.

Source: source/component/PasDoc_GenLatex.pas (line 167).

Protected function ConvertChar(c: char): String; override;

Called by ConvertString to convert a character. Will convert special characters to their html escape sequence -> test

Source: source/component/PasDoc_GenLatex.pas (line 172).

Protected procedure WriteUnit(const HL: integer; const U: TPasUnit); override;

This item has no description. Showing description inherited from TDocGenerator.WriteUnit.

Abstract method that writes all documentation for a single unit U to output, starting at heading level HL. Implementation must be provided by descendant objects and is dependent on output format.

Source: source/component/PasDoc_GenLatex.pas (line 174).

Protected function LatexString(const S: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.LatexString.

Process LaTeX content, like provided by the @latex tag.

The default implementation is this class simply discards it, i.e. returns always ''. Generators that know what to do with raw LaTeX markup can override this with simple "Result := S".

Source: source/component/PasDoc_GenLatex.pas (line 176).

Protected function CodeString(const s: string): string; override;

Makes a String look like a coded String, i.e. '\begin{ttfamily}TheString\end{ttfamily}' in LaTeX. }

Source: source/component/PasDoc_GenLatex.pas (line 181).

Protected function CreateLink(const Item: TBaseItem): string; override;

Returns a link to an anchor within a document. LaTeX simply concatenates the strings with either a "-" or "." character between them.

Source: source/component/PasDoc_GenLatex.pas (line 185).

Protected procedure WriteStartOfCode; override;

This item has no description.

Source: source/component/PasDoc_GenLatex.pas (line 187).

Protected procedure WriteEndOfCode; override;

This item has no description.

Source: source/component/PasDoc_GenLatex.pas (line 188).

Protected function Paragraph: string; override;

This item has no description. Showing description inherited from TDocGenerator.Paragraph.

This is paragraph marker in output documentation.

Default implementation in this class simply returns ' ' (one space).

Source: source/component/PasDoc_GenLatex.pas (line 190).

Protected function ShortDash: string; override;

This item has no description. Showing description inherited from TDocGenerator.ShortDash.

See TTagManager.ShortDash. Default implementation in this class returns '-'.

Source: source/component/PasDoc_GenLatex.pas (line 192).

Protected function LineBreak: string; override;

This item has no description. Showing description inherited from TDocGenerator.LineBreak.

Markup that forces line break in given output format (e.g. '<br>' in html or '\\' in LaTeX).

It is used on
tag (but may also be used on other occasions in the future).

In this class it returns '', because it's valid for an output generator to simply ignore
tags if linebreaks can't be expressed in given output format.

Source: source/component/PasDoc_GenLatex.pas (line 194).

Protected function URLLink(const URL: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.URLLink.

Markup to display URL in a description. E.g. HTML generator will want to wrap this in <a href="...">...</a>.

Note that passed here URL is not processed by ConvertString (because sometimes it could be undesirable). If you want you can process URL with ConvertString when overriding this method.

Default implementation in this class simply returns ConvertString(URL). This is good if your documentation format does not support anything like URL links.

Source: source/component/PasDoc_GenLatex.pas (line 196).

Protected function URLLink(const URL, LinkDisplay: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.URLLink.

Text which will be shown for an URL tag.

URL is a link to a website or e-mail address. LinkDisplay is an optional parameter which will be used as the display name of the URL.

Source: source/component/PasDoc_GenLatex.pas (line 197).

Protected procedure WriteExternalCore(const ExternalItem: TExternalItem; const Id: TTranslationID); override;

This item has no description. Showing description inherited from TDocGenerator.WriteExternalCore.

This is called from WriteExternal when ExternalItem.Title and ShortTitle are already set, message about generating appropriate item is printed etc. This should write ExternalItem, including ExternalItem.DetailedDescription, ExternalItem.Authors, ExternalItem.Created, ExternalItem.LastMod.

Source: source/component/PasDoc_GenLatex.pas (line 199).

Protected function FormatKeyWord(AString: string): string; override;

FormatKeyWord is called from within FormatPascalCode to return AString in a bold font.

Source: source/component/PasDoc_GenLatex.pas (line 210).

Protected function FormatCompilerComment(AString: string): string; override;

FormatCompilerComment is called from within FormatPascalCode to return AString in italics.

Source: source/component/PasDoc_GenLatex.pas (line 214).

Protected function FormatComment(AString: string): string; override;

FormatComment is called from within FormatPascalCode to return AString in italics.

Source: source/component/PasDoc_GenLatex.pas (line 218).

Protected function FormatAnchor(const Anchor: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.FormatAnchor.

Writes a link-anchor.

Source: source/component/PasDoc_GenLatex.pas (line 220).

Protected function MakeItemLink(const Item: TBaseItem; const LinkCaption: string; const LinkContext: TLinkContext): string; override;

This item has no description. Showing description inherited from TDocGenerator.MakeItemLink.

Return a link to item Item which will be displayed as LinkCaption. Returned string may be directly inserted inside output documentation. LinkCaption will be always converted using ConvertString before writing, so don't worry about doing this yourself when calling this method.

LinkContext may be used in some descendants to present the link differently, see TLinkContext for it's meaning.

If some output format doesn't support this feature, it can return simply ConvertString(LinkCaption). This is the default implementation of this method in this class.

Source: source/component/PasDoc_GenLatex.pas (line 222).

Protected function FormatBold(const Text: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.FormatBold.

Return Text formatted using bold font.

Given Text is already in the final output format (with characters converted using ConvertString, @-tags expanded etc.).

Implementation of this method in this class simply returns Result := Text. Output generators that can somehow express bold formatting (or at least emphasis of some text) should override this.

Source: source/component/PasDoc_GenLatex.pas (line 226).

Protected function FormatItalic(const Text: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.FormatItalic.

Return Text formatted using italic font. Analogous to FormatBold.

Source: source/component/PasDoc_GenLatex.pas (line 227).

Protected function FormatWarning(const Text: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.FormatWarning.

Return Text using bold font by calling FormatBold(Text).

Source: source/component/PasDoc_GenLatex.pas (line 229).

Protected function FormatNote(const Text: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.FormatNote.

Return Text using italic font by calling FormatItalic(Text).

Source: source/component/PasDoc_GenLatex.pas (line 230).

Protected function FormatPreformatted(const Text: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.FormatPreformatted.

Return Text preserving spaces and line breaks. Note that Text passed here is not yet converted with ConvertString. The implementation of this method in this class just returns ConvertString(Text).

Source: source/component/PasDoc_GenLatex.pas (line 231).

Protected function FormatImage(FileNames: TStringList): string; override;

This item has no description. Showing description inherited from TDocGenerator.FormatImage.

Return markup to show an image. FileNames is a list of possible filenames of the image. FileNames always contains at least one item (i.e. FileNames.Count >= 1), never contains empty lines (i.e. Trim(FileNames[I]) <> ''), and contains only absolute filenames.

E.g. HTML generator will want to choose the best format for HTML, then somehow copy the image from FileNames[Chosen] and wrap this in <img src="...">.

Implementation of this method in this class simply shows FileNames[0]. Output generators should override this.

Source: source/component/PasDoc_GenLatex.pas (line 233).

Protected function FormatList(ListData: TListData): string; override;

This item has no description. Showing description inherited from TDocGenerator.FormatList.

Format a list from given ListData.

Source: source/component/PasDoc_GenLatex.pas (line 235).

Protected function FormatTable(Table: TTableData): string; override;

This item has no description. Showing description inherited from TDocGenerator.FormatTable.

Return appropriate content for given Table. It's guaranteed that the Table passed here will have at least one row and in each row there will be at least one cell, so you don't have to check it within descendants.

Source: source/component/PasDoc_GenLatex.pas (line 237).

Public function FormatPascalCode(const Line: string): string; override;

FormatPascalCode is intended to format Line as if it were Object Pascal code in Delphi or Lazarus. However, unlike Lazarus and Delphi, colored text is not used because printing colored text tends to be much more expensive than printing all black text.

Source: source/component/PasDoc_GenLatex.pas (line 243).

Public function GetFileExtension: string; override;

Returns Latex file extension ".tex".

Source: source/component/PasDoc_GenLatex.pas (line 246).

Public procedure WriteDocumentation; override;

The method that does everything — writes documentation for all units and creates overview files.

Source: source/component/PasDoc_GenLatex.pas (line 249).

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Source: source/component/PasDoc_GenLatex.pas (line 250).

Public destructor Destroy; override;

This item has no description.

Source: source/component/PasDoc_GenLatex.pas (line 251).

Public function EscapeURL(const AString: string): string; virtual;

This item has no description.

Source: source/component/PasDoc_GenLatex.pas (line 252).

Public function FormatSection(HL: integer; const Anchor: string; const Caption: string): string; override;

This item has no description. Showing description inherited from TDocGenerator.FormatSection.

Writes a section heading and a link-anchor.

Source: source/component/PasDoc_GenLatex.pas (line 254).

Properties

Published property Latex2rtf: boolean read FLatex2rtf write FLatex2rtf default false;

Indicate if the output must be simplified for latex2rtf

Source: source/component/PasDoc_GenLatex.pas (line 258).

Published property LatexHead: TStrings read FLatexHead write SetLatexHead;

The strings in LatexHead are inserted directly into the preamble of the LaTeX document. Therefore they must be valid LaTeX code.

Source: source/component/PasDoc_GenLatex.pas (line 261).


Generated by PasDoc 0.17.0.snapshot.