Pardon our dust! Docs for Yarn Spinner for Unity 3.2 and Yarn Spinner for Godot C# are on docs.yarnspinner.dev (the old docs site). Docs for Yarn Spinner for Unity 3.3 (pre-release, out ASAP), Yarn Spinner for Godot GDScript and Yarn Spinner for Unreal Engine (work in progress) are on /docs/ (the new docs site).

LineParser

Parses text and produces markup information.
public sealed class LineParser : IDisposable

Inherits from System.Object

Implements System.IDisposable

#Nested Types

  • Represents a diagnostic message produced during markup parsing.

#Fields

#CharacterAttribute

The name of the implicitly-generated character attribute.
public const string CharacterAttribute = "character";

Type String

See also

#CharacterAttributeNameProperty

The name of the 'name' property, on the implicitly-generated character attribute.
public const string CharacterAttributeNameProperty = "name";

Type String

See also

#NoMarkupAttribute

The name of the attribute to use to indicate that no marker processing should occur.
public const string NoMarkupAttribute = "nomarkup";

Type String

#ReplacementMarkerContents

The name of the property in replacement attributes that contains the text of the attribute.
public const string ReplacementMarkerContents = "contents";

Type String

#TrimWhitespaceProperty

The name of the property to use to signify that trailing whitespace should be trimmed if a tag had preceding whitespace or begins the line. This property must be a bool value.
public const string TrimWhitespaceProperty = "trimwhitespace";

Type String

#Methods

#DeregisterMarkerProcessor(string)

Removes any marker processor associated with a given marker name.
public void DeregisterMarkerProcessor(string attributeName)

Parameters

  • attributeNamestring
    The name of the marker.

#Dispose()

public void Dispose()

#ExpandSubstitutions(string, IList<string>)

Replaces all substitution markers in a text with the given substitution list.
public static string ExpandSubstitutions(string text, IList<string> substitutions)

Parameters

  • textstring
    The text containing substitution markers.
  • substitutionsSystem.Collections.Generic.IList<string>
    The list of substitutions.

Returns String: text, with the content from substitutions inserted.

This method replaces substitution markers - for example, {0} - with the corresponding entry in substitutions. If text contains a substitution marker whose index is not present in substitutions, it is ignored.

#ParseString(string, string, bool)

Parses a string of text and produces a markup parse result.
public MarkupParseResult ParseString(string input, string localeCode, bool addImplicitCharacterAttribute = true)

Parameters

  • inputstring
    The text to parse.
  • localeCodestring
    The locale to use when processing markers, as a BCP-47 locale tag.
  • squish(unknown)
    If false, markers that are split as part of the markup parsing process will not be re-merged before returning the result.
  • sort(unknown)
    If true, markers will be sorted based on their position in the input.å
  • addImplicitCharacterAttributebool
    If true, the parser will attempt to detect a character name in the text and add a [character] attribute for it.

Returns MarkupParseResult: A markup parse result.

#ParseStringAndIncludeMarkupDiagnostics(string, string, bool)

Parses a string of text and produces a markup parse result.
public (MarkupParseResult markup, List<MarkupDiagnostic> diagnostics) ParseStringAndIncludeMarkupDiagnostics(string input, string localeCode, bool addImplicitCharacterAttribute = true)

Parameters

  • inputstring
    The text to parse.
  • localeCodestring
    The locale to use when processing markers, as a BCP-47 locale tag.
  • squish(unknown)
    If false, markers that are split as part of the markup parsing process will not be re-merged before returning the result.
  • sort(unknown)
    If true, markers will be sorted based on their position in the input.å
  • addImplicitCharacterAttributebool
    If true, the parser will attempt to detect a character name in the text and add a [character] attribute for it.

Returns ValueTuple: A markup parse result and a collection of diagnostics encountered while parsing the markup.

#RegisterMarkerProcessor(string, IAttributeMarkerProcessor)

Registers an object as a marker processor for a given marker name.
public void RegisterMarkerProcessor(string attributeName, IAttributeMarkerProcessor markerProcessor)

Parameters

  • attributeNamestring
    The name of the marker that should use this marker processor.
  • The object that should be invoked when markers with this name are encountered.
When a marker processor is registered for a marker name, the parser will ask the processor for text to insert into the plain text. This allows users of the LineParser class to dynamically replace text in a line. The nomarkup tag is implemented in this way by the LineParser class directly; the Dialogue class uses this mechanism to implement the select, plural and ordinal markers.

Generated from Yarn Spinner for Unity 3.3.