Skip to content

Commit 94024af

Browse files
committed
Make BuiltInMarkupReplacer public; add docs for ProcessReplacementMarker
1 parent 605650e commit 94024af

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

YarnSpinner/YarnSpinner.Markup/IAttributeMarkerProcessor.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,39 @@ namespace Yarn.Markup
3030
/// <summary>Provides a mechanism for producing replacement text for a
3131
/// marker.</summary>
3232
/// <seealso cref="LineParser.RegisterMarkerProcessor"/>
33+
/// <seealso cref="LineParser.DeregisterMarkerProcessor(string)"/>
3334
public interface IAttributeMarkerProcessor
3435
{
36+
/// <summary>
37+
/// Produces replacement text for a marker.
38+
/// </summary>
39+
/// <param name="marker">The marker to process into replacement
40+
/// text.</param>
41+
/// <param name="childBuilder">A <see cref="System.Text.StringBuilder"/>
42+
/// that contains the child text contained within <paramref
43+
/// name="marker"/>. Use the methods on this stringbuilder to produce
44+
/// any text needed from this marker.</param>
45+
/// <param name="childAttributes">The child attributes of <paramref
46+
/// name="marker"/>.</param>
47+
/// <param name="localeCode">A BCP-47 locale code that represents the
48+
/// locale in which any processing should take place.</param>
49+
/// <example>
50+
/// <para>If the original text being processed by <see
51+
/// cref="LineParser.ParseString(string, string, bool)"/> is "<c>[a]
52+
/// text1 [b/] text2 [/a]</c>", then the following facts will be
53+
/// true:</para>
54+
/// <list type="bullet">
55+
/// <item>
56+
/// <paramref name="childBuilder"/> will contain the text "text1 text2".
57+
/// </item>
58+
/// <item>
59+
/// <paramref name="childAttributes"/> will contain a MarkupAttribute
60+
/// named "<c>b</c>".
61+
/// </item>
62+
/// </list>
63+
/// </example>
64+
/// <returns>The collection of diagnostics produced during processing,
65+
/// if any.</returns>
3566
public List<LineParser.MarkupDiagnostic> ProcessReplacementMarker(MarkupAttribute marker, System.Text.StringBuilder childBuilder, List<MarkupAttribute> childAttributes, string localeCode);
3667
}
3768
}

YarnSpinner/YarnSpinner.Markup/LineParser.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,11 @@ public void Dispose()
15981598
}
15991599
}
16001600

1601-
internal class BuiltInMarkupReplacer : IAttributeMarkerProcessor
1601+
/// <summary>
1602+
/// A marker processor that handles the built-in markers <c>[select]</c>
1603+
/// <c>[plural]</c>, and <c>[ordinal]</c>.
1604+
/// </summary>
1605+
public class BuiltInMarkupReplacer : IAttributeMarkerProcessor
16021606
{
16031607
private static readonly System.Text.RegularExpressions.Regex ValuePlaceholderRegex = new System.Text.RegularExpressions.Regex(@"(?<!\\)%");
16041608

@@ -1689,6 +1693,7 @@ internal class BuiltInMarkupReplacer : IAttributeMarkerProcessor
16891693
return diagnostics;
16901694
}
16911695

1696+
/// <inheritdoc/>
16921697
public List<LineParser.MarkupDiagnostic> ProcessReplacementMarker(MarkupAttribute marker, StringBuilder childBuilder, List<MarkupAttribute> childAttributes, string localeCode)
16931698
{
16941699
// we have somehow been given an invalid setup, can't continue so early out.

0 commit comments

Comments
 (0)