Class TTag
Unit
Declaration
type TTag = class(TObject)
Description
Hierarchy
- TObject
- TTag
Overview
Methods
constructor Create(ATagManager: TTagManager; const AName: string; AOnPreExecute: TTagExecuteEvent; AOnExecute: TTagExecuteEvent; const ATagOptions: TTagOptions); |
|
procedure PreExecute(var ThisTagData: TObject; EnclosingTag: TTag; var EnclosingTagData: TObject; const TagParameter: string; var ReplaceStr: string); virtual; |
|
procedure Execute(var ThisTagData: TObject; EnclosingTag: TTag; var EnclosingTagData: TObject; const TagParameter: string; var ReplaceStr: string); virtual; |
|
function AllowedInside(EnclosingTag: TTag): boolean; virtual; |
|
function CreateOccurenceData: TObject; virtual; |
|
procedure DestroyOccurenceData(Value: TObject); virtual; |
Properties
property TagOptions: TTagOptions read FTagOptions write FTagOptions; |
|
property TagManager: TTagManager read FTagManager; |
|
property Name: string read FName write FName; |
|
property OnPreExecute: TTagExecuteEvent
read FOnPreExecute write FOnPreExecute; |
|
property OnExecute: TTagExecuteEvent
read FOnExecute write FOnExecute; |
|
property OnAllowedInside: TTagAllowedInsideEvent
read FOnAllowedInside write FOnAllowedInside; |
Description
Methods
constructor Create(ATagManager: TTagManager; const AName: string; AOnPreExecute: TTagExecuteEvent; AOnExecute: TTagExecuteEvent; const ATagOptions: TTagOptions); |
|
Note that AName will be converted to lowercase before assigning to Name. |
procedure PreExecute(var ThisTagData: TObject; EnclosingTag: TTag; var EnclosingTagData: TObject; const TagParameter: string; var ReplaceStr: string); virtual; |
|
This is completely analogous to Execute but used when TTagManager.PreExecute is |
procedure Execute(var ThisTagData: TObject; EnclosingTag: TTag; var EnclosingTagData: TObject; const TagParameter: string; var ReplaceStr: string); virtual; |
|
This will be used to do main work when this @-tag occured in description. EnclosingTag parameter specifies enclosing tag. This is useful for tags that must behave differently in different contexts, e.g. in plain-text output @item tag will behave differently inside @orderedList and @unorderedList. EnclosingTag is nil when the tag occured at top level of the description. ThisTagData and EnclosingTagData form a mechanism to pass arbitraty data between child tags enclosed within one parent tag. Example uses:
How does this XxxTagData mechanism work: When we start parsing parameter of some tag with toRecursiveTags, we create a new pointer inited to CreateOccurenceData. When @-tags occur inside this parameter, we pass them this pointer as EnclosingTagData (this way all @-tags with the same parent can use this pointer to communicate with each other). At the end, when parameter was parsed, we call given tag's Execute method passing the resulting pointer as ThisTagData (this way @-tags with the same parent can use this pointer to pass some data to their parent). In this class this method simply calls OnExecute (if assigned). |
function AllowedInside(EnclosingTag: TTag): boolean; virtual; |
|
This will be checked always when this tag occurs within description. Given EnclosingTag is enclosing tag, nil if we're in top level. If this returns false then this tag will not be allowed inside EnclosingTag. In this class this method
|
function CreateOccurenceData: TObject; virtual; |
|
In this class this simply returns |
procedure DestroyOccurenceData(Value: TObject); virtual; |
|
In this class this simply does |
Properties
property TagOptions: TTagOptions read FTagOptions write FTagOptions; |
|
property TagManager: TTagManager read FTagManager; |
|
TagManager that will recognize and handle this tag. Note that the tag instance is owned by this tag manager (i.e. it will be freed inside this tag manager). It can be nil if no tag manager currently owns this tag. Note that it's very useful in Execute or OnExecute implementations. E.g. you can use it to report a message by You could also use this to manually force recursive behavior of a given tag. I.e let's suppose that you have a tag with TagOptions = [toParameterRequired], so the TagParameter parameter passed to handler was not recursively expanded. Then you can do inside your handler NewTagParameter := TagManager.Execute(TagParameter, ...) and this way you have explicitly recursively expanded the tag. Scenario above is actually used in implementation of @noAutoLink tag. There I call TagManager.Execute with parameter |
property Name: string read FName write FName; |
|
Name of the tag, that must be specified by user after the "@" sign. Value of this property must always be lowercase. |
property OnPreExecute: TTagExecuteEvent
read FOnPreExecute write FOnPreExecute; |
|
property OnExecute: TTagExecuteEvent
read FOnExecute write FOnExecute; |
|
property OnAllowedInside: TTagAllowedInsideEvent
read FOnAllowedInside write FOnAllowedInside; |
|
Generated by PasDoc 0.16.0.