Description | Hierarchy | Fields | Methods | Properties |
type TTidy = class(TComponent)
The main component of the TidyPas wrapper.
Provides for creation, initialization and destruction of the opaque TidyDoc object, properties for accessing TidyLib's configuration options, methods for loading the document and retrieving the output, and an event property to receive diagnostic and repair information.
Note to FreePascal users:
There exist two different versions of TTidy, one being a "real" component, suitable for use with the Lazarus IDE, and the other a lightweight "psuedo" component, better suited for use in console-style applications. If you need the Lazarus component, use the laztidy.pas
unit, otherwise, the object in the tidyobj.pas
unit can result in a much smaller executable in many cases.
constructor Create(aOwner:tComponent); override; |
|
destructor Destroy; override; |
|
function LoadConfigFile(const aFilename:string):bool; |
|
function SaveConfigFile(const aFilename:string):bool; |
|
function ParseFile(const aFilename:string):string; |
|
function ParseString(const aInputString:string):string; |
|
function ParseBuffer(buf:pTidyBuffer):string; |
|
class function ReleaseDate:string; |
property AccessWarningCount: uint (read-only); |
|
property AppData: pointer (read/write); |
|
property BlockTags: string (read/write); |
|
property BodyNode: pTidyNode (read-only); |
|
property ConfigErrorCount: uint (read-only); |
|
property CSSPrefix: string (read/write); |
|
property Doctype: string (read-only); |
|
property DoctypeMode: uint (read-only); |
|
property EmptyTags: string (read/write); |
|
property ErrorCount: uint (read-only); |
|
property ErrorSummary: string (read-only); |
|
property GeneralInfo: string (read-only); |
|
property Handle: pTidyDoc (read-only); |
|
property HeadNode: pTidyNode (read-only); |
|
property HtmlNode: pTidyNode (read-only); |
|
property InlineTags: string (read/write); |
|
property InputCompleteCallback: tTidyInputCompleteCallback (read/write); |
|
property NCR: bool (read/write); |
|
property OutputBom: TidyTriState (read/write); |
|
property ReportCallback: TidyReportFilter (read/write); |
|
property RootNode: pTidyNode (read-only); |
|
property Status: LongInt (read-only); |
|
property Title: string (read-only); |
|
property UserDoctype: string (read/write); |
|
property WarningCount: uint (read-only); |
|
property XmlDecl: string (read-only); |
|
property AccessibilityCheckLevel: uint (read/write); |
|
property AddXmlDecl: bool (read/write); |
|
property AllowUnknownTags: boolean (read/write); |
|
property AltText: string (read/write); |
|
property AsciiChars: bool (read/write); |
|
property BodyOnly: bool (read/write); |
|
property BreakBeforeBR: bool (read/write); |
|
property CharEncoding: TidyEncodingID (read/write); |
|
property Congruent: Boolean (read/write); |
|
property DropEmptyParas: bool (read/write); |
|
property DropFontTags: bool (read/write); |
|
property DropPropAttrs: bool (read/write); |
|
property DuplicateAttrs: TidyDupAttrModes (read/write); |
|
property Emacs: bool (read/write); |
|
property EncloseBlockText: bool (read/write); |
|
property EncloseBodyText: bool (read/write); |
|
property ErrorFile: string (read/write); |
|
property EscapeCdata: bool (read/write); |
|
property FixBackslash: bool (read/write); |
|
property FixComments: bool (read/write); |
|
property FixUri: bool (read/write); |
|
property ForceOutput: bool (read/write); |
|
property HideComments: bool (read/write); |
|
property HideEndTags: bool (read/write); |
|
property InCharEncoding: TidyEncodingID (read/write); |
|
property IndentAttributes: bool (read/write); |
|
property IndentCdata: bool (read/write); |
|
property Indent: Integer (read/write); |
|
property JoinClasses: bool (read/write); |
|
property JoinStyles: bool (read/write); |
|
property LiteralAttribs: bool (read/write); |
|
property LogicalEmphasis: bool (read/write); |
|
property LowerLiterals: bool (read/write); |
|
property MakeBare: bool (read/write); |
|
property MakeClean: bool (read/write); |
|
property Mark: bool (read/write); |
|
property MergeDivs: uint (read/write); |
|
property MergeOrphanForms: boolean (read/write); |
|
property Newline: TidyLineEnding (read/write); |
|
property NumEntities: bool (read/write); |
|
property OnInputComplete: tTidyInputCompleteEvent (read/write); |
|
property OnReport: tTidyReportEvent (read/write); |
|
property OutCharEncoding: TidyEncodingID (read/write); |
|
property OutputMode: TidyOutputMode (read/write)
published property PreScanScripts:Boolean (read/write); |
|
property PreTags: string (read/write); |
|
property PunctWrap: bool (read/write); |
|
property Quiet: bool (read/write); |
|
property QuoteAmpersand: bool (read/write); |
|
property QuoteMarks: bool (read/write); |
|
property QuoteNbsp: bool (read/write); |
|
property ReplaceColor: bool (read/write); |
|
property ShowErrors: uint (read/write); |
|
property ShowMarkup: bool (read/write); |
|
property ShowWarnings: bool (read/write); |
|
property TabSize: uint (read/write); |
|
property UpperCaseAttrs: bool (read/write); |
|
property UpperCaseTags: bool (read/write); |
|
property VertSpace: bool (read/write); |
|
property Word2000: bool (read/write); |
|
property WrapAsp: bool (read/write); |
|
property WrapAttVals: bool (read/write); |
|
property WrapJste: bool (read/write); |
|
property WrapLen: uint (read/write); |
|
property WrapPhp: bool (read/write); |
|
property WrapScriptlets: bool (read/write); |
|
property WrapSection: bool (read/write); |
|
property XmlAutoDetect: Boolean (read/write); |
|
property XmlPIs: bool (read/write); |
|
property XmlSpace: bool (read/write); |
|
property XmlTags: bool (read/write); |
destructor Destroy; override; |
|
Frees the memory allocated to the tTidy instance, and releases the |
function LoadConfigFile(const aFilename:string):bool; |
|
Reads the configuration property settings from a disk file. |
property AccessWarningCount: uint (read-only); |
|
Returns the number of accessibility warnings that the library encountered while parsing the document. |
property BlockTags: string (read/write); |
|
This option specifies new block-level tags. This option takes a space or comma separated list of tag names. In order to process a document with previously unknown tags, you must either declare new tags, set ForceOutput to Note you can't change the content model for elements such as <TABLE>, <UL>, <OL> and <DL>. |
property BodyNode: pTidyNode (read-only); |
|
Returns the |
property ConfigErrorCount: uint (read-only); |
|
Returns the number of configuration errors that the library encountered, either from parsing the configuration file, or from invalid property settings. |
property CSSPrefix: string (read/write); |
|
This option specifies the prefix that Tidy uses for styles rules. By default, "c" will be used. |
property Doctype: string (read-only); |
|
The text of the To set the value of the doctype before parsing, see the TTidy.UserDocType property. |
property DoctypeMode: uint (read-only); |
|
Returns the mode that the library used to parse the document. This property is read-only. To manually set desired doctype of the output, use the UserDocType property. |
property EmptyTags: string (read/write); |
|
This option specifies new empty inline tags. Specify a space- or comma- separated list of tag names. In order to process a document with previously unknown tags, you must either declare new tags, set ForceOutput to Remember to also declare empty tags as either inline or blocklevel. |
property ErrorCount: uint (read-only); |
|
Returns the number of errors that the library encountered while parsing the document. |
property ErrorSummary: string (read-only); |
|
Returns a summary of the errors and warnings tidy encountered while parsing and reparing the document. |
property GeneralInfo: string (read-only); |
|
Returns a paragraph or so of text providing general suggestions and recommendations concerning the parsed document. |
property Handle: pTidyDoc (read-only); |
|
This property exposes the library's current Note that the value of the Warning: DO NOT use the library's TidySetAppData() and TidyGetAppData() are used internally by TTidy, and must NOT be modified! If you need to pass application-specific data to a TTidy instance, use the AppData property instead. |
property HeadNode: pTidyNode (read-only); |
|
Returns the |
property HtmlNode: pTidyNode (read-only); |
|
Returns the |
property InlineTags: string (read/write); |
|
This option specifies new non-empty inline tags. This option takes a space or comma separated list of tag names. In order to process a document with previously unknown tags, you must either declare new tags, set ForceOutput to |
property InputCompleteCallback: tTidyInputCompleteCallback (read/write); |
|
This callback will be called when TTidy completes loading the document, but before the parsing begins. This can give you an opportunity to examine the document in its original state, before TidyLib repairs and reformats it. It is mostly useful when reading from a file or stdin using the ParseFile() method. Note that the InputCompleteCallback and the OnInputComplete event are mutually exclusive, that is, setting one will unset the other. |
property NCR: bool (read/write); |
|
This option specifies if Tidy should allow numeric character references. |
property ReportCallback: TidyReportFilter (read/write); |
|
This function will be called whenever the library needs to display errors, warnings or other information while parsing the document. Your callback function should match this prototype:
Note: TTidy(tidyGetAppData(doc)) The |
property RootNode: pTidyNode (read-only); |
|
Returns the root node of the parsed document. |
property Title: string (read-only); |
|
The Text contained inside the |
property WarningCount: uint (read-only); |
|
Returns the number of warnings that the library encountered while parsing the document. |
property XmlDecl: string (read-only); |
|
Returns the XML declaration ( if found ) of the parsed document |
property AllowUnknownTags: boolean (read/write); |
|
Setting this property to It will then add these to the list of tags that TidyLib will accept, and again try to parse the document. Unknown tags found by this operation are considered inline, and are considered empty if no closing tag is found. For greater control over the tags that tidy will accept, see the BlockTags, InlineTags and EmptyTags properties. |
property AsciiChars: bool (read/write); |
|
Can be used to modify behavior of the MakeClean property. Defaults to If set to |
property BreakBeforeBR: bool (read/write); |
|
This option specifies if Tidy should output a line break before each <BR> element. |
property CharEncoding: TidyEncodingID (read/write); |
|
This option specifies the character encoding Tidy uses for both the input and output.
You can use iso2022 for files encoded using the ISO-2022 family of encodings e.g. ISO-2022-JP. For mac and win1252, Tidy will accept vendor specific character values, but will use entities for all characters whose value > 127. Acceptable values are: |
property DropPropAttrs: bool (read/write); |
|
This option specifies if Tidy should strip out proprietary attributes, such as MS data binding attributes. |
property DuplicateAttrs: TidyDupAttrModes (read/write); |
|
This option specifies if Tidy should keep the first or last attribute, if an attribute is repeated, e.g. has two align attributes. |
property Emacs: bool (read/write); |
|
This option specifies if Tidy should change the format for reporting errors and warnings to a format that is more easily parsed by GNU Emacs. |
property ErrorFile: string (read/write); |
|
This option specifies the error file Tidy uses for errors and warnings. |
property EscapeCdata: bool (read/write); |
|
This option specifies if Tidy should convert <![CDATA[]]> sections to normal text. |
property FixBackslash: bool (read/write); |
|
This option specifies if Tidy should replace backslash characters "\" in URLs by forward slashes "/". |
property FixUri: bool (read/write); |
|
This option specifies if Tidy should check attribute values that carry URIsfor illegal characters and if such are found, escape them as HTML 4 recommends. |
property HideComments: bool (read/write); |
|
This option specifies if Tidy should print out comments. |
property HideEndTags: bool (read/write); |
|
This option specifies if Tidy should omit optional end-tags when generating the pretty printed markup. This option is ignored if you are outputting to XML. |
property InCharEncoding: TidyEncodingID (read/write); |
|
This option specifies the character encoding Tidy uses for the input. See the CharEncoding property for more info. |
property IndentAttributes: bool (read/write); |
|
This option specifies if Tidy should begin each attribute on a new line. |
property IndentCdata: bool (read/write); |
|
This option specifies if Tidy should indent <![CDATA[]]> sections. |
property JoinClasses: bool (read/write); |
|
This option specifies if Tidy should combine class names to generate a single new class name, if multiple class assignments are detected on an element. |
property JoinStyles: bool (read/write); |
|
This option specifies if Tidy should combine styles to generate a single new style, if multiple style values are detected on an element. |
property LiteralAttribs: bool (read/write); |
|
This option specifies if Tidy should ensure that whitespace characters within attribute values are passed through unchanged. |
property MergeDivs: uint (read/write); |
|
Can be used to modify behavior of the MakeClean option. This option specifies if Tidy should merge nested If set to 0, the If set to 1, the attributes of the inner If set to 2, the attributes of the inner |
property OnInputComplete: tTidyInputCompleteEvent (read/write); |
|
This event will be fired when TTidy completes loading the document, but before the parsing begins. This can give you an opportunity to examine the document in its original state, before TidyLib repairs and reformats it. It is mostly useful when reading from a file or stdin using the ParseFile() method. ( If you use the ParseString() method, you will, of course, already know what the input looks like! ) Note that the OnInputComplete event and the InputCompleteCallback are mutually exclusive, that is, setting one will unset the other. |
property OnReport: tTidyReportEvent (read/write); |
|
This event will be fired whenever the library needs to display errors, warnings or other information while parsing the document. This property is generally useful for component-based GUI-style applications. If you need a console-based C-Style callback, use the ReportCallback property. |
property OutCharEncoding: TidyEncodingID (read/write); |
|
This option specifies the character encoding Tidy uses for the output. May only be different from input-encoding for Latin encodings (ascii, latin1, mac, win1252). See the CharEncoding property for more info. |
property PreTags: string (read/write); |
|
This option specifies new tags that are to be processed in exactly the same way as an html This option takes a space or comma separated list of tag names. In order to process a document with previously unknown tags, you must either declare new tags, set ForceOutput to Note you can not as yet add new CDATA elements (similar to <SCRIPT>). |
property PunctWrap: bool (read/write); |
|
This option specifies if Tidy should line wrap after some Unicode or Chinese punctuation characters. |
property Quiet: bool (read/write); |
|
This option specifies if Tidy should output the summary of the numbers of errors and warnings, or the welcome or informational messages. |
property QuoteAmpersand: bool (read/write); |
|
This option specifies if Tidy should output unadorned & characters as &. |
property QuoteNbsp: bool (read/write); |
|
This option specifies if Tidy should output non-breaking space characters as entities, rather than as the Unicode character value 160 (decimal). |
property ReplaceColor: bool (read/write); |
|
This option specifies if Tidy should replace numeric values in color attributes by HTML/XHTML color names where defined, e.g. replace |
property ShowErrors: uint (read/write); |
|
This option specifies the number Tidy uses to determine if further errors should be shown. If set to 0, then no errors are shown. |
property ShowWarnings: bool (read/write); |
|
This option specifies if Tidy should suppress warnings. This can be useful when a few errors are hidden in a flurry of warnings. |
property VertSpace: bool (read/write); |
|
This option specifies if Tidy should add some empty lines for readability. |
property WrapAsp: bool (read/write); |
|
This option specifies if Tidy should line wrap text contained within ASP pseudo elements, which look like: |
property WrapAttVals: bool (read/write); |
|
This option specifies if Tidy should line wrap attribute values, for easier editing. This option can be set independently of wrap-script-literals. |
property WrapJste: bool (read/write); |
|
This option specifies if Tidy should line wrap text contained within JSTE pseudo elements, which look like: |
property WrapPhp: bool (read/write); |
|
This option specifies if Tidy should line wrap text contained within PHP pseudo elements, which look like: |
property WrapSection: bool (read/write); |
|
This option specifies if Tidy should line wrap text contained within <![ ... ]> section tags. |
property XmlTags: bool (read/write); |
|
This option specifies if Tidy should use the XML parser rather than the error correcting HTML parser. |