Click or drag to resize
HyperTextProcessor Class
A class for processing an input string as hyper text.
Inheritance Hierarchy
SystemObject
  Candlelight.UIHyperTextProcessor

Namespace: Candlelight.UI
Assembly: Assembly-CSharp-firstpass (in Assembly-CSharp-firstpass.dll) Version: 0.0.0.0
Syntax
C#
[SerializableAttribute]
public class HyperTextProcessor : IDisposable, 
	ITextSource

The HyperTextProcessor type exposes the following members.

Properties
  NameDescription
Public propertyStatic memberCloseTagCaptureGroup
Gets the name of the capture group used for a close tag in a piece of text.
Public propertyGUIStyle
Gets a GUIStyle for the current property values.
Public propertyInputText
Gets or sets the input text.
Public propertyInputTextSource
Gets or sets the input text source. If a value is assigned, its OutputText will be used in place of the value in the InputText property of this HyperTextProcessor.
Public propertyIsDynamicFontDesired
Gets or sets a value indicating whether dynamic font output is desired on this instance.
Public propertyIsDynamicFontEnabled
Gets a value indicating whether dynamic font output is enabled.
Public propertyIsRichTextDesired
Gets or sets a value indicating whether rich text is desired on this instance.
Public propertyIsRichTextEnabled
Gets a value indicating whether rich text is enabled on this instance.
Public propertyStatic memberOpenTagCaptureGroup
Gets the name of the capture group used for an open tag in a piece of text.
Public propertyOutputText
Gets the output text.
Public propertyReferenceFontSize
Gets or sets the reference font size. It should correspond to the font size where OutputText will be sent.
Public propertyStatic memberReservedTags
Gets the reserved tags.
Public propertyScaleFactor
Gets or sets the scale factor.
Public propertyShouldOverrideStylesFontSize
Gets or sets a value indicating whether this HyperTextProcessor should override the font size specified in styles, if one is assigned.
Public propertyStyles
Gets or sets the styles.
Public propertyStatic memberTextCaptureGroup
Gets the name of the capture group used for text enclosed in a tag.
Top
Methods
  NameDescription
Public methodDispose
Releases all resource used by the HyperTextProcessor object.
Public methodGetCustomTags(ListHyperTextProcessorCustomTag)
Gets the custom tags extracted from the text.
Public methodGetCustomTags(ListHyperTextProcessorCustomTag) Obsolete.
Public methodGetLinkKeywordCollections(ListHyperTextProcessorKeywordCollectionClass)
Gets the link keyword collections.
Public methodGetLinkKeywordCollections(ListHyperTextProcessorKeywordCollectionClass) Obsolete.
Public methodGetLinks(ListHyperTextProcessorLink)
Gets the links extracted from the text.
Public methodGetLinks(ListHyperTextProcessorLink) Obsolete.
Public methodGetQuadKeywordCollections(ListHyperTextProcessorKeywordCollectionClass)
Gets the quad keyword collections.
Public methodGetQuadKeywordCollections(ListHyperTextProcessorKeywordCollectionClass) Obsolete.
Public methodGetQuads(ListHyperTextProcessorQuad)
Gets the quads extracted from the text.
Public methodGetQuads(ListHyperTextProcessorQuad) Obsolete.
Public methodGetTagKeywordCollections(ListHyperTextProcessorKeywordCollectionClass)
Gets the tag keyword collections.
Public methodGetTagKeywordCollections(ListHyperTextProcessorKeywordCollectionClass) Obsolete.
Public methodOnEnable
Initializes this instance. Call this method when the provider is enabled, or this instance is otherwise first initialized.
Public methodSetLinkKeywordCollections(IEnumerableHyperTextProcessorKeywordCollectionClass) Obsolete.
Public methodSetLinkKeywordCollections(IListHyperTextProcessorKeywordCollectionClass)
Sets the link keyword collections.
Public methodSetQuadKeywordCollections(IEnumerableHyperTextProcessorKeywordCollectionClass) Obsolete.
Public methodSetQuadKeywordCollections(IListHyperTextProcessorKeywordCollectionClass)
Sets the quad keyword collections.
Public methodSetTagKeywordCollections(IEnumerableHyperTextProcessorKeywordCollectionClass) Obsolete.
Public methodSetTagKeywordCollections(IListHyperTextProcessorKeywordCollectionClass)
Sets the tag keyword collections.
Top
Events
  NameDescription
Public eventBecameDirty
Occurs whenever a value on this instance has changed.
Top
Remarks

This class's primary function is to extract <a> tags and their relevant information from the value supplied to the InputText property, and format the resulting string for the OutputText property. You can then use the GetLinks(ListHyperTextProcessorLink) method to get information about the links that were found, such as their character indices in OutputText. The minimal syntactical requirement for an <a> tag is the name attribute. For example, the input text "Here is a <a name="some_link">link</a>" will result in the output text "Here is a link".

Assigning a HyperTextStyles object to the Styles property also allows for some additional processing. If IsRichTextDesired is , then it will automatically convert any custom tags and quads found in InputText, as well as insert <color> tags as needed. If IsDynamicFontDesired is , then <size> tags will automatically be inserted for links, custom tags, and quads. The value of <size> tags depends on either the font size specified in the styles or the ReferenceFontSize property if no styles are assigned, as well as the ScaleFactor property. Information about custom tags and quads can then be extracted via GetCustomTags(ListHyperTextProcessorCustomTag) and GetQuads(ListHyperTextProcessorQuad). The syntactical requirements for custom styles are:

Link Classes: <a name="some_link" class="class_name">link</a>

Tags: <custom>text</custom>

Quads: <quad class="class_name" />

You can also assign KeywordCollection objects to automatically detect and tag keywords appearing in InputText as either links, custom tags, or quads. Any links automatically detected in this way will have a name attribute equal to the keyword. For example, the word "dog" would become "<a name="dog">dog</a>". Keywords may contain non-alphanumeric characters (i.e. [^A-Za-z0-9]). For example, "dog", "dog's", and ":)" may all be keywords.

Keywords will only be detected when occurring in text if they are not immediately preceded or followed by alphanumeric characters, except for keywords that begin or end with non-alphanumeric characters, respectively. For example, the keyword "dog" would be matched in any of the following strings:

  • "dog is good"
  • "-dog is good"
  • "I like the dog"
  • "I like the dog--he is good."
  • "I like the dog—he is good."
  • "I like the dog."
  • "Where has the dog gone?"
  • "Where has the -dog- gone?"
  • "That is my dog's toy" (Note that "'s" would not be matched)

However, the keyword "dog" would not be matched in the following strings:

  • I like dogs the best. (Immediately followed by letter "s")

On the other hand, the keyword ":)" would be matched in all of the following instances:

  • "Hi there :)"
  • "Hi there :)."
  • "Hi there .:)."
  • "Hi there:)"
  • "Hi:)there"
  • ":) Hi there"
  • ":)Hi there"

The class also allows specification of sizes as percentages rather than raw values. For example, you can use the pattern: "<size=120%>BIG TEXT</size>".

See Also