From d5e5203170353b45b1a9cbf2a1bcfc47b41a3533 Mon Sep 17 00:00:00 2001 From: juha Date: Fri, 27 Mar 2020 21:55:15 +0000 Subject: [PATCH] Docs: Updated documentation for LazUtils. Issue #36834, patch from Don Siders. git-svn-id: trunk@62814 - --- docs/xml/lazutils/html2textrender.xml | 356 +++++++++++++--- docs/xml/lazutils/lazlinkedlist.xml | 564 +++++++++++++------------- 2 files changed, 580 insertions(+), 340 deletions(-) diff --git a/docs/xml/lazutils/html2textrender.xml b/docs/xml/lazutils/html2textrender.xml index 092868af5d..f1c58d0b9f 100644 --- a/docs/xml/lazutils/html2textrender.xml +++ b/docs/xml/lazutils/html2textrender.xml @@ -12,7 +12,7 @@

- html2textrender.pas contains an HTML-to-Text renderer. It converts HTML into plain text by stripping tags and their attributes. + html2textrender.pas contains an HTML-to-Text renderer. It converts HTML into plain text by converting tags and their attributes to a representation as plain text.

@@ -57,24 +57,29 @@

A UTF-8 Byte Order Mark in the HTML is ignored.

+

+ Set values for properties in the class instance to customize the content and formatting produced in the output. Use the Render method to parse and process the HTML content passed to the constructor, and generate the output for the class instance. +

- + + + + - - + HTML content examined in the class - + Output value without HTML tags and attributes - + Maximum number of lines allowed in the output from the class End of line marker, by default standard LineEnding - + Markup used at the start/end of title text @@ -93,148 +98,369 @@ Text added when there are too many lines - + Flag used to suppress output of line breaks in the output - + + Flag used to indicate that a DIV tag with a TITLE attribute is being processed + - + + Flag used to indicate that a space character needs to be added the end of a wrapped line + - + Indicates a line break needs to be appended in the output Increment (in spaces) for each nested HTML level - + + The current indentation level for the renderer + - + Number of lines added to the output for the class - + Length of the HTML examined in the class - + Current character position in the HTML Sets a pending line break to be added later + Sets a maximum of one pending line break to be added later + Appends text to the plaint-text output for the renderer + +

+ AddOutput is a Boolean function used to append the value specified in aText to the output for the renderer. +

+

+ AddOutput ensures that a space character is included for wrapped lines in the HTML when there are no pending new lines . Otherwise, the required number of line ending sequences are appended to the output for the render and the line count is increased accordingly. If the line count exceeds the maximum number allowed in Render, the value in MoreMark is appended to the output. +

+

+ Pending new line(s) also cause required indentation spaces to be appended to the output. +

+

+ The value in aText is appended to the output for the renderer prior to exiting from the method. +

+

+ AddOutput is used in the implementation of the Render, HtmlTag, and HtmlEntity methods. +

+
+ + + + + + +
- + Text value appended to the output for the renderer - - - - Handles an HTML tag and its attributes values - - - - - - Handles an HTML character entity - - - - - - Rest the state and output for the renderer + + True when the value was added to the output; False when the maximum number of lines is exceeded + + + + + Handles an HTML tag and its attributes values + +

+ HtmlTag is a Boolean function used to locate and process an HTML start or end tag, and any attribute name/value pairs present in the tag. HtmlTag handles the following HTML tag and attribute/value names: +

+
+
HTML
+
Sets the FInHeader flag to indicate that the content is for a whole page.
+ +
BODY
+
Call Reset to initialize the renderer.
+ +
P, /P, BR, /UL
+
Adds a new line sequence to the output.
+ +
DIV CLASS="Title"
+
+ Sets the fInDivTitle flag, and adds a NewLine and a TitleMark to the output. When the CLASS attribute is omitted or has a different value, only a NewLine sequence is appended. +
+ +
/DIV
+
+ Appends a trailing TitleMark, resets the FInDivTitle flag, and appends a NewLine sequence and decrements the indentation level. +
+ +
LI
+
+ Increments the indentation level and adds a single NewLine prior to adding the content in the list. +
+ +
/LI
+
Decrements the indentation level.
+ +
A
+
Appends a Space character and the LinkBegin sequence to the output.
+ +
/A
+
Appends a LinkEnd sequence and a Space character to the output.
+ +
HR
+
Adds a single NewLine and the content in HorzLine to the output.
+
+

