31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using ZelWiki.Engine.Library;
|
|
using ZelWiki.Engine.Library.Interfaces;
|
|
|
|
namespace ZelWiki.Engine.Implementation
|
|
{
|
|
public class HeadingHandler : IHeadingHandler
|
|
{
|
|
/// <summary>
|
|
/// 处理白哦提
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <param name="depth"></param>
|
|
/// <param name="link"></param>
|
|
/// <param name="text"></param>
|
|
/// <returns></returns>
|
|
public HandlerResult Handle(IZelEngineState state, int depth, string link, string text)
|
|
{
|
|
if (depth >= 2 && depth <= 6)
|
|
{
|
|
int fontSize = 8 - depth;
|
|
if (fontSize < 5) fontSize = 5;
|
|
|
|
string html = "<font size=\"" + fontSize + "\"><a name=\"" + link + "\"><span class=\"WikiH" +
|
|
(depth - 1).ToString() + "\">" + text + "</span></a></font>\r\n";
|
|
return new HandlerResult(html);
|
|
}
|
|
|
|
return new HandlerResult() { Instructions = [Constants.HandlerResultInstruction.Skip] };
|
|
}
|
|
}
|
|
} |