using TightWiki.Engine.Library;
using TightWiki.Engine.Library.Interfaces;
using static TightWiki.Engine.Library.Constants;
namespace TightWiki.Engine.Implementation
{
///
/// Handles basic markup/style instructions like bole, italic, underline, etc.
///
public class MarkupHandler : IMarkupHandler
{
///
/// Handles basic markup instructions like bole, italic, underline, etc.
///
/// Reference to the wiki state object
/// The sequence of symbols that were found to denotate this markup instruction,
/// The body of text to apply the style to.
public HandlerResult Handle(ITightEngineState state, char sequence, string scopeBody)
{
switch (sequence)
{
case '~': return new HandlerResult($"{scopeBody}");
case '*': return new HandlerResult($"{scopeBody}");
case '_': return new HandlerResult($"{scopeBody}");
case '/': return new HandlerResult($"{scopeBody}");
case '!': return new HandlerResult($"{scopeBody}");
default:
break;
}
return new HandlerResult() { Instructions = [HandlerResultInstruction.Skip] };
}
}
}