+ All other tag names are ignored in the method. +

+

+ The return value contains True when the HTML content is successfully added by calling AddOutput. The return value is False when the maximum number of lines specified in the Render method is exceeded. +

+
+ + + Does not appear to recognize HTML5 empty attributes (with no attribute value assignment). + + +
+ + + True when output is successfully added to the output; False when the maximum number of lines is exceeded + + + + + Handles an HTML character entity + +

+ HtmlEntity is a Boolean function used to convert common character entities in HTML to their plain text equivalent. The following Named character entities are converted to their plain text equivalent: +

+
+
 
+
' '
+
<
+
'<'
+
&gt;
+
'>;'
+
&amp;
+
'&'
+
+

+ Other named character entities or numeric character entities are included verbatim in the plain text output. +

+

+ The return value is the result from the AddOutput method, and contains False when the maximum number of lines has been exceeded in the renderer. +

+
+ + + +
+ + True on success, False when the maximum number of lines is exceeded + + + + Resets the state and output for the renderer + +

+ Reset is a procedure used to reset the state and output for the renderer. Reset sets values for internal flags used in the class, and clears any content stored in the render output. +

+
- - Creates the class instance - + Constructor for the class instance + +

+ Create is the overloaded constructor for the class instance. An argument passed to the method contains the HTML content examined in the class as either a String value or a TStream instance. The Stream-based variant reads the content in Stream into a String variable for processing. The position in the stream is not changed prior to or after reading its content. +

+

+ Create stores the HTML content in aHTML to an internal member used when parsing and processing using methods in the class. A UTF-8 Byte Order Mark (BOM) at the start of the HTML content is removed prior to processing. +

+

+ Create sets the default values for the following properties: +

