1
This commit is contained in:
@@ -5,7 +5,7 @@ using ZelWiki.Engine.Library.Interfaces;
|
||||
namespace ZelWiki.Engine.Implementation
|
||||
{
|
||||
/// <summary>
|
||||
/// 处理处理指令函数调用,这些函数会影响页面的处理方式,但不会直接替换为文本.
|
||||
///
|
||||
/// </summary>
|
||||
public class ProcessingInstructionFunctionHandler : IProcessingInstructionFunctionHandler
|
||||
{
|
||||
@@ -17,11 +17,11 @@ namespace ZelWiki.Engine.Implementation
|
||||
{
|
||||
if (_collection == null)
|
||||
{
|
||||
_collection =
|
||||
new FunctionPrototypeCollection(FunctionPrototypeCollection.WikiFunctionType.Instruction);
|
||||
_collection = new FunctionPrototypeCollection(FunctionPrototypeCollection.WikiFunctionType.Instruction);
|
||||
|
||||
#region
|
||||
#region Prototypes.
|
||||
|
||||
//Processing instructions:
|
||||
_collection.Add("@@Deprecate:");
|
||||
_collection.Add("@@Protect:<bool>{isSilent}='false'");
|
||||
_collection.Add("@@Tags: <string:infinite>[pageTags]");
|
||||
@@ -42,7 +42,7 @@ namespace ZelWiki.Engine.Implementation
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理各种页面
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="function"></param>
|
||||
@@ -63,6 +63,8 @@ namespace ZelWiki.Engine.Implementation
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
case "title":
|
||||
{
|
||||
state.PageTitle = function.Parameters.Get<string>("pageTitle");
|
||||
@@ -72,6 +74,8 @@ namespace ZelWiki.Engine.Implementation
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
case "hidefooterlastmodified":
|
||||
{
|
||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.HideFooterLastModified);
|
||||
@@ -81,6 +85,8 @@ namespace ZelWiki.Engine.Implementation
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
case "hidefootercomments":
|
||||
{
|
||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.HideFooterComments);
|
||||
@@ -89,6 +95,8 @@ namespace ZelWiki.Engine.Implementation
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
case "nocache":
|
||||
{
|
||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.NoCache);
|
||||
@@ -97,20 +105,22 @@ namespace ZelWiki.Engine.Implementation
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
case "deprecate":
|
||||
{
|
||||
if (state.NestDepth == 0)
|
||||
{
|
||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Deprecate);
|
||||
state.Headers.Add(
|
||||
"<div class=\"alert alert-danger\">此页面已被弃用,最终将被删除.</div>");
|
||||
state.Headers.Add("<div class=\"alert alert-danger\">此页面已被弃用,最终将被删除.</div>");
|
||||
}
|
||||
|
||||
return new HandlerResult(string.Empty)
|
||||
{
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
case "protect":
|
||||
{
|
||||
if (state.NestDepth == 0)
|
||||
@@ -119,67 +129,65 @@ namespace ZelWiki.Engine.Implementation
|
||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Protect);
|
||||
if (isSilent == false)
|
||||
{
|
||||
state.Headers.Add(
|
||||
"<div class=\"alert alert-info\">此页面已受到保护,非版主无法更改.</div>");
|
||||
state.Headers.Add("<div class=\"alert alert-info\">此页面已受到保护,非版主无法更改.</div>");
|
||||
}
|
||||
}
|
||||
|
||||
return new HandlerResult(string.Empty)
|
||||
{
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
case "template":
|
||||
{
|
||||
if (state.NestDepth == 0)
|
||||
{
|
||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Template);
|
||||
state.Headers.Add(
|
||||
"<div class=\"alert alert-secondary\">此页面是一个模板,不会出现在索引或术语表中.</div>");
|
||||
state.Headers.Add("<div class=\"alert alert-secondary\">此页面是一个模板,不会出现在索引或术语表中.</div>");
|
||||
}
|
||||
|
||||
return new HandlerResult(string.Empty)
|
||||
{
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
case "review":
|
||||
{
|
||||
if (state.NestDepth == 0)
|
||||
{
|
||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Review);
|
||||
state.Headers.Add(
|
||||
"<div class=\"alert alert-warning\">此页面已被标记为待审核,其内容可能不准确.</div>");
|
||||
state.Headers.Add("<div class=\"alert alert-warning\">此页面已被标记为待审核,其内容可能不准确.</div>");
|
||||
}
|
||||
|
||||
return new HandlerResult(string.Empty)
|
||||
{
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
case "include":
|
||||
{
|
||||
if (state.NestDepth == 0)
|
||||
{
|
||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Include);
|
||||
state.Headers.Add(
|
||||
"<div class=\"alert alert-secondary\">此页为包含页,不会出现在索引或术语表中.</div>");
|
||||
state.Headers.Add("<div class=\"alert alert-secondary\">此页为包含页,不会出现在索引或术语表中.</div>");
|
||||
}
|
||||
|
||||
return new HandlerResult(string.Empty)
|
||||
{
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
case "draft":
|
||||
{
|
||||
if (state.NestDepth == 0)
|
||||
{
|
||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Draft);
|
||||
state.Headers.Add(
|
||||
"<div class=\"alert alert-warning\">本页为草稿,可能包含不正确的信息包括但不仅限于实验性样式.</div>");
|
||||
state.Headers.Add("<div class=\"alert alert-warning\">本页为草稿,可能包含不正确的信息包括但不仅限于实验性样式.</div>");
|
||||
}
|
||||
|
||||
return new HandlerResult(string.Empty)
|
||||
{
|
||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||
|
||||
@@ -10,7 +10,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>C:\DropZone\TightWiki.Production\TightWiki</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
|
||||
Reference in New Issue
Block a user