Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Static class: RT.Util.CuteML

Summary

Implements a parser for the minimalist text mark-up language CuteML.

Remarks

The “rules” of CuteML are, in summary:

  • A CuteML tag starts with [ and ends with ].
  • The character following the [ is the tag name. This can be any character except for <. For example, the following is legal CuteML: this is [*bold] text.
  • Optional attribute data may be inserted between the [ and the tag name enclosed in <...>. For example, the following is legal CuteML: this is [<red>:red] text. This attribute data may not contain the characters [, ] or <.
  • The special tags [(] and [)] can be used to insert an opening and closing literal square bracket, respectively.
  • The special tag [ ...] (i.e., the tag name is the space character) can be used to insert a matching literal square bracket. In other words, [ xyz] is equivalent to [(]xyz[)].

Static methods

string
EscapeCuteML(this string input)
Escapes the input string such that it can be used in CuteML syntax. The result will have its [ and ] replaced with [(] and [)].
CuteNode
ParseCuteML(this string input)
Parses the specified CuteML input. (see also remarks)
int
WordWrap<TState>(CuteNode node, TState initialState, int wrapWidth, CuteML.CuteMeasure<TState> measure, CuteML.CuteRender<TState> render, CuteML.CuteNextLine<TState> advanceToNextLine, CuteML.CuteNextState<TState> nextState)
Word-wraps a given piece of CuteML, assuming that it is linearly flowing text. Newline (\n) characters can be used to split the text into multiple paragraphs. The special [+...] tag marks text that may not be broken by wrapping (effectively turning all spaces into non-breaking spaces).

Nested types

CuteMeasure<TState>
Provides a delegate for CuteML.WordWrap<TState>(CuteNode, TState, int, CuteML.CuteMeasure<TState>, CuteML.CuteRender<TState>, CuteML.CuteNextLine<TState>, CuteML.CuteNextState<TState>) which measures the width of a string.
CuteNextLine<TState>
Provides a delegate for CuteML.WordWrap<TState>(CuteNode, TState, int, CuteML.CuteMeasure<TState>, CuteML.CuteRender<TState>, CuteML.CuteNextLine<TState>, CuteML.CuteNextState<TState>) which advances to the next line.
Provides a delegate for CuteML.WordWrap<TState>(CuteNode, TState, int, CuteML.CuteMeasure<TState>, CuteML.CuteRender<TState>, CuteML.CuteNextLine<TState>, CuteML.CuteNextState<TState>) which determines how the text state (font, color etc.) changes for a given CuteML tag character. This delegate is called for all tags except for [+...], which is automatically processed to mean “nowrap”.
CuteRender<TState>
Provides a delegate for CuteML.WordWrap<TState>(CuteNode, TState, int, CuteML.CuteMeasure<TState>, CuteML.CuteRender<TState>, CuteML.CuteNextLine<TState>, CuteML.CuteNextState<TState>) which renders a piece of text.