+
+
LineEndMark
+
Set to the value in the LineEnding constant for the platform or OS.
+
TitleMark
+
Set to the UTF-8 character '◈' (#9672 or #x25C8)
+
HorzLineMark
+
Set to the UTF-8 characters '——————————————————'.
+
LinkBeginMark
+
Set to the character '_'.
+
LinkEndMark
+
Set to the character '_'.
+
ListItemMark
+
Set to the UTF-8 characters '✶ ' (Hex #$2736).
+
MoreMark
+
+ Set to the characters '...' (Three Period characters - not an Ellipsis character). +
+
IndentStep
+
Set to 2.
+
+
- + String with the HTML content examined in the class - + TStream instance with the HTML content examined in the class Frees the class instance - + +

+ Destroy is the overridden destructor for the class instance. Destroy calls the inherited destructor. +

+
- Parses the HTML and renders to plain text + Parses the HTML and renders the plain text output

- Parses the HTML and renders to plain text. Output is limited to aMaxLines lines. Note: AddOutput, HtmlTag and HtmlEntity return False if MaxLines was exceeded. + Render is a String function used to parse the HTML passed as an argument to the constructor, and to render the plain text output in the return value. The output is limited to the number of lines specified in the aMaxLines argument. The default value for the argument is the MaxInt constant. +

+ + Please note: AddOutput, HtmlTag, and HtmlEntity return False if aMaxLines was exceeded. + +

+ Renders calls the Reset method to set the initial values for members and flags used in the class instance. The parsing mechanism looks for HTML tags and character entities/references, processes their content, and calls the AddOutput method. Whitespace (characters #32, #9, #10, and #13) between tags and entities is always normalized into a single space character. +

+

+ Render calls the HtmlTag, HtmlEntity, and AddOutput methods to process the HTML content passed to the method.

- + Maximum number of lines to process in the method - + String with the plain text content extracted from the HTML - - - + Defines the end-of-line character sequence + +

+ LineEndMark is a String property which contains the end-of-line character sequence inserted in the plain text output for the renderer. The default value for the property is the value from the LineEnding constant defined for the platform or OS. The value is inserted in the renderer output in the AddOutput method. +

+
+ + + +
- - - + Defines the character used to delimit a title or header + +

+ TitleMark is inserted both prior to and following a title/header found in the HTML content in the HtmlTag method. The default value is the UTF-8 character '◈' (Decimal #9672 or Hex #x25C8). +

+
+ + +
- - + Represents a HR tag in the plaint text output + +

+ HorzLineMark is used in the implementation of the HtmlTag method when a HR tag is encountered in the HTML content. The default value for the property is the UTF-8 characters '——————————————————' (Eighteen Hex #$2013 characters). +

+
- - - + Represents an A start tag in the plain text output + +

+ LinkBeginMark is a String property used to represent the start of the plain text output for an HTML A tag. LinkEndMark is used to represent the end of the anchor. The value is added to the plain text output for the renderer in the HtmlTag method. +

+
+ + + +
- - - + Represents an A end tag in the plain text output + +

+ LinkEndMark is a String property used to represent the end of the plain text output for an HTML A tag. LinkBeginMark is used to represent the start of the anchor. The value is added to the plain text output for the renderer in the HtmlTag method. +

+
+ + + +
- - - + Represents a list item in the plain text output + +

+ ListItemMark is a String property which contains the character(s) inserted before a HTML LI tag. The value is added to the plain text output for the renderer in the HtmlTag method. +

+
+ + + +
- - - + + Indicates that the plain text output is truncated due to a line limit restriction + + +

+ The default value for the property is three (3) Period ('.') characters - NOT an Ellipsis character. The value is added to the plain text output for the renderer when the maximum number of lines has been exceeded in the AddOutput method. +

+
+ + + + +
- - - + + Number of space characters used for each indentation level in the plain text output + + +

+ IndentStep is an Integer property used to indicate the number of space characters generated for each indentation level in the plain text output for the renderer. The default value for the property is 2, and is used in the implementation of the AddOutput method. +

+
+ + + +
+ diff --git a/docs/xml/lazutils/lazlinkedlist.xml b/docs/xml/lazutils/lazlinkedlist.xml index 61c635184e..4edd97c385 100644 --- a/docs/xml/lazutils/lazlinkedlist.xml +++ b/docs/xml/lazutils/lazlinkedlist.xml @@ -1,303 +1,317 @@ - + - + + + + Defines a simple doubly linked list + - + + + - - - - + + Implements an item in a doubly linked list + +

+ TLinkListItem is a class which implements an item in a doubly linked list. It represents the traversal nodes used in TLinkList, including the terminal (or sentinel) node. Properties are provided to access and maintain the Prior and Next items in the node traversal order. +

+
+ + + + + + + +
- - - - - - - - - - + + Contains a reference to the next item in the doubly linked list + + + - - - - - - - - + + Contains a reference to the previous item in the doubly linked list + + + - - - - - - - - + + Removes the references to the previous and next items for the list item + +

+ ResetItem sets the values in the Prior and Next properties to Nil. +

+
+ + + + +
- - - - - - - - - - + + Defines a simple doubly linked list class + +

+ TLinkList is a class which defines a navigational interface for a simple doubly linked list. +

+

+ TLinkList provides properties used to access the First and Last items in the linked list, the number of list items in Count, and the first free item in the linked list. Items in the linked list are represented using the TLinkListItem class, which provides Prior and Next properties for navigation of items in the list. +

+

+ TLinkList contains an abstract virtual CreateItem method that is used to create new items for the linked list. The method must be implemented in a descendent class to provided implementation details that address storage and ownership of the linked list items. See TGtkMessageQueue for an example of a concrete implementation of the TLinkList class. +

+
+ +
- - - - - - - - - - + + First free item in the linked list + - - - - - - - - + + Number of free items in the linked list + - - - - - - - - + + First list item in the linked list + - - - - - - - - + + Last list item in the linked list + - - - - - - - - + + Number of items in the linked list + - - - - - - - - + + + Removes the specified item from the linked list, and optionally frees the item instance + + + + + + List item updated in the method + - - - - - - - - - - + + Removes the traversal nodes for the specified linked list item + + + + + Linked list item updated in the method + - - - - + + + Specifies the interface used to create a new linked list item for the class + + +

+ CreateItem is an abstract virtual method which specifies the interface used to create a new linked list item for the class. The return value is the TLinkListItem class instance allocated in the method. CreateItem must be be implemented in a descendent class to handle storage and ownership for the items created in the linked list. +

+

+ CreateItem is used in the implementation of the GetNewItem method. +

+
+ + + +
+ + New link list item allocated in the method + - - - - - - - - - - + + + Gets a new linked list item by reusing a free item or creating a new one + + +

+ GetNewItem is a TLinkListItem function used to get a new item for the doubly linked list. GetNewItem checks for an unused item in the linked list, and creates a new TLinkListItem instance when a free item is not found. A reused item is updated to remove the Prior and Next traversal nodes in the linked list item. A new item is retrieved by calling the CreateItem method. +

+
+ + + + + + + +
+ + Linked list item reused or created in the method + - - - - + + + Configures and adds the specified item as the terminal node for the doubly linked list + + +

+ AddAsLast is a procedure used to make the specified list item the terminal node in the doubly linked list. AddAsLast updates the list item in AnItem by setting its Prior property to the node in Last. The value in its Next property is set to Nil. The updated list item is then assigned as the new value for the Last property. The value in First may be set to the value in AnItem when a prior node in the traversal order is not available. +

+

+ AddAdLast increments the value in the Count property. +

+
+ + + + + + + +
+ + Item saved as the last item in the linked list + - - - - - - - - - - + + First item in the doubly linked list + +

+ First is a read-only TLinkListItem property which represents the first traversal node in the doubly linked list. The value in First is updated in methods like Unbind and AddAsLast. +

+
+ + + + + +
- - - - + + Last item in the doubly linked list + +

+ Last is a read-only TLinkListItem property which represents the last (or terminal) traversal node in the doubly linked list. The value in Last is updated in methods like Unbind anf AddAsLast. +

+
+ + + + + +
- - - - - - - - - - + + Total number of items used in the doubly linked list + +

+ Count is a read-only Integer property which contains the number of traversal nodes in the doubly linked list. The value in Count is updated in method like Unbind and AddAsLast. +

+
+ + + + + + +
- - - - + + Removes the specified list item from the doubly linked list + +

+ Delete is a procedure used to remove the specified list item from the traversal nodes in the doubly linked list. No actions are performed in the method when AnItem is unassigned (contains Nil). +

+

+ Delete calls Unbind to update the traversal node for the affected list items. The Prior and Next nodes in AnItem are set to Nil to remove the item from the node order. Delete decrements the value in the Count property. +

+
+ + + + + + +
+ + Item removed from the traversal nodes in the list + - - - - - - - - - - + + + Relocates the specified list item to the last (or terminal) node for the linked list + + +

+ MoveToLast is a procedure used to move the specified list item to the last (or terminal) node in the doubly linked list. No actions are performed in the method when AnItem is unassigned (contains Nil). +

+

+ MoveToLast calls Unbind to ensure that AnItem is removed from the node traversal order in the linked list. MoveToLast calls AddAsLast to update the values in the Prior and Next properties in AnItem making it the terminal node in the traversal order. +

+
+ + + + + + +
+ + Item moved to the last node in the linked list + - - - - + + Removes all items in the doubly linked list + +

+ Clear is a procedure used to remove all items in the doubly linked list. Clear uses the class instance in First as the initial TLinkListItem in the node traversal order. While the node is assigned, it calls the Delete method for each of the TLinkListItem instances. +

+
+ + + + +
- - - - - - - - + + + Checks the validity of traversal nodes and node counts in the doubly linked list + + + + + + + Returns 0 when the traversal nodes and counts are valid, or a negative value an inconsistency is found + + - - - - - - - - + + Constructor for the class instance + + Create calls the inherited constructor. + + + - - - - - - - - + + Destructor for the class instance + +

+ Destroy calls Clear, and frees the unused items in the linked list. Destroy calls the inherited destructor prior to exiting from the method. +

+
+ + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
+ + +