Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Static class: RT.Util.EggsML

Summary

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

Remarks

The “rules” of EggsML are, in summary:

  • In EggsML, the following non-alphanumeric characters are “special” (have meaning): ~ @ # $ % ^ & * _ = + / \ | [ ] { } < > ` "
  • All other characters are always literal.
  • All the special characters can be escaped by doubling them.
  • The characters ~ @ # $ % ^ & * _ = + / \ | [ { < can be used to open a “tag”.
  • Tags that start with [ { < are closed with ] } >. All other tags are closed with the same character.
  • Tags can be nested arbitrarily. In order to start a nested tag of the same character as its immediate parent, triple the tag character. For example, *one ***two* three* contains an asterisk tag nested inside another asterisk tag, while *one *two* three* would be parsed as two asterisk tags, one containing “one ” and the other containing “ three”.
  • The backtick character (`) can be used to “unjoin” multiple copies of the same character. For example, ** is a literal asterisk, but *`* is an empty tag containing no text.
  • The double-quote character (") can be used to escape long strings of special characters, e.g. URLs.

Static methods

string
Escape(string input)
Escapes the input string such that it can be used in EggsML syntax. The result will either have no special characters in it or be entirely enclosed in double-quotes.
EggsNode
Parse(string input)
Parses the specified EggsML input. (see also remarks)
int
WordWrap<TState>(EggsNode node, TState initialState, int wrapWidth, EggsML.EggMeasure<TState> measure, EggsML.EggRender<TState> render, EggsML.EggNextLine<TState> advanceToNextLine, EggsML.EggNextState<TState> nextState)
Word-wraps a given piece of EggsML, assuming that it is linearly flowing text. Newline (\n) characters can be used to split the text into multiple paragraphs. See remarks for the special meaning of +...+ and <...>. (see also remarks)

Static properties

stringReturns all characters that have a special meaning in EggsML.

Nested types

EggMeasure<TState>
Provides a delegate for EggsML.WordWrap<TState>(EggsNode, TState, int, EggsML.EggMeasure<TState>, EggsML.EggRender<TState>, EggsML.EggNextLine<TState>, EggsML.EggNextState<TState>) which measures the width of a string.
EggNextLine<TState>
Provides a delegate for EggsML.WordWrap<TState>(EggsNode, TState, int, EggsML.EggMeasure<TState>, EggsML.EggRender<TState>, EggsML.EggNextLine<TState>, EggsML.EggNextState<TState>) which advances to the next line.
EggNextState<TState>
Provides a delegate for EggsML.WordWrap<TState>(EggsNode, TState, int, EggsML.EggMeasure<TState>, EggsML.EggRender<TState>, EggsML.EggNextLine<TState>, EggsML.EggNextState<TState>) which determines how the text state (font, color etc.) changes for a given EggsML tag character. This delegate is called for all tags except for +...+ and <...>.
EggRender<TState>
Provides a delegate for EggsML.WordWrap<TState>(EggsNode, TState, int, EggsML.EggMeasure<TState>, EggsML.EggRender<TState>, EggsML.EggNextLine<TState>, EggsML.EggNextState<TState>) which renders a piece of text.