using ZelWiki.Engine.Library;
using ZelWiki.Engine.Library.Interfaces;
namespace ZelWiki.Engine.Implementation
{
///
/// Handles links the wiki to another site.
///
public class ExternalLinkHandler : IExternalLinkHandler
{
///
/// Handles an internal wiki link.
///
/// Reference to the wiki state object
/// The address of the external site being linked to.
/// The text which should be show in the absence of an image.
/// The image that should be shown.
/// The 0-100 image scale factor for the given image.
public HandlerResult Handle(IZelEngineState state, string link, string? text, string? image)
{
if (string.IsNullOrEmpty(image))
{
return new HandlerResult($"{text}")
{
Instructions = [Constants.HandlerResultInstruction.DisallowNestedProcessing]
};
}
else
{
return new HandlerResult($"
")
{
Instructions = [Constants.HandlerResultInstruction.DisallowNestedProcessing]
};
}
}
}
}