diff --git a/ZelWiki.Engine.Implementation/ProcessingInstructionFunctionHandler.cs b/ZelWiki.Engine.Implementation/ProcessingInstructionFunctionHandler.cs index 21ead69..8c5f867 100644 --- a/ZelWiki.Engine.Implementation/ProcessingInstructionFunctionHandler.cs +++ b/ZelWiki.Engine.Implementation/ProcessingInstructionFunctionHandler.cs @@ -5,7 +5,7 @@ using ZelWiki.Engine.Library.Interfaces; namespace ZelWiki.Engine.Implementation { /// - /// 处理处理指令函数调用,这些函数会影响页面的处理方式,但不会直接替换为文本. + /// /// 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:{isSilent}='false'"); _collection.Add("@@Tags: [pageTags]"); @@ -42,7 +42,7 @@ namespace ZelWiki.Engine.Implementation } /// - /// 处理各种页面 + /// /// /// /// @@ -53,141 +53,149 @@ namespace ZelWiki.Engine.Implementation switch (function.Name.ToLower()) { case "tags": //##tag(pipe|separated|list|of|tags) - { - var tags = function.Parameters.GetList("pageTags"); - state.Tags.AddRange(tags); - state.Tags = state.Tags.Distinct().ToList(); + { + var tags = function.Parameters.GetList("pageTags"); + state.Tags.AddRange(tags); + state.Tags = state.Tags.Distinct().ToList(); - return new HandlerResult(string.Empty) - { - Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] - }; - } - case "title": - { - state.PageTitle = function.Parameters.Get("pageTitle"); - - return new HandlerResult(string.Empty) - { - Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] - }; - } - case "hidefooterlastmodified": - { - state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.HideFooterLastModified); - - return new HandlerResult(string.Empty) - { - Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] - }; - } - case "hidefootercomments": - { - state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.HideFooterComments); - return new HandlerResult(string.Empty) - { - Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] - }; - } - case "nocache": - { - state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.NoCache); - return new HandlerResult(string.Empty) - { - Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] - }; - } - case "deprecate": - { - if (state.NestDepth == 0) - { - state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Deprecate); - state.Headers.Add( - "
此页面已被弃用,最终将被删除.
"); - } - - return new HandlerResult(string.Empty) - { - Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] - }; - } - case "protect": - { - if (state.NestDepth == 0) - { - bool isSilent = function.Parameters.Get("isSilent"); - state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Protect); - if (isSilent == false) + return new HandlerResult(string.Empty) { - state.Headers.Add( - "
此页面已受到保护,非版主无法更改.
"); + Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] + }; + } + + //------------------------------------------------------------------------------------------------------------------------------ + case "title": + { + state.PageTitle = function.Parameters.Get("pageTitle"); + + return new HandlerResult(string.Empty) + { + Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] + }; + } + + //------------------------------------------------------------------------------------------------------------------------------ + case "hidefooterlastmodified": + { + state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.HideFooterLastModified); + + return new HandlerResult(string.Empty) + { + Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] + }; + } + + //------------------------------------------------------------------------------------------------------------------------------ + case "hidefootercomments": + { + state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.HideFooterComments); + return new HandlerResult(string.Empty) + { + Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] + }; + } + + //------------------------------------------------------------------------------------------------------------------------------ + case "nocache": + { + state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.NoCache); + return new HandlerResult(string.Empty) + { + Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] + }; + } + + //------------------------------------------------------------------------------------------------------------------------------ + case "deprecate": + { + if (state.NestDepth == 0) + { + state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Deprecate); + state.Headers.Add("
此页面已被弃用,最终将被删除.
"); } + return new HandlerResult(string.Empty) + { + Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] + }; } - return new HandlerResult(string.Empty) + //------------------------------------------------------------------------------------------------------------------------------ + case "protect": { - Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] - }; - } + if (state.NestDepth == 0) + { + bool isSilent = function.Parameters.Get("isSilent"); + state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Protect); + if (isSilent == false) + { + state.Headers.Add("
此页面已受到保护,非版主无法更改.
"); + } + } + 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( - "
此页面是一个模板,不会出现在索引或术语表中.
"); + if (state.NestDepth == 0) + { + state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Template); + state.Headers.Add("
此页面是一个模板,不会出现在索引或术语表中.
"); + } + return new HandlerResult(string.Empty) + { + Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] + }; } - 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( - "
此页面已被标记为待审核,其内容可能不准确.
"); + if (state.NestDepth == 0) + { + state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Review); + state.Headers.Add("
此页面已被标记为待审核,其内容可能不准确.
"); + } + return new HandlerResult(string.Empty) + { + Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] + }; } - 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( - "
此页为包含页,不会出现在索引或术语表中.
"); + if (state.NestDepth == 0) + { + state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Include); + state.Headers.Add("
此页为包含页,不会出现在索引或术语表中.
"); + } + return new HandlerResult(string.Empty) + { + Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] + }; } - 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( - "
本页为草稿,可能包含不正确的信息包括但不仅限于实验性样式.
"); + if (state.NestDepth == 0) + { + state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Draft); + state.Headers.Add("
本页为草稿,可能包含不正确的信息包括但不仅限于实验性样式.
"); + } + return new HandlerResult(string.Empty) + { + Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] + }; } - - return new HandlerResult(string.Empty) - { - Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine] - }; - } } return new HandlerResult() { Instructions = [Constants.HandlerResultInstruction.Skip] }; } } -} \ No newline at end of file +} diff --git a/ZelWiki/Properties/PublishProfiles/FolderProfile.pubxml b/ZelWiki/Properties/PublishProfiles/FolderProfile.pubxml index 5a80a38..e67ad32 100644 --- a/ZelWiki/Properties/PublishProfiles/FolderProfile.pubxml +++ b/ZelWiki/Properties/PublishProfiles/FolderProfile.pubxml @@ -10,7 +10,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU FileSystem - C:\DropZone\TightWiki.Production\TightWiki FileSystem <_TargetId>Folder